void IWsdlImportExtension.ImportEndpoint(WsdlImporter importer, WsdlEndpointConversionContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } #pragma warning suppress 56506 // Microsoft, these properties cannot be null in this context if (context.Endpoint.Binding == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context.Endpoint.Binding"); } BindingElementCollection bindingElements = GetBindingElements(context); MessageEncodingBindingElement messageEncodingBindingElement = bindingElements.Find <MessageEncodingBindingElement>(); TextMessageEncodingBindingElement textEncodingBindingElement = messageEncodingBindingElement as TextMessageEncodingBindingElement; if (messageEncodingBindingElement != null) { Type elementType = messageEncodingBindingElement.GetType(); if (elementType != typeof(TextMessageEncodingBindingElement) && elementType != typeof(BinaryMessageEncodingBindingElement) && elementType != typeof(MtomMessageEncodingBindingElement)) { return; } } EnsureMessageEncoding(context, messageEncodingBindingElement); foreach (OperationBinding wsdlOperationBinding in context.WsdlBinding.Operations) { OperationDescription operation = context.GetOperationDescription(wsdlOperationBinding); for (int i = 0; i < operation.Messages.Count; i++) { MessageDescription message = operation.Messages[i]; MessageBinding wsdlMessageBinding = context.GetMessageBinding(message); ImportMessageSoapAction(context.ContractConversionContext, message, wsdlMessageBinding, i != 0 /*isResponse*/); } foreach (FaultDescription fault in operation.Faults) { FaultBinding wsdlFaultBinding = context.GetFaultBinding(fault); if (wsdlFaultBinding != null) { ImportFaultSoapAction(context.ContractConversionContext, fault, wsdlFaultBinding); } } } }
void IWsdlImportExtension.ImportEndpoint(WsdlImporter importer, WsdlEndpointConversionContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (context.Endpoint.Binding == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context.Endpoint.Binding"); } MessageEncodingBindingElement encodingBindingElement = GetBindingElements(context).Find <MessageEncodingBindingElement>(); if (encodingBindingElement != null) { System.Type type = encodingBindingElement.GetType(); if (((type != typeof(TextMessageEncodingBindingElement)) && (type != typeof(BinaryMessageEncodingBindingElement))) && (type != typeof(MtomMessageEncodingBindingElement))) { return; } } EnsureMessageEncoding(context, encodingBindingElement); foreach (OperationBinding binding in context.WsdlBinding.Operations) { OperationDescription operationDescription = context.GetOperationDescription(binding); for (int i = 0; i < operationDescription.Messages.Count; i++) { MessageDescription message = operationDescription.Messages[i]; MessageBinding messageBinding = context.GetMessageBinding(message); ImportMessageSoapAction(context.ContractConversionContext, message, messageBinding, i != 0); } foreach (FaultDescription description3 in operationDescription.Faults) { FaultBinding faultBinding = context.GetFaultBinding(description3); if (faultBinding != null) { ImportFaultSoapAction(context.ContractConversionContext, description3, faultBinding); } } } }