cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessio Soldano <asold...@redhat.com>
Subject On MessageContext properties retrieval in handlers
Date Thu, 12 Nov 2009 17:11:49 GMT
Hi,
I'm currently trying to get MessageContext.WSDL_OPERATION property value 
from the MessageContext passed in JAX-WS handlers. This is basically 
what was described in https://issues.apache.org/jira/browse/CXF-1698 .
It's not clear to me whether any change was actually made for that 
issue, but basically I think that's not working yet and I'm wondering if 
you would be fine with me setting the property above (as well as the 
WSDL_SERVICE, WSDL_INTERFACE, etc.) in the SOAPHandlerInInterceptor just 
before starting dealing with the jaxws handlers. That of course would be 
done only when the current exchange already has the current 
OperationInfo, calling a method similar to what is currently in 
RPCInInterceptor (which runs after the jaxws handlers and currently sets 
those props only when getting the operation from its own private 
getOperation(..) method):

private void setMessage(Message message,
                             BindingOperationInfo operation) {
        Exchange ex = message.getExchange();
        ex.put(BindingOperationInfo.class, operation);
        ex.put(OperationInfo.class, operation.getOperationInfo());
        ex.setOneWay(operation.getOperationInfo().isOneWay());

        //Set standard MessageContext properties required by JAX_WS, but 
not specific to JAX_WS.
        message.put(Message.WSDL_OPERATION, operation.getName());

        ServiceInfo si = operation.getBinding().getService();
        QName serviceQName = si.getName();
        message.put(Message.WSDL_SERVICE, serviceQName);

        QName interfaceQName = si.getInterface().getName();
        message.put(Message.WSDL_INTERFACE, interfaceQName);

        EndpointInfo endpointInfo = 
ex.get(Endpoint.class).getEndpointInfo();
        QName portQName = endpointInfo.getName();
        message.put(Message.WSDL_PORT, portQName);

       
        URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
        if (wsdlDescription == null) {
            String address = endpointInfo.getAddress();
            try {
                wsdlDescription = new URI(address + "?wsdl");
            } catch (URISyntaxException e) {
                //do nothing
            }
            endpointInfo.setProperty("URI", wsdlDescription);
        }
        message.put(Message.WSDL_DESCRIPTION, wsdlDescription);
    }   

This would basically allow jaxws handlers to access those properties in 
most of the cases.

Cheers
Alessio

-- 
Alessio Soldano
Web Service Lead, JBoss


Mime
View raw message