Search code examples
c#.netasp.net-mvcsoapwsdl

How to connect to WSDL service using Binding Url in .Net


I have been provided a Web Service which i need to consume in my MVC application . The user has provided WSDL URL : http://abc.xyz.nirp.com:50000/dir/wsdl?p=ic/310c503c873138a884ddd3ee4a5738e6

Binding Url: http://abc123.ad.xyx.com:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_HARMONY_D&receiverParty=&receiverService=&interface=ABC_OS&interfaceNamespace=http%3A%2F%2Fabc.com%2Fhcm%2Fabc

I am able to add a service reference using the WSDL URL using SOAP credential but i also need to add these in the web configs and app configs which i am not able to understand where to put .

Pointers on how to use this Binding Url and put it in Web Config and App Config which be really helpful for me.


Solution

  • Check your web.config. After adding a service reference visual studio adds the endpoint in your web.config. You probably have a section like that:

      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="DefaultServiceEndpoint">
              <security mode="None" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="ADDRESS_HERE"
            binding="wsHttpBinding" bindingConfiguration="DefaultServiceEndpoint"
            contract="ServiceReference1.SOME_CLASS" name="DefaultServiceEndpoint" />
        </client>
      </system.serviceModel>
    

    You can change the address here.