I've been given the task to call an external WCF service in order to get some data. So far so good. However, in the WSDL of the service there's a binding address provided to Another URL which I Believe is an internal server at the 3rd party provider, and if I add a service reference in my Project to the service, all calls will be directed to the URL in the WSDL, even though that's a server I can't access, hence it throws an exception.
This is the part in the WSDL that seems to be causing the issues:
<wsdl:service name="TheService">
<wsdl:port name="BasicHttpBinding_ITheService" binding="tns:BasicHttpBinding_ITheService">
<soap:address location="https://www.foo.com/theservice.svc/theservice"/>
</wsdl:port>
In the above example, I don't have access to the "www.foo.com" server. Is there a way to override this URL and use the one I've been given by the provider?
Do you need the external service? If not, save the wsdl as a file then remove that part. Add a new reference but instead of pointing it to the service endpoint, use a file reference, like this:
file:///C:/foo/my.wsdl
I have used this with Apach Axis web services and it has worked for me. Good luck.