For a consumer endpoint in Payload mode, you only want the message payload
(ie: body) without the SOAP stuff:

String soap = "<compute
xmlns=\"urn:microsoft-dynamics-schemas/page/calculator\"><No>8545</No></compute>";


mabahma wrote
> Hello everyBody
> I'm struggling to make the folowing code to work..
> 
> ********************
> 
> CamelContext context = new DefaultCamelContext();
>               context.addRoutes(new RouteBuilder() {
>                           public void configure() throws Exception {
> 
>           from("direct:test")
>                            
>        .setHeader("operationNamespace",
> constant("urn:microsoft-dynamics-schemas/page/calculator"))
>        .setHeader("operationName", constant("compute"))
>       .setHeader("SOAPAction",
> constant("urn:microsoft-dynamics-schemas/page/calculator:compute"))
>                       
>   .
> to("cxf://http://localhost:9080/WS/calculator?wsdlURL=classpath:test.wsdl&;
> dataFormat=PAYLOAD")
>                               
>                            
>                            }
>                       });
>                      
>                       context.start();
>                      
>      String soap = "
> <soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>
> <soap:Body>
> <compute xmlns=\"urn:microsoft-dynamics-schemas/page/calculator\">
> <No>
> 8545
> </No>
> </compute>
> </soap:Body>
> </soap:Envelope>
> ";       
>                                
>                       Endpoint endpoint = context.getEndpoint("direct:test");
>                       Exchange exchange = endpoint.createExchange();
>                       ProducerTemplate template =
> exchange.getContext().createProducerTemplate();
>                       
>                    // send to default endpoint
>                    template.sendBody(endpoint,soap);
> 
> 
> ********************
> 
> 
> I have the following error : 
> 
> 
> java.lang.IllegalArgumentException: The PayLoad elements cannot fit with
> the message parts of the BindingOperation. Please check the
> BindingOperation and PayLoadMessage.
>       at
> org.apache.camel.component.cxf.CxfEndpoint$CamelCxfClientImpl.setParameters(CxfEndpoint.java:1172)
>       at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:470)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:416)
> 
> 
> 
> the same soap request works perfectly with SOAPUI and when i change
> PAYLOAD to MESSAGE.
> 
> any examples on how to send soap requests to cxf producer in PAYLOAD mode
> are welcome..i could not find any on the net
> 
> Kind regards..





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-CXF-Payload-mode-tp5783530p5783540.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to