Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.2.4
-
Fix Version/s: None
-
Component/s: Generator
-
Labels:None
-
Environment:java 1.5.0, maven 2.0.4, xfire 1.2.4, ant 1.6.5
-
Number of attachments :
Description
The generated code from wsgen hard codes the URL of the webservice into the client.java file.
This means it is not possible to easily switch between separate instances of the same service, for example, a DEV, UAT and PRODUCTION server.
I have got around this limitation by writing an ANT task which does a text based search and replace on the generated client.java...
<target name="parameterise-services" if="service">
<replace file="$
<replace file="${basedir}
/src/main/java/$
{generate.dir}/service/$
{service}/${service}Client.java" token='"$
{webservices.real.url}/$
{service}"' value="url" />
</target>
This has the effect of moving the url into a parameter of the client.java contructor instead of it being hard-coded. This allows me to have one set of generated code for many servers.
However, I consider my fix a hack and think it would be much better if wsgen supported this natively!
Thanks again,
James Burton
Sorry, I think you do support changing the url in your generated code via these methods in client.java
get<service>HttpPort(String url)
How silly of me not to notice that method!