You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by krzysztof <k....@gmail.com> on 2013/12/05 21:24:00 UTC

Camel CXF in payload mode - received message does not contain body element

Hi,

I have problem with camel cxf in payload mode. CxfPayload object does not
contain SOAP body element. I am using camel 2.11.0.

I have defined cxf endpoint like this - 

    <cxf:cxfEndpoint id="cxfEndpoint"
                     address="/Address"
                     wsdlURL="wsdl/WSDL.wsdl"
                     serviceClass="ServiceClass"
                     serviceName="a:ServiceName"
                     endpointName="a:EndpointName"
                     xmlns:a="https://a.org/ws"
                     loggingFeatureEnabled="true">
        <cxf:properties>
            <entry key="dataFormat" value="PAYLOAD"/>
        </cxf:properties>
    </cxf:cxfEndpoint>					 
					 
My ServiceClass is like this:

@WebServiceProvider(serviceName = "ServiceName")
@ServiceMode(Service.Mode.PAYLOAD)
public interface ServiceClass extends Provider<Source> {

    @Override
    Source invoke(Source source);
}

I have camel route with following fragment:

from("cxf:bean:cxfEndpoint").to(processor)

I am sending soap message like:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ns1:Header1 ....
        </ns1:Header1>
        <ns2:Header2 ....
        </ns2:Header2>
    </soap:Header>
    <soap:Body>
        <ns3:BodyElement ....
        </ns3:BodyElement>
    </soap:Body>
</soap:Envelope>

I have noticed that my requests are processed by various interceptors. One
of them is DocLiteralInInterceptor. It adds element from my soap
body(ns3:BodyElement) to MessageContentsList executing instruction - 

parameters.add(o);
 
Later it is set as message content.

Next interceptor is SoapHeaderInterceptor. It takes message content created
in previous interceptor(DocLiteralInInterceptor) and after some processing
adds ns1:Header1 to MessageContentList executing instruction - 

parameters.put(mpi, object);

It replaces my body element from previous interceptor with header. When my
message arrives to the processor CxfPayload object does not contain body
element.

What am I doing wrong?

Thank you



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-in-payload-mode-received-message-does-not-contain-body-element-tp5744375.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF in payload mode - received message does not contain body element

Posted by Willem Jiang <wi...@gmail.com>.
As your service class uses the Provider API, you can get the soap message body with POJO data format.
I don’t suggest you use the PAYLOAD data format this time.

-- 
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com (Chinese)
Twitter: willemjiang 
Weibo: 姜宁willem


On December 6, 2013 at 4:28:26 AM, krzysztof (k.wilaszek@gmail.com) wrote:
>
>Hi,
>
>I have problem with camel cxf in payload mode. CxfPayload object does not
>contain SOAP body element. I am using camel 2.11.0.
>
>I have defined cxf endpoint like this -
>
>>address="/Address"
>wsdlURL="wsdl/WSDL.wsdl"
>serviceClass="ServiceClass"
>serviceName="a:ServiceName"
>endpointName="a:EndpointName"
>xmlns:a="https://a.org/ws"
>loggingFeatureEnabled="true">
>
>
>
>
>
>My ServiceClass is like this:
>
>@WebServiceProvider(serviceName = "ServiceName")
>@ServiceMode(Service.Mode.PAYLOAD)
>public interface ServiceClass extends Provider {
>
>@Override
>Source invoke(Source source);
>}
>
>I have camel route with following fragment:
>
>from("cxf:bean:cxfEndpoint").to(processor)
>
>I am sending soap message like:
>
>
>>
>>
>
>
>>
>
>
>
>I have noticed that my requests are processed by various interceptors. One
>of them is DocLiteralInInterceptor. It adds element from my soap
>body(ns3:BodyElement) to MessageContentsList executing instruction -
>
>parameters.add(o);
>
>Later it is set as message content.
>
>Next interceptor is SoapHeaderInterceptor. It takes message content created
>in previous interceptor(DocLiteralInInterceptor) and after some processing
>adds ns1:Header1 to MessageContentList executing instruction -
>
>parameters.put(mpi, object);
>
>It replaces my body element from previous interceptor with header. When my
>message arrives to the processor CxfPayload object does not contain body
>element.
>
>What am I doing wrong?
>
>Thank you
>
>
>
>--
>View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-in-payload-mode-received-message-does-not-contain-body-element-tp5744375.html
>Sent from the Camel - Users mailing list archive at Nabble.com.
>