camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Tam <email.w...@gmail.com>
Subject Re: setting soap headers in camel cxf router
Date Mon, 07 Sep 2009 13:15:24 GMT
Hi Kavita,

ResponseContext map is a CXF implementation detail.  CXF client puts
information related to a response in that map.  The map is eventually
copied to the CXF response message.

I took another peek at camel-cxf code,  I don't expect the response
context to be null in normal code path.  It sounds like some exception
might have happened or the Camel message is not the right message
(i.e. it may not be the response message).  Do you see any error
messages in the log or anything suspicious?  If the message is not a
response message, getting the Header.HEADER_LIST from it won't give
you to right headers obviously.

It is a bid hard for me to see what's going on.  If you could provide
a little test case, I'll be glad to take a look.

Thanks,
William


On Mon, Sep 7, 2009 at 7:21 AM, kav m<kavita.misra@med.ge.com> wrote:
>
> Hi William,
>
> Thanks a lot for putting up the test case and also updating the CXF Wiki.
> I am having a POJO based camel-cxf service endpoint [details same as trivedi
> has put in this thread] and trying to set soap headers so that those can be
> displayed in the soapUI client.I was using  camel-cxf 1.6.0 but after
> reading your post, I am using camel-cxf 1.6.2
>
>
> I followed the code you have written in the wiki but on line no. 2 below , I
> get a null responseContext:
>
>  CxfMessage message = exchange.getIn().getBody(CxfMessage.class); //1
>  Map responseContext =
> (Map)message.getMessage().get(Client.RESPONSE_CONTEXT); //2
>  List<SoapHeader> soapHeaders =
> (List)responseContext.get(Header.HEADER_LIST); //3
>
> Can you tell me what this responseContext Map is and why am I getting it as
> null ?
>
> Since a null responseContext did not allow me to proceed further with the
> solution, I used the following code to ultimately obtain a List of
> soapHeaders-
>
>  CxfMessage cxfMessage = exchange.getIn().getBody(CxfMessage.class)
>  Message message = cxfMessage.getMessage();
>  List<SoapHeader> soapHeaders = (List<SoapHeader>)
> message.get(Header.HEADER_LIST);
>
> The rest of the code I used is exactly what you have in the wiki. Still I do
> not see any headers at all in the SoapUI client. [WS-Addressing is set to
> true in SoapUI]
> Besides the header I also need to set a POJO in the SoapBody which should be
> displayed in SoapUI. I am doing that using the following code and it is
> displaying perfectly fine.
>
> exchange.getOut().setBody(subscribeResponse);
>
> Please help me to also set the SoapHeaders in the response, so that they are
> visible in SoapUI along with the body.
>
> Thanks for your help.
>
> Regards,
> Kavita
>
>
>
>
>
>
>
> William Tam wrote:
>>
>> Hi Trivedi,
>>
>> After chatting with Willem a bit, I realized that the
>> InsertResponseOutHeaderProcessor should have been getting the "in"
>> message as opposed to the "out" message from the exchange since the
>> processor is in the pipeline.
>>
>> That is,
>>
>>             CxfMessage message =
>> exchange.getIn().getBody(CxfMessage.class);
>>
>> I will update the test and just want to be aware of it.
>>
>> Thanks,
>> William
>>
>> On Thu, Sep 3, 2009 at 12:27 AM, William Tam<email.wtam@gmail.com> wrote:
>>> Hi Trivedi,
>>>
>>> You can now find some samples in this test module:
>>> https://svn.apache.org/repos/asf/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/soap/headers/CxfMessageHeadersRelayTest.java.
>>>  Its Camel context definition is here :
>>> https://svn.apache.org/repos/asf/camel/branches/camel-1.x/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/message_headers_relay.xml
>>>
>>> The test of interest is
>>> testInoutOutOfBandHeaderCXFClientRelayWithHeaderInsertion and the
>>> route that the test references is:
>>> <route>
>>>  <from uri="cxf:bean:routerRelayEndpointWithInsertion"/>
>>>  <process ref="InsertRequestOutHeaderProcessor" />
>>>  <to uri="cxf:bean:serviceRelayEndpointWithInsertion"/>
>>>   <process ref="InsertResponseOutHeaderProcessor" />
>>> </route>
>>>
>>>
>>> Please note that the InsertResponseOutHeaderProcessor requires bug fix
>>> for (https://issues.apache.org/activemq/browse/CAMEL-1983).  I have
>>> submitted a fix the 1.x branch.  InsertRequestOutHeaderProcessor does
>>> not require any fixes.
>>>
>>> Cheers,
>>> William
>>>
>>>>>>>> Hi William,
>>>>>>>
>>>>>>> I am using Camel 1.x, can you provide me a sample how to set
headers
>>>>>>> in
>>>>>>> Exchange for POJO based CXF webservices?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Trivedi
>>>>>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/setting-soap-headers-in-camel-cxf-router-tp25068148p25328913.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message