I am looking for the best architectural pattern in using the
SOAP:address location: Hardcode the real endpoint or use localhost (in
our company on an Intranet site)
From what I can see there are two patterns:
1. Code the endpoint to the WSDL
Sample:
<wsdl:service name="StockQuoteService">
<wsdl:documentation>My first service</wsdl:documentation>
<wsdl:port name="StockQuotePort" binding="tns:sbnd">
<soap:address location="http://example.com/stockquote"/>
</wsdl:port>
</wsdl:service>
This would mean that my Java or C# Client can download the WSDL and
create via tool (i.e. WSDL.exe) the class and I can directly the
service.
2. Code as endpoint always http://localhost:<port> and transform this
URL in the proxy class.
For example
<wsdl:service name="StockQuoteService">
<wsdl:documentation>My first service</wsdl:documentation>
<wsdl:port name="StockQuotePort" binding="tns:sbnd">
<soap:address location="http://localhost:8090"/>
</wsdl:port>
</wsdl:service>
I could then change the URL in the class file (or make it configurable)
by replacing this URL with the URL that is exactly needed.
Following questions arise now:
- Which is the better architectural pattern
- In case of 1. each time the server changes, the webservice proxy
class has to be recompiled because of the change of the address.
- In case of 2. Would UDDI allow me to exchange the localhost with the
current correct endpoint?
- In case of 2. Would I be able to change the endpoint programmatically
when I want use the WebService with BizTalk?
Thanks for the help!