You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Yognhe <ya...@gmail.com> on 2009/12/14 21:20:11 UTC

How to get parameter value from CXF Message

Hi,
Let us say, I have this web method: 

  public String getUserName(@WebParam(name = "userId") int userId);

In WSS4JInInterceptor, I need to check the validity of userId.  It seems to
me that I can get the value from the following code:

  Message cxfMessage = PhaseInterceptorChain.getCurrentMessage();
  SOAPMessage soapMessage = cxfMessage.getContent(SOAPMessage.class);

Could someone please give some pointers on how I should get the value from
cxfMessage or soapMessage?

Yonghe

-- 
View this message in context: http://old.nabble.com/How-to-get-parameter-value-from-CXF-Message-tp26779984p26779984.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to get parameter value from CXF Message

Posted by Daniel Kulp <dk...@apache.org>.
On Mon December 14 2009 3:20:11 pm Yognhe wrote:
> Hi,
> Let us say, I have this web method:
> 
>   public String getUserName(@WebParam(name = "userId") int userId);
> 
> In WSS4JInInterceptor, I need to check the validity of userId.  It seems to
> me that I can get the value from the following code:
> 
>   Message cxfMessage = PhaseInterceptorChain.getCurrentMessage();
>   SOAPMessage soapMessage = cxfMessage.getContent(SOAPMessage.class);
> 
> Could someone please give some pointers on how I should get the value from
> cxfMessage or soapMessage?

The SOAPMessage.getEnvelope() call would return what is castable to a DOM 
element.   With that, you can use the DOM APIs to search through or use an 
XPath processor or a bunch of options to extract that data from the DOM.

Dan


> 
> Yonghe
> 

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