cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Puneet Gupta <dashingdudepun...@gmail.com>
Subject Re: Unable to retrieve <soapenv:Header> elements in interceptors.
Date Tue, 16 Sep 2014 03:58:38 GMT
Thanks Andrei for the solution. I have been looking for it for a while.

With respect to your second point I am not getting username and password
from SOAP header. Instead they are part of SOAP body. Purpose of doing this
it so is because we have migrated from Axis2 to Apache CXF and we don't
want our client to change their authentication process. Hence sticking with
our old approach.

Thanks again for your help.

On Mon, Sep 15, 2014 at 5:57 PM, Andrei Shakirin <ashakirin@talend.com>
wrote:

> Hi,
>
> Try this code to extract SOAP Headers:
>
> import org.apache.cxf.headers.Header;
> ...
> List<Header> headers = (List<Header>) message.get(Header.HEADER_LIST);
>
> Additional note: the OASIS specifies standard way to send UsernameToken in
> SOAP messages, supported by CXF:
>
> https://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os-UsernameTokenProfile.pdf
> https://web-gmazza.rhcloud.com/blog/entry/cxf-usernametoken-profile .
> Do you have a good reasons to use proprietary headers to transfer username
> and password?
>
> Regards,
> Andrei.
>
> > -----Original Message-----
> > From: Puneet Gupta [mailto:dashingdudepuneet@gmail.com]
> > Sent: Montag, 15. September 2014 06:48
> > To: users@cxf.apache.org
> > Subject: Unable to retrieve <soapenv:Header> elements in interceptors.
> >
> > Hi All,
> >
> > Below is the SOAP request which I am sending:
> >
> > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:web="http://webservice.test.com">
> >    <soapenv:Header>
> >       <web:system>valueHeader</web:system>
> >    </soapenv:Header>
> >    <soapenv:Body>
> >       <web:authenticateUser>
> >          <!--Optional:-->
> >          <web:username>valueUsername</web:username>
> >          <!--Optional:-->
> >          <web:password>valuePassword</web:password>
> >       </web:authenticateUser>
> >    </soapenv:Body>
> > </soapenv:Envelope>
> >
> > In In-Interceptor configured for input request, I am trying to retrieve
> header
> > value from SoapMessage but always getting blank list. Following code
> > used:
> >
> > protected List<Header> getHeader(SoapMessage message){ return
> > message.getHeaders(); }
> >
> > I am not able to retrieve the value from <soapenv:Header>.
> >
> > My interceptor is working on Phase.PRE_INVOKE.
> >
> > How can I retrieve the header value in In-Interceptor?
> >
> > Note: I have tried using WebServiceContext and always getting null for
> it.
> > Also its been suggested not to use WebServiceContext in interceptors:
> > https://issues.apache.org/jira/browse/CXF-2674
> >
> > Please help.
> >
> > Thanks, Puneet.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message