camel-cxf : How to parse in message body when dataFormat is PAYLOAD ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

camel-cxf : How to parse in message body when dataFormat is PAYLOAD ?

mta38
Hi all,

I have some question about camel-cxf component.
I use cxf component in a spring configuration file like that

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://activemq.apache.org/camel/schema/cxfEndpoint
       http://activemq.apache.org/camel/schema/cxfEndpoint/camel-cxf.xsd
       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd ">

       


                <cxf:cxfEndpoint id="endpointConsumer"
                address="http://localhost:9001/client/MyService"
                wsdlURL="wsdl/myWsdl.wsdl" endpointName="s:MyEndpoint"
                serviceName="s:GererMarchesSoapService"
                xmlns:s="urn:mynamespace/service">
               
                <cxf:properties>
                 <entry key="dataFormat" value="MESSAGE"></entry>
               
                </cxf:properties>
               
                </cxf:cxfEndpoint>


       

        <cxf:cxfEndpoint id="endpointProvider"
                serviceClass=" mynamespace.service.MyService"
                address="http://localhost:9000/services/MyService "
        wsdlURL="wsdl/myWsdl.wsdl" endpointName="s:GestionMarches"
                serviceName="s:GererMarchesSoapService"
                xmlns:s=" mynamespace/service ">
                <cxf:properties>
                         <entry key="dataFormat" value="MESSAGE"></entry>
                       
                </cxf:properties>
        </cxf:cxfEndpoint>

       

        <bean id="enrichProcessor" class="businessLogic.EnrichProcessor" />
        <camelContext id="camel-context"
                xmlns="http://activemq.apache.org/camel/schema/spring">
                <route>
                        <from uri="cxf:bean:endpointConsumer" /> 
                        <process ref="enrichProcessor" />
                        <to uri="cxf:bean:endpointProvider" />
                </route>
        </camelContext>
</beans>
 
The problem appears in my processor "enrichProcessor".
When I use "MESSAGE" as dataFormat, I can convert the body of the "IN Message" into a String object and later (after conversion as StreamSource…) parse it with an xsl stylesheet.
But, when I use "PAYLOAD" as dataFormat, this conversion (into String object) is impossible .

Is someone can explain me the difference?
Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: How to parse in message body when dataFormat is PAYLOAD ?

Willem.Jiang
Administrator
Hi,

The MESSAGE data formate will put a stream object into the in message body.
The PAYLOAD data formate will parse the stream object ,take off the soap
envelop , put into the body message with a list of elements.
If you want to turn the PAYLOAD  message  into a string object, we need to
add a converter[1] for turning the elements list into a string object.

[1] http://activemq.apache.org/camel/type-converter.html


Willem

On Fri, Oct 3, 2008 at 10:31 PM, mta38 <[hidden email]>wrote:

>
> Hi all,
>
> I have some question about camel-cxf component.
> I use cxf component in a spring configuration file like that
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>       http://activemq.apache.org/camel/schema/cxfEndpoint
>       http://activemq.apache.org/camel/schema/cxfEndpoint/camel-cxf.xsd
>       http://activemq.apache.org/camel/schema/spring
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd ">
>
>
>
> <!-- Consumer   -->
>                <cxf:cxfEndpoint id="endpointConsumer"
>                address="http://localhost:9001/client/MyService"
>                wsdlURL="wsdl/myWsdl.wsdl" endpointName="s:MyEndpoint"
>                serviceName="s:GererMarchesSoapService"
>                xmlns:s="urn:mynamespace/service">
>
>                <cxf:properties>
>                 <entry key="dataFormat" value="MESSAGE"></entry>
>                <!--<entry key="dataFormat" value="PAYLOAD"></entry>-->
>                </cxf:properties>
>
>                </cxf:cxfEndpoint>
>
>
>        <!-- Provider -->
>
>        <cxf:cxfEndpoint id="endpointProvider"
>                serviceClass=" mynamespace.service.MyService"
>                address="http://localhost:9000/services/MyService "
>        wsdlURL="wsdl/myWsdl.wsdl" endpointName="s:GestionMarches"
>                serviceName="s:GererMarchesSoapService"
>                xmlns:s=" mynamespace/service ">
>                <cxf:properties>
>                         <entry key="dataFormat" value="MESSAGE"></entry>
>                        <!--<entry key="dataFormat"
> value="PAYLOAD"></entry>-->
>                </cxf:properties>
>        </cxf:cxfEndpoint>
>
>
>
>        <bean id="enrichProcessor" class="businessLogic.EnrichProcessor" />
>        <camelContext id="camel-context"
>                xmlns="http://activemq.apache.org/camel/schema/spring">
>                <route>
>                        <from uri="cxf:bean:endpointConsumer" />
>                        <process ref="enrichProcessor" />
>                        <to uri="cxf:bean:endpointProvider" />
>                </route>
>        </camelContext>
> </beans>
>
> The problem appears in my processor "enrichProcessor".
> When I use "MESSAGE" as dataFormat, I can convert the body of the "IN
> Message" into a String object and later (after conversion as StreamSource…)
> parse it with an xsl stylesheet.
> But, when I use "PAYLOAD" as dataFormat, this conversion (into String
> object) is impossible :confused:.
>
> Is someone can explain me the difference?
> Thanks in advance.
>
> --
> View this message in context:
> http://www.nabble.com/How-to-parse-in-message-body-when-dataFormat-is-PAYLOAD---tp19798931s22882p19798931.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>