You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cxf-cat <pa...@yahoo.com> on 2012/02/14 17:59:51 UTC

Soap CXF Interceptor: Add out-of-band SOAP headers

I'm trying to write an interceptor in the CXF soap client and server to
convey out-of-band data (a string).

I have configured the interceptors and verified that they're both firing.

The client does this:

Header header = new Header(
  new QName("http://service.web.ovation.aesd.xxxx.com", "token"),
"TEST_TOKEN",
  new JAXBDataBinding(String.class));
soapMessage.getHeaders().add(header);

On the server, soapMessage.getHeaders() returns an empty list.

I tried adding the header to my wsdl and that didn't work either:

<message name="TokenMessage">
    <part name="token" element="ct:token"/>
</message>

...

In each binding/operation/input element, I added the header:

<input>
  <soap:body use="literal" parts="guideRequest"/>
  <soap:header message="tns:TokenMessage" part="token"/>
</input>

No luck with that either. Still empty list of headers on the server.


--
View this message in context: http://cxf.547215.n5.nabble.com/Soap-CXF-Interceptor-Add-out-of-band-SOAP-headers-tp5483047p5483047.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Soap CXF Interceptor: Add out-of-band SOAP headers

Posted by Daniel Kulp <dk...@apache.org>.
Have you used wireshark or similar to see if the header is on the wire?   That 
would be step one.

If it is on the wire, check the phase and location of your interceptor on the 
incoming chain on the server side.  Late (after ReadHeadersInterceptor) in the 
READ phase would be ok.

Dan


On Tuesday, February 14, 2012 8:59:51 AM cxf-cat wrote:
> I'm trying to write an interceptor in the CXF soap client and server to
> convey out-of-band data (a string).
> 
> I have configured the interceptors and verified that they're both firing.
> 
> The client does this:
> 
> Header header = new Header(
>   new QName("http://service.web.ovation.aesd.xxxx.com", "token"),
> "TEST_TOKEN",
>   new JAXBDataBinding(String.class));
> soapMessage.getHeaders().add(header);
> 
> On the server, soapMessage.getHeaders() returns an empty list.
> 
> I tried adding the header to my wsdl and that didn't work either:
> 
> <message name="TokenMessage">
>     <part name="token" element="ct:token"/>
> </message>
> 
> ...
> 
> In each binding/operation/input element, I added the header:
> 
> <input>
>   <soap:body use="literal" parts="guideRequest"/>
>   <soap:header message="tns:TokenMessage" part="token"/>
> </input>
> 
> No luck with that either. Still empty list of headers on the server.
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Soap-CXF-Interceptor-Add-out-of-band-SOAP-h
> eaders-tp5483047p5483047.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com