You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dominic Harries <dp...@it-innovation.soton.ac.uk> on 2009/02/06 16:38:34 UTC

Reuse of conduits

Hi,

I am having some problems with the reuse of conduits when sending messages
from a service using a JAX-WS client.

Inside the service, additional context information about the message is
stored inside the reference parameters of an EndpointReferenceType.  This is
then set as the endpoint reference of the client:

JaxWsClientFactoryBean clientFactory = (JaxWsClientFactoryBean)
clientFactoryFactory.getObject();
clientFactory.setEndpointReference(theEpr);

This context information is then added to a SOAP header by an
OutInterceptor, which retrieves the endpoint using the following:

EndpointReferenceType target =
msg.getExchange().getConduit(msg).getTarget();

This works correctly the first time a message is sent, but on subsequent
calls to the service the original endpoint reference is returned, meaning
that the wrong context information is put into the SOAP header.

Looking through the CXF code, it looks like the same conduit is always used
for sending messages:

AbstractConduitSelector.getSelectedConduit(Message message) {
    if (selectedConduit == null) {
        ... create a new one ...
    }
    return selectedConduit; // otherwise return cached one
}

Does this mean that the getTarget() method of the conduit is unreliable?  If
that is the case, what would be a good way to get the context information
into a SOAP header?

Many thanks,

Dominic

-- 
View this message in context: http://www.nabble.com/Reuse-of-conduits-tp21874865p21874865.html
Sent from the cxf-user mailing list archive at Nabble.com.