You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by trivedi kumar b <Tr...@ge.com> on 2009/06/18 22:49:13 UTC

RAW xml to SOAPMessage convertion in CXF WS endpiont

Hi,

I have a webservice endpoint(implemented with CXF and dataFormat as
"MESSAGE").. the endpoint receives RAW xml message always instead of POJO
object and the input request is a MTOM message. Now I want to extract the
SOAPBody and attachments (MTOM based) from this RAW XML. Can someone tell me
what is the best way to achieve this? I am getting raw xml in
exchange.getIn().getBody(), I am able to print this object and here is the
output: (you can also observe that with MTOM enabled, the SOAP message and
attachements are going as mime parts). I really appreciate any help on this.

===================================================

------=_Part_0_18152502.1245358049140
Content-Type: application/xop+xml; charset=UTF-8;
type="application/soap+xml;
action=\"DocumentRepository_ProvideAndRegisterDocumentSet-b\""
Content-Transfer-Encoding: 8bit
Content-ID: <ro...@soapui.org>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:urn="urn:ihe:iti:xds-b:2007"
xmlns:urn1="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
xmlns:urn2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:urn3="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
   <soap:Header/>
   <soap:Body>
      <urn:ProvideAndRegisterDocumentSetRequest>
         <urn:Document id="?"><inc:Include href="cid:965235575520"
xmlns:inc="http://www.w3.org/2004/08/xop/include"/></urn:Document>
      </urn:ProvideAndRegisterDocumentSetRequest>
   </soap:Body>
</soap:Envelope>
------=_Part_0_18152502.1245358049140
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-ID: <965235575520>

this is trivedi
------=_Part_0_18152502.1245358049140--

=======================================================

Thanks,
Trivedi
-- 
View this message in context: http://www.nabble.com/RAW-xml-to-SOAPMessage-convertion-in-CXF-WS-endpiont-tp24099613p24099613.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: RAW xml to SOAPMessage convertion in CXF WS endpiont

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

This is the Camel 1.x branch's CxfPayLoadSoapHeaderTest[1].

[1]https://svn.apache.org/repos/asf/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java

Willem

trivedi kumar b wrote:
> Hi Willem,
> 
> I am using Apache camel 1.6.1 version and I couldn't find CxfPayload.class
> file in the respective package. Is it something being supported in the later
> versions of apache camel? The below links are really useful, thanks a lot
> for providing them.
> 
> Thanks,
> Trivedi
> 
> 
> willem.jiang wrote:
>> Hi Trivedi,
>>
>> I think you mean the PAYLOAD dataformat, the answer is yes.
>> Here is a Unit test[1] in the camel trunk.
>> If you are using the POJO dataformat,  you can't get the SOAPBody
>> directly unless you use the WebServiceProvider API[2].
>>
>> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java
>> [2]http://camel.apache.org/cxf-example.html#CXFExample-CXFexampleforusingtheWebServiceProviderAPI
>>
>> Willem
>>
>> trivedi kumar b wrote:
>>> Hi Willem,
>>>
>>> Thank you very much for your response. I will try this option but have a
>>> quick question on this. With POJO option, I would directly get SOAPBody,
>>> what If I want to access soap headers for critical info like user
>>> credentials? Is there a way to get these deatils from message context?
>>>
>>> Thanks,
>>> Trivedi
>>>
>>>
>>> willem.jiang wrote:
>>>> CXF has some interceptors to deal with the attachment message.
>>>> Since you are using MESSAGE dataFormat, you can't get attachment message
>>>> from Message context.
>>>>
>>>> Can you try the PAYLOAD dataFormat? I think you could get attachments
>>>> from the message.
>>>>
>>>> Willem
>>>>
>>>> trivedi kumar b wrote:
>>>>> Hi,
>>>>>
>>>>> I have a webservice endpoint(implemented with CXF and dataFormat as
>>>>> "MESSAGE").. the endpoint receives RAW xml message always instead of
>>>>> POJO
>>>>> object and the input request is a MTOM message. Now I want to extract
>>>>> the
>>>>> SOAPBody and attachments (MTOM based) from this RAW XML. Can someone
>>>>> tell
>>>>> me
>>>>> what is the best way to achieve this? I am getting raw xml in
>>>>> exchange.getIn().getBody(), I am able to print this object and here is
>>>>> the
>>>>> output: (you can also observe that with MTOM enabled, the SOAP message
>>>>> and
>>>>> attachements are going as mime parts). I really appreciate any help on
>>>>> this.
>>>>>
>>>>> ===================================================
>>>>>
>>>>> ------=_Part_0_18152502.1245358049140
>>>>> Content-Type: application/xop+xml; charset=UTF-8;
>>>>> type="application/soap+xml;
>>>>> action=\"DocumentRepository_ProvideAndRegisterDocumentSet-b\""
>>>>> Content-Transfer-Encoding: 8bit
>>>>> Content-ID: <ro...@soapui.org>
>>>>>
>>>>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>>>>> xmlns:urn="urn:ihe:iti:xds-b:2007"
>>>>> xmlns:urn1="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
>>>>> xmlns:urn2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
>>>>> xmlns:urn3="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
>>>>>    <soap:Header/>
>>>>>    <soap:Body>
>>>>>       <urn:ProvideAndRegisterDocumentSetRequest>
>>>>>          <urn:Document id="?"><inc:Include href="cid:965235575520"
>>>>> xmlns:inc="http://www.w3.org/2004/08/xop/include"/></urn:Document>
>>>>>       </urn:ProvideAndRegisterDocumentSetRequest>
>>>>>    </soap:Body>
>>>>> </soap:Envelope>
>>>>> ------=_Part_0_18152502.1245358049140
>>>>> Content-Type: text/plain; charset=us-ascii
>>>>> Content-Transfer-Encoding: 7bit
>>>>> Content-ID: <965235575520>
>>>>>
>>>>> this is trivedi
>>>>> ------=_Part_0_18152502.1245358049140--
>>>>>
>>>>> =======================================================
>>>>>
>>>>> Thanks,
>>>>> Trivedi
>>>>
>>
>>
> 


Re: RAW xml to SOAPMessage convertion in CXF WS endpiont

Posted by trivedi kumar b <Tr...@ge.com>.
Hi Willem,

I am using Apache camel 1.6.1 version and I couldn't find CxfPayload.class
file in the respective package. Is it something being supported in the later
versions of apache camel? The below links are really useful, thanks a lot
for providing them.

Thanks,
Trivedi


willem.jiang wrote:
> 
> Hi Trivedi,
> 
> I think you mean the PAYLOAD dataformat, the answer is yes.
> Here is a Unit test[1] in the camel trunk.
> If you are using the POJO dataformat,  you can't get the SOAPBody
> directly unless you use the WebServiceProvider API[2].
> 
> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java
> [2]http://camel.apache.org/cxf-example.html#CXFExample-CXFexampleforusingtheWebServiceProviderAPI
> 
> Willem
> 
> trivedi kumar b wrote:
>> Hi Willem,
>> 
>> Thank you very much for your response. I will try this option but have a
>> quick question on this. With POJO option, I would directly get SOAPBody,
>> what If I want to access soap headers for critical info like user
>> credentials? Is there a way to get these deatils from message context?
>> 
>> Thanks,
>> Trivedi
>> 
>> 
>> willem.jiang wrote:
>>> CXF has some interceptors to deal with the attachment message.
>>> Since you are using MESSAGE dataFormat, you can't get attachment message
>>> from Message context.
>>>
>>> Can you try the PAYLOAD dataFormat? I think you could get attachments
>>> from the message.
>>>
>>> Willem
>>>
>>> trivedi kumar b wrote:
>>>> Hi,
>>>>
>>>> I have a webservice endpoint(implemented with CXF and dataFormat as
>>>> "MESSAGE").. the endpoint receives RAW xml message always instead of
>>>> POJO
>>>> object and the input request is a MTOM message. Now I want to extract
>>>> the
>>>> SOAPBody and attachments (MTOM based) from this RAW XML. Can someone
>>>> tell
>>>> me
>>>> what is the best way to achieve this? I am getting raw xml in
>>>> exchange.getIn().getBody(), I am able to print this object and here is
>>>> the
>>>> output: (you can also observe that with MTOM enabled, the SOAP message
>>>> and
>>>> attachements are going as mime parts). I really appreciate any help on
>>>> this.
>>>>
>>>> ===================================================
>>>>
>>>> ------=_Part_0_18152502.1245358049140
>>>> Content-Type: application/xop+xml; charset=UTF-8;
>>>> type="application/soap+xml;
>>>> action=\"DocumentRepository_ProvideAndRegisterDocumentSet-b\""
>>>> Content-Transfer-Encoding: 8bit
>>>> Content-ID: <ro...@soapui.org>
>>>>
>>>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>>>> xmlns:urn="urn:ihe:iti:xds-b:2007"
>>>> xmlns:urn1="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
>>>> xmlns:urn2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
>>>> xmlns:urn3="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
>>>>    <soap:Header/>
>>>>    <soap:Body>
>>>>       <urn:ProvideAndRegisterDocumentSetRequest>
>>>>          <urn:Document id="?"><inc:Include href="cid:965235575520"
>>>> xmlns:inc="http://www.w3.org/2004/08/xop/include"/></urn:Document>
>>>>       </urn:ProvideAndRegisterDocumentSetRequest>
>>>>    </soap:Body>
>>>> </soap:Envelope>
>>>> ------=_Part_0_18152502.1245358049140
>>>> Content-Type: text/plain; charset=us-ascii
>>>> Content-Transfer-Encoding: 7bit
>>>> Content-ID: <965235575520>
>>>>
>>>> this is trivedi
>>>> ------=_Part_0_18152502.1245358049140--
>>>>
>>>> =======================================================
>>>>
>>>> Thanks,
>>>> Trivedi
>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/RAW-xml-to-SOAPMessage-convertion-in-CXF-WS-endpiont-tp24099613p24132288.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: RAW xml to SOAPMessage convertion in CXF WS endpiont

Posted by Willem Jiang <wi...@gmail.com>.
Hi Trivedi,

I think you mean the PAYLOAD dataformat, the answer is yes.
Here is a Unit test[1] in the camel trunk.
If you are using the POJO dataformat,  you can't get the SOAPBody
directly unless you use the WebServiceProvider API[2].

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java
[2]http://camel.apache.org/cxf-example.html#CXFExample-CXFexampleforusingtheWebServiceProviderAPI

Willem

trivedi kumar b wrote:
> Hi Willem,
> 
> Thank you very much for your response. I will try this option but have a
> quick question on this. With POJO option, I would directly get SOAPBody,
> what If I want to access soap headers for critical info like user
> credentials? Is there a way to get these deatils from message context?
> 
> Thanks,
> Trivedi
> 
> 
> willem.jiang wrote:
>> CXF has some interceptors to deal with the attachment message.
>> Since you are using MESSAGE dataFormat, you can't get attachment message
>> from Message context.
>>
>> Can you try the PAYLOAD dataFormat? I think you could get attachments
>> from the message.
>>
>> Willem
>>
>> trivedi kumar b wrote:
>>> Hi,
>>>
>>> I have a webservice endpoint(implemented with CXF and dataFormat as
>>> "MESSAGE").. the endpoint receives RAW xml message always instead of POJO
>>> object and the input request is a MTOM message. Now I want to extract the
>>> SOAPBody and attachments (MTOM based) from this RAW XML. Can someone tell
>>> me
>>> what is the best way to achieve this? I am getting raw xml in
>>> exchange.getIn().getBody(), I am able to print this object and here is
>>> the
>>> output: (you can also observe that with MTOM enabled, the SOAP message
>>> and
>>> attachements are going as mime parts). I really appreciate any help on
>>> this.
>>>
>>> ===================================================
>>>
>>> ------=_Part_0_18152502.1245358049140
>>> Content-Type: application/xop+xml; charset=UTF-8;
>>> type="application/soap+xml;
>>> action=\"DocumentRepository_ProvideAndRegisterDocumentSet-b\""
>>> Content-Transfer-Encoding: 8bit
>>> Content-ID: <ro...@soapui.org>
>>>
>>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>>> xmlns:urn="urn:ihe:iti:xds-b:2007"
>>> xmlns:urn1="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
>>> xmlns:urn2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
>>> xmlns:urn3="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
>>>    <soap:Header/>
>>>    <soap:Body>
>>>       <urn:ProvideAndRegisterDocumentSetRequest>
>>>          <urn:Document id="?"><inc:Include href="cid:965235575520"
>>> xmlns:inc="http://www.w3.org/2004/08/xop/include"/></urn:Document>
>>>       </urn:ProvideAndRegisterDocumentSetRequest>
>>>    </soap:Body>
>>> </soap:Envelope>
>>> ------=_Part_0_18152502.1245358049140
>>> Content-Type: text/plain; charset=us-ascii
>>> Content-Transfer-Encoding: 7bit
>>> Content-ID: <965235575520>
>>>
>>> this is trivedi
>>> ------=_Part_0_18152502.1245358049140--
>>>
>>> =======================================================
>>>
>>> Thanks,
>>> Trivedi
>>
>>
> 


Re: RAW xml to SOAPMessage convertion in CXF WS endpiont

Posted by trivedi kumar b <Tr...@ge.com>.
Hi Willem,

Thank you very much for your response. I will try this option but have a
quick question on this. With POJO option, I would directly get SOAPBody,
what If I want to access soap headers for critical info like user
credentials? Is there a way to get these deatils from message context?

Thanks,
Trivedi


willem.jiang wrote:
> 
> CXF has some interceptors to deal with the attachment message.
> Since you are using MESSAGE dataFormat, you can't get attachment message
> from Message context.
> 
> Can you try the PAYLOAD dataFormat? I think you could get attachments
> from the message.
> 
> Willem
> 
> trivedi kumar b wrote:
>> Hi,
>> 
>> I have a webservice endpoint(implemented with CXF and dataFormat as
>> "MESSAGE").. the endpoint receives RAW xml message always instead of POJO
>> object and the input request is a MTOM message. Now I want to extract the
>> SOAPBody and attachments (MTOM based) from this RAW XML. Can someone tell
>> me
>> what is the best way to achieve this? I am getting raw xml in
>> exchange.getIn().getBody(), I am able to print this object and here is
>> the
>> output: (you can also observe that with MTOM enabled, the SOAP message
>> and
>> attachements are going as mime parts). I really appreciate any help on
>> this.
>> 
>> ===================================================
>> 
>> ------=_Part_0_18152502.1245358049140
>> Content-Type: application/xop+xml; charset=UTF-8;
>> type="application/soap+xml;
>> action=\"DocumentRepository_ProvideAndRegisterDocumentSet-b\""
>> Content-Transfer-Encoding: 8bit
>> Content-ID: <ro...@soapui.org>
>> 
>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>> xmlns:urn="urn:ihe:iti:xds-b:2007"
>> xmlns:urn1="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
>> xmlns:urn2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
>> xmlns:urn3="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
>>    <soap:Header/>
>>    <soap:Body>
>>       <urn:ProvideAndRegisterDocumentSetRequest>
>>          <urn:Document id="?"><inc:Include href="cid:965235575520"
>> xmlns:inc="http://www.w3.org/2004/08/xop/include"/></urn:Document>
>>       </urn:ProvideAndRegisterDocumentSetRequest>
>>    </soap:Body>
>> </soap:Envelope>
>> ------=_Part_0_18152502.1245358049140
>> Content-Type: text/plain; charset=us-ascii
>> Content-Transfer-Encoding: 7bit
>> Content-ID: <965235575520>
>> 
>> this is trivedi
>> ------=_Part_0_18152502.1245358049140--
>> 
>> =======================================================
>> 
>> Thanks,
>> Trivedi
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/RAW-xml-to-SOAPMessage-convertion-in-CXF-WS-endpiont-tp24099613p24112534.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: RAW xml to SOAPMessage convertion in CXF WS endpiont

Posted by Willem Jiang <wi...@gmail.com>.
CXF has some interceptors to deal with the attachment message.
Since you are using MESSAGE dataFormat, you can't get attachment message
from Message context.

Can you try the PAYLOAD dataFormat? I think you could get attachments
from the message.

Willem

trivedi kumar b wrote:
> Hi,
> 
> I have a webservice endpoint(implemented with CXF and dataFormat as
> "MESSAGE").. the endpoint receives RAW xml message always instead of POJO
> object and the input request is a MTOM message. Now I want to extract the
> SOAPBody and attachments (MTOM based) from this RAW XML. Can someone tell me
> what is the best way to achieve this? I am getting raw xml in
> exchange.getIn().getBody(), I am able to print this object and here is the
> output: (you can also observe that with MTOM enabled, the SOAP message and
> attachements are going as mime parts). I really appreciate any help on this.
> 
> ===================================================
> 
> ------=_Part_0_18152502.1245358049140
> Content-Type: application/xop+xml; charset=UTF-8;
> type="application/soap+xml;
> action=\"DocumentRepository_ProvideAndRegisterDocumentSet-b\""
> Content-Transfer-Encoding: 8bit
> Content-ID: <ro...@soapui.org>
> 
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
> xmlns:urn="urn:ihe:iti:xds-b:2007"
> xmlns:urn1="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
> xmlns:urn2="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
> xmlns:urn3="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
>    <soap:Header/>
>    <soap:Body>
>       <urn:ProvideAndRegisterDocumentSetRequest>
>          <urn:Document id="?"><inc:Include href="cid:965235575520"
> xmlns:inc="http://www.w3.org/2004/08/xop/include"/></urn:Document>
>       </urn:ProvideAndRegisterDocumentSetRequest>
>    </soap:Body>
> </soap:Envelope>
> ------=_Part_0_18152502.1245358049140
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> Content-ID: <965235575520>
> 
> this is trivedi
> ------=_Part_0_18152502.1245358049140--
> 
> =======================================================
> 
> Thanks,
> Trivedi