First, let me say I have been wrestling with this in my head for the past couple of weeks. I have not implemented this yet, but I think I have a workable solution...
In my mind, this really boils down to two seperate things:
- How to configure environment specific attributes for an application in general.
- How to handle the WSDL service location specifially.
There are several ways to solve #1. For the sake of simplicity. let's assume that every machine on which your WAR will be deployed will have a properties file at a well known location that will contain environment specific information:
Code:
debugLevel=WARN
wsdl.location=http://mytestserver
ldapServerName=testLdapServer
someOtherProperty=someEnvSpecificValue
These can easily be loaded using a PropertiesFactoryBean.
Since your WSDL is just a file in your deployed application, you probably have it somewhere at the root of your web application and access like this: http://localhost/MyApp/MyApplcation.wsdl. Since no URL is mapped to this extension in your application, the file is simply served as-is.
However, this is no reason you could not override this behavior and map *.wsdl to a servlet or Controller, which would in turn return the WSDL file indicated in the URL. However, before returning the file, it would do some simple property placeholder replacement. So, the bundled WSDL could look like this:
Code:
<wsdl:port binding="tns:MySOAPBinding" name="MySOAPBindingPort">
<wsdlsoap:address location="${wsdl.location}"/>
</wsdl:port>
and your servlet/Controller would take care of replacing ${wsdl.location} with the appropriate value.
If I get a chance, I will try to dummy up a simple example this evening. If you think this idea is awful, let me know and save me the trouble