I was recently asked to connect to a third party web service (*.asmx). I created a new ASP.NET website, and used the wizard to create the Service reference. When I went to call the service, the code complained that it did not know which endpoint to use.
I looked in the Web.config, and sure enough, the wizard created TWO bindings, and thus two end-points. By adding either endpoint to the service call, everything works perfectly.
My question then is simply meant to help me understand why I have two bindings, and if there is some reason that I should use one over the other? Or should I remove one, and if so, which?
The bindings look totally different to me, and I am assuming that two different protocols are being used (but they are both labeled SOAP, so..). I am very “front end focused” and don’t get involved in the back end mechanics very often, which is why I am asking. I’ll post the bindings below.
<bindings>
<basicHttpBinding>
<binding name="ServiceSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="ServiceSoap12">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://someURL.asmx" binding="basicHttpBinding"
bindingConfiguration="ServiceSoap" contract="ServiceReference.ServiceSoap"
name="ServiceSoap" />
<endpoint address="http://someURL.asmx" binding="customBinding"
bindingConfiguration="ServiceSoap12" contract="ServiceReference.ServiceSoap"
name="ServiceSoap12" />
</client>
I believe the service offers both SOAP 1.1 and SOAP 1.2. You will need to specify the client configuration to use in the constructor of the service reference class: