I have an ASP.NET webpage that has a web reference to a SOAP WSDL. If I call the methods associated with this WSDL (the methods live on another server), everything works fine. However, I'd like to be able to dynamically change the endpoint address where the WSDL points. The reason being that we host the same set of web services for different groups and we like to track who's using the web services. So, each set has its own URL.
I tried changing the "Url" property on my soap client object to a different endpoint, but when I do, the methods return this error:
Client found response content type of 'text/plain', but expected 'text/xml'
I'm thinking that the Url property confuses the proxy class into thinking that I'm now using a REST web service?
Here's some of my code:
mySoapNamespace.mySoapClient soapClient = new mySoapNamespace.mySoapClient();
//next I try to change the endpoint URL of the WSDL, misguided? ...
soapClient.Url = "http://a_different_url/my_soap_server.wsdl";
string result = soapClient.myTestMethod();
Response.Write(result);
And that's where I get the error. Does anyone know a fix or a different way to dynamically change the endpoint of a SOAP call?