Possibly, but I don't think you should do that in a CXF-specific manner
that you are envisioning. (I don't know of a CXF-specific manner
myself.)
It seems that basic Spring Dependency Injection (google) would easily
solve your problem. Create an instance variable called "endpointURL" in
your class, then use Spring DI to populate that value (which you store
in an XML config file) when you instantiate your web service client.
There are two types of DI here--you can have your client open an XML
file and read the endpoint URL from it, or you can have a Spring
application instantiate a copy of your client, providing it the
endpointURL from an XML file. That line of code you have below will then
automatically use the endpointURL that you have populated.
There is nothing new here, you just want to populate an instance value
from a Spring config file (like cxf.xml, or any other Spring config
file.) Spring DI is not too difficult, I would google for some
tutorials on it, or check the Spring user forums for advice.
Glen
Am Freitag, den 29.02.2008, 10:02 +0800 schrieb Christopher Cheng:
> Hi Glen,
>
> I am implementing the client side, so [1] is more relevant.
>
> I can see that the URL is changed at
>
> bp.getRequestContext().
> put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
> endpointURL);
>
> What I want to make it happen is that I could change the endpoint
> address in
> cxf.xml so that all calls are using the endpoint address is spring
> config
> instead of using the endpoint in wsdl defined. So is there a way to do
> it in
> cxf.xml instead of using the java code above?
>
>
>
> ----- Original Message -----
> From: "Glen Mazza" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, February 29, 2008 1:41 AM
> Subject: Re: how to change endpoint address in cxf.xml?
>
>
> >
> > I'm unsure if you're trying to change the URL that a SOAP client is
> > using,
> > or
> > a the URLs being employed by the web service.
> >
> > If the former, Step 7 of [1] might help you. You can use dependency
> > injection to feed a URL to your SOAP client, and use the Java code in
> > Step
> > #7 to dynamically change the URL based on what is fed in.
> >
> > If the latter, I'm not exactly certain but Note #4 of [2] may give
> > you an
> > indication of where this information is configured.
> >
> > HTH,
> > Glen
> >
> > [1] http://www.jroller.com/gmazza/date/20070817
> > [2] http://www.jroller.com/gmazza/date/20071019#notes
> >
> >
> >
> > Christopher Cheng wrote:
> >>
> >> How could I change the endpoint addresses of all service calls in
> >> cxf?
> >> I am trying to switch the endpoint address from
> >> https://myhost/websvc to
> >> http://myhost/websvc
> >> Is there a 1-line configuration to do that?
> >>
> >
> > --
> > View this message in context:
> >
http://www.nabble.com/how-to-change-endpoint-address-in-cxf.xml--tp15741255p15741843.html
> > Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
>
>