views:

487

answers:

2

My wsdl put a wrong domain in address location, How to fix it?

- <wsdl:service name="XWebService">
- <wsdl:port name="XServiceSoap" binding="tns:XWebServiceSoap">
  <soap:address location="https://machine.wrongdomain.com.br/webservices/MapleStoryWebService.asmx" /> 
  </wsdl:port>
- <wsdl:port name="XWebServiceSoap12" binding="tns:XWebServiceSoap12">
  <soap12:address location="https://machine.wrongdomain.com.br/webservices/XWebService.asmx" /> 
  </wsdl:port>
- <wsdl:port name="XWebServiceHttpGet" binding="tns:XWebServiceHttpGet">
  <http:address location="https://machine.wrongdomain.com.br/webservices/MapleStoryWebService.asmx" /> 
  </wsdl:port>
- <wsdl:port name="XWebServiceHttpPost" binding="tns:XWebServiceHttpPost">
  <http:address location="https://machine.wrongdomain.com.br/webservices/XWebService.asmx" /> 
  </wsdl:port>
  </wsdl:service>

The true domain is like https://machine.goodDomain.com.br

A: 

The address is taken from the URL used to access the WSDL. If it's different than the server you want to actually serve from, then you could change it by creating a class that extends SoapExtensionReflector. Here's a sample article on how to change the URL:

http://blogs.msdn.com/kaevans/archive/2005/11/16/493496.aspx

James Bailey
I should it is not necessary, because I have another machine with same configuration and it works fine in that. Why???
Rogerio Torres
Your generated proxy has a Url property. By default, this is filled with the url found in the wsdl. However, you can override this, if the address provided by the WSDL was changed
Marc Wittke
A: 

The initial response is correct. The default URL in the WSDL is dependent upon the URL used to access the WSDL.

The way my team handled changing service URLs in the past (for instance, transitioning from a development to a testing or production environment) is to use wsdl.exe to generate a code proxy for your web service (a proxy is actually created by making a web or service reference as well, but is not displayed in Visual Studio by default), you can edit the generated proxy class to read the service's URL from (??) wherever you want to store it - database, config file etc.

Jared