Relative WSDL soap:address location

Mihai picture Mihai · Aug 11, 2011 · Viewed 62.5k times · Source

Can I have the soap:address location in a WSDL relative to the WSDL location, or at least relative to the server? For instance I want to write:

<soap:address location="https://exampleserver.com/axis2/services/ExampleService" />

as:

<soap:address location="/axis2/services/ExampleService" />

This would enable faster deployment to multiple servers, like test servers. Also, in the case of axis2c if I want my service to be used both from HTTP or HTTPS life becomes harder for developers using my service as they can't simply import the WSDL from it's default location "?WSDL".

Answer

user159088 picture user159088 · Sep 2, 2011

The WSDL describes to clients the message formats, types, parameters etc needed to interact with the web service. This is then used by tools like WSDL2C to generate the code needed for the interaction.

But even if you expose your service on HTTP or HTTPS, the client stub code will be the same. You don't regenerate your client stubs for each endpoint address. The client stays the same, it's the access point that changes.

This address should not be hardcoded in the generated client code, it must be a configurable URL inside the client application.

Sure, you have an URL specified inside the WSDL and it's a nuisance when you deploy your web service in the dev server, and then to staging and next into production. The endpoints will be different in each environment (maybe multiplied by 2 for HTTP + HTTPS) but at this point your developers are not affected because you don't regenerate the code.

When it comes to access the web service, you would still have different addresses (for dev, staging and prod servers) even if it would be relative to something or absolute. So I don't see how it is helpful to have relative address inside the WSDL since you still have to manage the access points into the client configuration.