You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jim Talbut <jt...@spudsoft.co.uk> on 2009/10/08 11:36:12 UTC
How to change client URL using JNDI
Hi,
I have the following in my spring beans.xml
<jaxws:client id="wsClient"
serviceClass="bib.bob.bab.InternalPortType"
address="http://172.28.5.234:8080/feed" >
</jaxws:client>
<http:conduit name="http://172.28.5.234:8080/services.php?s=vacancyfeed">
<http:client ReceiveTimeout="1000" ConnectionTimeout="1000"
Connection="Keep-Alive" />
</http:conduit>
This means that I need to recompile and redeploy my war file in order
to change the web service address.
I would like to do this using JNDI so that I can deploy the same war
to testing and live environments, but I can't work out how to do it.
Is there are way to set the URL (and conduit) from JNDI using spring?
If not, how can I change the URL of the generated client from code?
Thanks.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Re: How to change client URL using JNDI
Posted by Daniel Kulp <dk...@apache.org>.
I really don't know enough about JNDI to answer this. However, there are
two thoughts:
1) You could use a spring PropertyPlaceholder (google it) to put the URL's and
such into a properties file that is different for local and production or
similar. The address would look like:
address="${my.service.url}"
or similar. I don't know if the PropertyPlaceholder thing can pull props
from JNDI.
2) Set it all programmatically:
URL is easy:
(BindingProvider)wsClient).getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS, "http://.....");
The conduit settings are documented at:
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html
See the section on "Using Java Code"
Dan
On Thu October 8 2009 5:36:12 am Jim Talbut wrote:
> Hi,
>
> I have the following in my spring beans.xml
> <jaxws:client id="wsClient"
> serviceClass="bib.bob.bab.InternalPortType"
> address="http://172.28.5.234:8080/feed" >
> </jaxws:client>
>
> <http:conduit name="http://172.28.5.234:8080/services.php?s=vacancyfeed">
> <http:client ReceiveTimeout="1000" ConnectionTimeout="1000"
> Connection="Keep-Alive" />
> </http:conduit>
>
> This means that I need to recompile and redeploy my war file in order
> to change the web service address.
> I would like to do this using JNDI so that I can deploy the same war
> to testing and live environments, but I can't work out how to do it.
>
> Is there are way to set the URL (and conduit) from JNDI using spring?
> If not, how can I change the URL of the generated client from code?
>
> Thanks.
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog