You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ken Hancock <ha...@gmail.com> on 2017/10/18 14:30:40 UTC

Dynamically changing endpoints

I'm implementing a client for a soap endpoint where the messages return
different callouts to be used for individual soap operations, each endpoint
supporting the same service wsdl.  Does anyone have suggestions on the best
way to change the endpoint for different soap operations?

I could create a separate proxy for each operation, but that seems
particularly slow and heavyweight.

RE: Dynamically changing endpoints

Posted by Andrei Shakirin <as...@talend.com>.
Hi Ken,

To make this property thread safe, it is enough to activate thread local in request context:

(BindingProvider)proxy).getRequestContext().put("thread.local.request.context", "true").

After that you can set different endpoints for the same proxy in different threads.

Regards,
Andrei.


From: Ken Hancock [mailto:hancockks@gmail.com]
Sent: Dienstag, 24. Oktober 2017 04:58
To: Andrei Shakirin
Subject: Re: Dynamically changing endpoints

Andrei,
Won't BindingProvider.ENDPOINT_ADDRESS_PROPERTY set it globally for the entire service?  That's not on a message-per-message basis, is it?


On Mon, Oct 23, 2017 at 4:55 PM, Andrei Shakirin <as...@talend.com>> wrote:
Hi,

One option is set BindingProvider.ENDPOINT_ADDRESS_PROPERTY in request context:

        final Greeter port = service.getGreeterPort();
        BindingProvider provider = (BindingProvider)port;
        provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,  address);

Regards,
Andrei.

> -----Original Message-----
> From: Ken Hancock [mailto:hancockks@gmail.com<ma...@gmail.com>]
> Sent: Mittwoch, 18. Oktober 2017 16:31
> To: users@cxf.apache.org<ma...@cxf.apache.org>
> Subject: Dynamically changing endpoints
>
> I'm implementing a client for a soap endpoint where the messages return
> different callouts to be used for individual soap operations, each endpoint
> supporting the same service wsdl.  Does anyone have suggestions on the best
> way to change the endpoint for different soap operations?
>
> I could create a separate proxy for each operation, but that seems particularly
> slow and heavyweight.


RE: Dynamically changing endpoints

Posted by Andrei Shakirin <as...@talend.com>.
Hi,

One option is set BindingProvider.ENDPOINT_ADDRESS_PROPERTY in request context:

        final Greeter port = service.getGreeterPort();
        BindingProvider provider = (BindingProvider)port;
        provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,  address);

Regards,
Andrei.

> -----Original Message-----
> From: Ken Hancock [mailto:hancockks@gmail.com]
> Sent: Mittwoch, 18. Oktober 2017 16:31
> To: users@cxf.apache.org
> Subject: Dynamically changing endpoints
> 
> I'm implementing a client for a soap endpoint where the messages return
> different callouts to be used for individual soap operations, each endpoint
> supporting the same service wsdl.  Does anyone have suggestions on the best
> way to change the endpoint for different soap operations?
> 
> I could create a separate proxy for each operation, but that seems particularly
> slow and heavyweight.