cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: On MessageContext properties retrieval in handlers
Date Thu, 12 Nov 2009 17:28:44 GMT

Well, what I'd LIKE to do (slightly disruptive so would need to be fully done 
on 2.3, not 2.2.x) is to NOT set them in the various XXXInInterceptor things 
at all and remove those keys off of Message.java.    Instead, since they 
really are jaxws things, update WrappedMessageContext in jaxws to map those 
keys to the appropriate exchange.get(BindingOperationInfo.class).getName() or 
whatever.    

95% of the time, those keys are not used so wasting time calculating them and 
storing them on the message/exchange is really just a waste of processing 
cycles.

Note: if you make the change to WrappedMessageContext such that if it is 
"null" on the exchange already, then do the above, I'd be happy to merge that 
back to 2.2.x.     The removal of the stuff from Message.java would need to be 
a migration guide thing for 2.3.

Does that make sense?  (just trying to remove stuff that isn't needed most of 
the time and make it an "on demand" kind of thing)


Dan



On Thu November 12 2009 12:11:49 pm Alessio Soldano wrote:
> 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
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message