Make the url a parameter of the client.java constructor instead of hard-coding
it
---------------------------------------------------------------------------------
Key: XFIRE-874
URL: http://jira.codehaus.org/browse/XFIRE-874
Project: XFire
Issue Type: Improvement
Components: Generator
Affects Versions: 1.2.4
Environment: java 1.5.0, maven 2.0.4, xfire 1.2.4, ant 1.6.5
Reporter: James Burton
Assigned To: Dan Diephouse
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="${basedir}/src/main/java/${generate.dir}/service/${service}/${service}Client.java"
token="public ${service}Client()" value="public ${service}Client(String url)"
/>
<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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email