You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Raj Floyd <ra...@gmail.com> on 2011/04/11 17:50:51 UTC

Display SOAP Headers

Hi,

Does CXF has any API to display the SOAP headers? I saw
org.apache.cxf.headers package and wondering if that can help. Any example
would be appreciated. Would like to display headers in the service method.

Thx

Raj

Re: Display SOAP Headers

Posted by Raj Floyd <ra...@gmail.com>.
Thanks Hannes.

On Tue, Apr 12, 2011 at 7:17 PM, Hannes Holtzhausen <
hannes.holtzhausen@gmail.com> wrote:

> Hi
>
> That is the default toString() behaviour of the XML parser you are
> using. You would need to cast it to a org.w3c.dom.Element and extract
> or
> transform the value.
>
> Cheers
> Hannes
>
>
> On Tue, Apr 12, 2011 at 3:41 PM, Raj Floyd <ra...@gmail.com> wrote:
> > My soap header is as follows
> >
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> > <soap:Header>
> > <ns2:UserDetail xmlns:ns2="http://test/">
> > <fname>Raj</fname><lname>Floyd</lname>
> > </ns2:UserDetail>
> > </soap:Header>
> > ...
> > </soap:Envelope>
> >
> > The output of header.getObject() looks like the following
> > [ns2:UserDetail: null]
> >
> > Is that the correct behavior? I mean why it is showing null?
> >
> > Thx
> >
> > Raj
> >
> >
> >
> >
> > On Tue, Apr 12, 2011 at 1:09 PM, Raj Floyd <ra...@gmail.com> wrote:
> >
> >> Thanks Freeman.
> >>
> >>
> >> On Tue, Apr 12, 2011 at 8:08 AM, Freeman Fang <freeman.fang@gmail.com
> >wrote:
> >>
> >>> Hi,
> >>>
> >>> Something like
> >>> SoapMessage message =
> >>> (SoapMessage)PhaseInterceptorChain.getCurrentMessage();
> >>> for (Header header : message.getHeaders()) {
> >>>  //print out the soap headers
> >>> }
> >>>
> >>> Freeman
> >>>
> >>> On 2011-4-11, at 下午11:50, Raj Floyd wrote:
> >>>
> >>>  Hi,
> >>>>
> >>>> Does CXF has any API to display the SOAP headers? I saw
> >>>> org.apache.cxf.headers package and wondering if that can help. Any
> >>>> example
> >>>> would be appreciated. Would like to display headers in the service
> >>>> method.
> >>>>
> >>>> Thx
> >>>>
> >>>> Raj
> >>>>
> >>>
> >>> ---------------------------------------------
> >>> Freeman Fang
> >>>
> >>> FuseSource
> >>> Email:ffang@fusesource.com
> >>> Web: fusesource.com
> >>> Twitter: freemanfang
> >>> Blog: http://freemanfang.blogspot.com
> >>> Connect at CamelOne May 24-26
> >>> The Open Source Integration Conference
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
>

Re: Display SOAP Headers

Posted by Hannes Holtzhausen <ha...@gmail.com>.
Hi

That is the default toString() behaviour of the XML parser you are
using. You would need to cast it to a org.w3c.dom.Element and extract
or
transform the value.

Cheers
Hannes


On Tue, Apr 12, 2011 at 3:41 PM, Raj Floyd <ra...@gmail.com> wrote:
> My soap header is as follows
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Header>
> <ns2:UserDetail xmlns:ns2="http://test/">
> <fname>Raj</fname><lname>Floyd</lname>
> </ns2:UserDetail>
> </soap:Header>
> ...
> </soap:Envelope>
>
> The output of header.getObject() looks like the following
> [ns2:UserDetail: null]
>
> Is that the correct behavior? I mean why it is showing null?
>
> Thx
>
> Raj
>
>
>
>
> On Tue, Apr 12, 2011 at 1:09 PM, Raj Floyd <ra...@gmail.com> wrote:
>
>> Thanks Freeman.
>>
>>
>> On Tue, Apr 12, 2011 at 8:08 AM, Freeman Fang <fr...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> Something like
>>> SoapMessage message =
>>> (SoapMessage)PhaseInterceptorChain.getCurrentMessage();
>>> for (Header header : message.getHeaders()) {
>>>  //print out the soap headers
>>> }
>>>
>>> Freeman
>>>
>>> On 2011-4-11, at 下午11:50, Raj Floyd wrote:
>>>
>>>  Hi,
>>>>
>>>> Does CXF has any API to display the SOAP headers? I saw
>>>> org.apache.cxf.headers package and wondering if that can help. Any
>>>> example
>>>> would be appreciated. Would like to display headers in the service
>>>> method.
>>>>
>>>> Thx
>>>>
>>>> Raj
>>>>
>>>
>>> ---------------------------------------------
>>> Freeman Fang
>>>
>>> FuseSource
>>> Email:ffang@fusesource.com
>>> Web: fusesource.com
>>> Twitter: freemanfang
>>> Blog: http://freemanfang.blogspot.com
>>> Connect at CamelOne May 24-26
>>> The Open Source Integration Conference
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>

Re: Display SOAP Headers

Posted by Raj Floyd <ra...@gmail.com>.
My soap header is as follows

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns2:UserDetail xmlns:ns2="http://test/">
<fname>Raj</fname><lname>Floyd</lname>
</ns2:UserDetail>
</soap:Header>
...
</soap:Envelope>

The output of header.getObject() looks like the following
[ns2:UserDetail: null]

Is that the correct behavior? I mean why it is showing null?

Thx

Raj




On Tue, Apr 12, 2011 at 1:09 PM, Raj Floyd <ra...@gmail.com> wrote:

> Thanks Freeman.
>
>
> On Tue, Apr 12, 2011 at 8:08 AM, Freeman Fang <fr...@gmail.com>wrote:
>
>> Hi,
>>
>> Something like
>> SoapMessage message =
>> (SoapMessage)PhaseInterceptorChain.getCurrentMessage();
>> for (Header header : message.getHeaders()) {
>>  //print out the soap headers
>> }
>>
>> Freeman
>>
>> On 2011-4-11, at 下午11:50, Raj Floyd wrote:
>>
>>  Hi,
>>>
>>> Does CXF has any API to display the SOAP headers? I saw
>>> org.apache.cxf.headers package and wondering if that can help. Any
>>> example
>>> would be appreciated. Would like to display headers in the service
>>> method.
>>>
>>> Thx
>>>
>>> Raj
>>>
>>
>> ---------------------------------------------
>> Freeman Fang
>>
>> FuseSource
>> Email:ffang@fusesource.com
>> Web: fusesource.com
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> Connect at CamelOne May 24-26
>> The Open Source Integration Conference
>>
>>
>>
>>
>>
>>
>>
>>
>>
>

Re: Display SOAP Headers

Posted by Raj Floyd <ra...@gmail.com>.
Thanks Freeman.

On Tue, Apr 12, 2011 at 8:08 AM, Freeman Fang <fr...@gmail.com>wrote:

> Hi,
>
> Something like
> SoapMessage message =
> (SoapMessage)PhaseInterceptorChain.getCurrentMessage();
> for (Header header : message.getHeaders()) {
>  //print out the soap headers
> }
>
> Freeman
>
> On 2011-4-11, at 下午11:50, Raj Floyd wrote:
>
>  Hi,
>>
>> Does CXF has any API to display the SOAP headers? I saw
>> org.apache.cxf.headers package and wondering if that can help. Any example
>> would be appreciated. Would like to display headers in the service method.
>>
>> Thx
>>
>> Raj
>>
>
> ---------------------------------------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
>
>
>
>
>
>
>
>
>

Re: Display SOAP Headers

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Something like
SoapMessage message =  
(SoapMessage)PhaseInterceptorChain.getCurrentMessage();
for (Header header : message.getHeaders()) {
   //print out the soap headers
}

Freeman
On 2011-4-11, at 下午11:50, Raj Floyd wrote:

> Hi,
>
> Does CXF has any API to display the SOAP headers? I saw
> org.apache.cxf.headers package and wondering if that can help. Any  
> example
> would be appreciated. Would like to display headers in the service  
> method.
>
> Thx
>
> Raj

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference