VB.NET & SOAP - More than one endpoint configuration for that contract was found
Solution 1
Below are the steps i did try with the above web service and got back an invalid agentcode/password error message:
Click on Add web reference and add the URL and i have named it "CarHireRef" as the reference name and clicked OK.
Now my code to call a service looks as shown:
CarHireRef.fchXMLInterface ob = new CarHireRef.fchXMLInterface();
CarHireRef.ResultsGetLocations result = ob.GetAirportLocations("", "");
The above procedure does not have any config entry as i am adding a web reference and not a service reference.
Solution 2
It has created configuration provided below when I added service reference. There you can see two endpoints for the same contact.
You should either specify endpoint name what you are going to use like
var a = new ServiceReference1.fchXMLInterfaceSoapClient("fchXMLInterfaceSoap12");
or just remove unneeded endpoint configuration.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="fchXMLInterfaceSoap" 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="fchXMLInterfaceSoap12">
<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://www.flexiblecarhire.com/flexibleservice/fchxmlinterface.asmx"
binding="basicHttpBinding" bindingConfiguration="fchXMLInterfaceSoap"
contract="ServiceReference1.fchXMLInterfaceSoap" name="fchXMLInterfaceSoap" />
<endpoint address="http://www.flexiblecarhire.com/flexibleservice/fchxmlinterface.asmx"
binding="customBinding" bindingConfiguration="fchXMLInterfaceSoap12"
contract="ServiceReference1.fchXMLInterfaceSoap" name="fchXMLInterfaceSoap12" />
</client>
</system.serviceModel>
Related videos on Youtube
Jose Roberto Barros
Updated on June 04, 2022Comments
-
Jose Roberto Barros almost 2 years
I am trying to call the webservice that can be seen at: http://www.flexiblecarhire.com/flexibleservice/fchxmlinterface.asmx?op=GetAirportLocations
I am using VB.net, but any solution in C# will be very welcome.
The way I am doing it is:
I am adding a new Service Reference to http://www.flexiblecarhire.com/flexibleservice/fchxmlinterface.asmx and selecting fchXMLInterface > fchXMLInterfaceHttpPost
In my code I have:
Dim API As New ServiceReference1.fchXMLInterfaceSoapClient
When I run that, I am having an error message saying that:
An endpoint configuration section for contract 'ServiceReference1.fchXMLInterfaceSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
I checked the help at the first link I posted here and I could not find that. How can I fix that?
If I can't call this webservice as ServiceReference, how can I call this webservice?