I am using the app.config to differentiate "preview" vs "production" web service URLs to a remote web app. The WSDL is the same in both preview and production. But when I use a different URL than the one that Visual Studio has in the Web References folder, I get the following error: There is an error in XML document (2, 691).
Here is an example of how I set my code up to use the URL defined in the app settings:
MyNamespace.MyType.MyService ws = new MyNamespace.MyType.MyService()
{
Url = System.Configuration.ConfigurationManager.AppSettings["url"]
};
I did a diff between the two WSDLs and the only difference is the targetNamespace
attribute on the xsd:schema
and the location
attribute on the soap:address
element.
I have URL Behavior set to Dynamic and I know this is possible because I have done it before with other preview/production apps.