本文整理汇总了C#中System.Web.Services.Description类的典型用法代码示例。如果您正苦于以下问题:C# System.Web.Services.Description类的具体用法?C# System.Web.Services.Description怎么用?C# System.Web.Services.Description使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Web.Services.Description类属于命名空间,在下文中一共展示了System.Web.Services.Description类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WsdlContractConversionContext
internal WsdlContractConversionContext(ContractDescription contract, WsdlNS.PortType wsdlPortType)
{
this.contract = contract;
this.wsdlPortType = wsdlPortType;
this.wsdlOperations = new Dictionary<OperationDescription, WsdlNS.Operation>();
this.operationDescriptions = new Dictionary<WsdlNS.Operation, OperationDescription>();
this.wsdlOperationMessages = new Dictionary<MessageDescription, WsdlNS.OperationMessage>();
this.messageDescriptions = new Dictionary<WsdlNS.OperationMessage, MessageDescription>();
this.wsdlOperationFaults = new Dictionary<FaultDescription, WsdlNS.OperationFault>();
this.faultDescriptions = new Dictionary<WsdlNS.OperationFault, FaultDescription>();
this.operationBindings = new Dictionary<WsdlNS.Operation, Collection<WsdlNS.OperationBinding>>();
}
示例2: WsdlEndpointConversionContext
internal WsdlEndpointConversionContext(WsdlEndpointConversionContext bindingContext, ServiceEndpoint endpoint, WsdlNS.Port wsdlport)
{
this.endpoint = endpoint;
this.wsdlBinding = bindingContext.WsdlBinding;
this.wsdlPort = wsdlport;
this.contractContext = bindingContext.contractContext;
this.wsdlOperationBindings = bindingContext.wsdlOperationBindings;
this.operationDescriptionBindings = bindingContext.operationDescriptionBindings;
this.wsdlMessageBindings = bindingContext.wsdlMessageBindings;
this.messageDescriptionBindings = bindingContext.messageDescriptionBindings;
this.wsdlFaultBindings = bindingContext.wsdlFaultBindings;
this.faultDescriptionBindings = bindingContext.faultDescriptionBindings;
}
示例3: BeforeImport
public void BeforeImport(WsdlNS.ServiceDescriptionCollection wsdlDocuments, Xml.Schema.XmlSchemaSet xmlSchemas, ICollection<Xml.XmlElement> policy)
{
foreach (WsdlNS.ServiceDescription wsdl in wsdlDocuments)
{
if (wsdl != null)
{
foreach (WsdlNS.Binding wsdlBinding in wsdl.Bindings)
{
if (wsdlBinding != null && wsdlBinding.Extensions != null)
{
WsdlNS.SoapBinding soapBinding = (WsdlNS.SoapBinding)wsdlBinding.Extensions.Find(typeof(WsdlNS.SoapBinding));
if (soapBinding != null)
{
string transportUri = soapBinding.Transport;
if (!string.IsNullOrEmpty(transportUri) && transportUri.Equals(UdpConstants.WsdlSoapUdpTransportUri, StringComparison.Ordinal))
{
WsdlImporter.SoapInPolicyWorkaroundHelper.InsertAdHocPolicy(wsdlBinding, soapBinding.Transport, this.udpTransportUriKey);
}
}
}
}
}
}
}
示例4: AssertPolicy
public static PolicyAssertionCollection AssertPolicy (
WS.Binding binding, TestLabel label)
{
label.EnterScope ("FindPolicy");
XmlElement policy = null;
foreach (var extension in binding.Extensions) {
var xml = extension as XmlElement;
if (xml == null)
continue;
Assert.That (policy, Is.Null, label.Get ());
policy = xml;
}
Assert.That (policy, Is.Not.Null, label.Get ());
try {
return AssertPolicy (binding.ServiceDescription, policy, label);
} finally {
label.LeaveScope ();
}
}
示例5: AddToMetadataIfNotNull
void AddToMetadataIfNotNull(WSDescription.ServiceDescription serviceDescription)
{
if (serviceDescription != null) {
AddMetadataSection(MetadataSection.ServiceDescriptionDialect, serviceDescription);
}
}
示例6: ExportMessageBodyBinding
void ExportMessageBodyBinding(MessageDescription messageDescription, bool isRpc, bool isEncoded, WsdlNS.MessageBinding messageBinding)
{
WsdlNS.SoapBodyBinding bodyBinding = SoapHelper.GetOrCreateSoapBodyBinding(endpointContext, messageBinding, exporter);
if (bodyBinding == null)
return;
bodyBinding.Use = isEncoded ? WsdlNS.SoapBindingUse.Encoded : WsdlNS.SoapBindingUse.Literal;
if (isRpc)
{
string ns;
if (!ExportedMessages.WrapperNamespaces.TryGetValue(new MessageDescriptionDictionaryKey(endpointContext.ContractConversionContext.Contract, messageDescription), out ns))
ns = messageDescription.Body.WrapperNamespace;
bodyBinding.Namespace = ns;
}
if (isEncoded)
bodyBinding.Encoding = XmlSerializerOperationFormatter.GetEncoding(soapVersion);
}
示例7: ExportMessagePart
protected void ExportMessagePart(WsdlNS.Message message, MessagePartDescription part, XmlQualifiedName typeName, XmlSchemaType xsdType, bool isOptional, bool isNillable, bool skipSchemaExport, bool generateElement, string wrapperNs, XmlSchemaSequence wrapperSequence, XmlSchemaSet schemaSet)
{
if (IsNullOrEmpty(typeName) && xsdType == null)
return;
#if DEBUG
if (xsdType == null)
Fx.Assert(NamingHelper.IsValidNCName(typeName.Name), "Name value has to be a valid NCName.");
#endif
string elementName = part.Name;
string partName = string.IsNullOrEmpty(part.UniquePartName) ? elementName : part.UniquePartName;
WsdlNS.MessagePart wsdlPart = null;
if (generateElement)
{
if (wrapperSequence != null)
{
if (!skipSchemaExport)
ExportLocalElement(wrapperNs, partName, part.Namespace, typeName, xsdType, part.Multiple, isOptional, isNillable, wrapperSequence, schemaSet);
}
else
{
if (!skipSchemaExport)
ExportGlobalElement(elementName, part.Namespace, isNillable, typeName, xsdType, schemaSet);
wsdlPart = AddMessagePart(message, partName, new XmlQualifiedName(elementName, part.Namespace), XmlQualifiedName.Empty);
}
}
else
{
if (String.IsNullOrEmpty(typeName.Name))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxAnonymousTypeNotSupported, message.Name, partName)));
wsdlPart = AddMessagePart(message, partName, XmlQualifiedName.Empty, typeName);
}
if (wsdlPart != null)
{
part.UniquePartName = wsdlPart.Name;
}
}
示例8: CreateHeaderMessage
protected bool CreateHeaderMessage(MessageDescription message, out WsdlNS.Message wsdlMessage)
{
wsdlMessage = null;
if (ExportedMessages.WsdlHeaderMessages.ContainsKey(new MessageDescriptionDictionaryKey(contractContext.Contract, message)))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.MultipleCallsToExportContractWithSameContract)));
TypedMessageKey typedMessageKey = null;
if (message.IsTypedMessage)
{
typedMessageKey = new TypedMessageKey(message.MessageType, operation.DeclaringContract.Namespace, GetExtensionData());
if (ExportedMessages.TypedHeaderMessages.TryGetValue(typedMessageKey, out wsdlMessage))
{
this.ExportedMessages.WsdlHeaderMessages.Add(new MessageDescriptionDictionaryKey(contractContext.Contract, message), wsdlMessage);
return false;
}
}
string messageName = GetHeaderMessageName(message);
wsdlMessage = new WsdlNS.Message();
wsdlMessage.Name = messageName;
contractContext.WsdlPortType.ServiceDescription.Messages.Add(wsdlMessage);
if (message.IsTypedMessage)
ExportedMessages.TypedHeaderMessages.Add(typedMessageKey, wsdlMessage);
this.ExportedMessages.WsdlHeaderMessages.Add(new MessageDescriptionDictionaryKey(contractContext.Contract, message), wsdlMessage);
return true;
}
示例9: GetUniqueMessageName
string GetUniqueMessageName(WsdlNS.ServiceDescription wsdl, string messageNameBase)
{
return NamingHelper.GetUniqueName(messageNameBase, DoesMessageNameExist, wsdl);
}
示例10: ExportAnyMessage
void ExportAnyMessage(WsdlNS.Message message, MessagePartDescription part)
{
XmlSchemaSet schemas = this.exporter.GeneratedXmlSchemas;
XmlSchema schema = SchemaHelper.GetSchema(DataContractSerializerMessageContractImporter.GenericMessageTypeName.Namespace, schemas);
if (!schema.SchemaTypes.Contains(DataContractSerializerMessageContractImporter.GenericMessageTypeName))
{
XmlSchemaComplexType genericMessageType = new XmlSchemaComplexType();
genericMessageType.Name = DataContractSerializerMessageContractImporter.GenericMessageTypeName.Name;
XmlSchemaSequence bodySequence = new XmlSchemaSequence();
genericMessageType.Particle = bodySequence;
XmlSchemaAny anyElement = new XmlSchemaAny();
anyElement.MinOccurs = 0;
anyElement.MaxOccurs = decimal.MaxValue;
anyElement.Namespace = "##any";
bodySequence.Items.Add(anyElement);
SchemaHelper.AddTypeToSchema(genericMessageType, schema, schemas);
}
string partName = string.IsNullOrEmpty(part.UniquePartName) ? part.Name : part.UniquePartName;
WsdlNS.MessagePart wsdlPart = AddMessagePart(message, partName, XmlQualifiedName.Empty, DataContractSerializerMessageContractImporter.GenericMessageTypeName);
part.UniquePartName = wsdlPart.Name;
}
示例11: ExportFaultBinding
void ExportFaultBinding(FaultDescription fault, bool isEncoded, WsdlNS.OperationBinding operationBinding)
{
SoapHelper.CreateSoapFaultBinding(fault.Name, endpointContext, endpointContext.GetFaultBinding(fault), isEncoded);
}
示例12: ExportStreamBody
protected void ExportStreamBody(WsdlNS.Message message, string wrapperName, string wrapperNs, string partName, string partNs, bool isRpc, bool skipSchemaExport)
{
XmlSchemaSet schemas = this.exporter.GeneratedXmlSchemas;
XmlSchema schema = SchemaHelper.GetSchema(DataContractSerializerMessageContractImporter.StreamBodyTypeName.Namespace, schemas);
if (!schema.SchemaTypes.Contains(DataContractSerializerMessageContractImporter.StreamBodyTypeName))
{
XmlSchemaSimpleType streamBodyType = new XmlSchemaSimpleType();
streamBodyType.Name = DataContractSerializerMessageContractImporter.StreamBodyTypeName.Name;
XmlSchemaSimpleTypeRestriction contentRestriction = new XmlSchemaSimpleTypeRestriction();
contentRestriction.BaseTypeName = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Base64Binary).QualifiedName;
streamBodyType.Content = contentRestriction;
SchemaHelper.AddTypeToSchema(streamBodyType, schema, schemas);
}
XmlSchemaSequence wrapperSequence = null;
if (!isRpc && wrapperName != null)
wrapperSequence = ExportWrappedPart(message, wrapperName, wrapperNs, schemas, skipSchemaExport);
MessagePartDescription streamPart = new MessagePartDescription(partName, partNs);
ExportMessagePart(message, streamPart, DataContractSerializerMessageContractImporter.StreamBodyTypeName, null/*xsdType*/, false/*isOptional*/, false/*isNillable*/, skipSchemaExport, !isRpc, wrapperNs, wrapperSequence, schemas);
}
示例13: ExportMessageHeaderBinding
void ExportMessageHeaderBinding(MessageHeaderDescription header, XmlQualifiedName messageName, bool isEncoded, WsdlNS.MessageBinding messageBinding)
{
#if DEBUG
Fx.Assert(NamingHelper.IsValidNCName(messageName.Name), "Name value has to be a valid NCName.");
#endif
WsdlNS.SoapHeaderBinding headerBinding = SoapHelper.CreateSoapHeaderBinding(endpointContext, messageBinding);
headerBinding.Part = string.IsNullOrEmpty(header.UniquePartName) ? header.Name : header.UniquePartName;
headerBinding.Message = messageName;
headerBinding.Use = isEncoded ? WsdlNS.SoapBindingUse.Encoded : WsdlNS.SoapBindingUse.Literal;
if (isEncoded)
headerBinding.Encoding = XmlSerializerOperationFormatter.GetEncoding(soapVersion);
}
示例14: CustomPolicyConversionContext
public CustomPolicyConversionContext (WS.Binding binding, ServiceEndpoint endpoint)
: base (endpoint)
{
this.binding = binding;
assertions = new PolicyAssertionCollection ();
binding_elements = ((CustomBinding)endpoint.Binding).Elements;
}
示例15: ContainsHttpBindingExtension
static bool ContainsHttpBindingExtension(WsdlNS.Binding wsdlBinding)
{
//avoiding using wsdlBinding.Extensions.Find(typeof(WsdlNS.HttpBinding)) so the extension won't be marked as handled
foreach (object extension in wsdlBinding.Extensions)
{
if (extension is WsdlNS.HttpBinding)
{
string httpVerb = ((WsdlNS.HttpBinding)extension).Verb;
if (httpVerb.Equals("GET", StringComparison.OrdinalIgnoreCase) || httpVerb.Equals("POST", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
}
return false;
}