You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Peter Turányi <pe...@pobox.sk> on 2020/10/05 06:29:48 UTC

Re: Apache Camel Fuse soap proxy service CXF input type

 
I found that null input is caused by log activity in route. When I have removed log Transfomer bean get input message without problem.
Now I have to parse input message.
______________________________________________________________
 > Od: "Peter Turányi" <pe...@pobox.sk>
 > Komu: users@camel.apache.org
 > Dátum: 30.09.2020 14:13
 > Predmet: Apache Camel Fuse soap proxy service CXF input type
 >
I use Red Hat Fuse CodeReady Studio 12.16.0.GA. I have created soap
proxy service using CXF.
 I have defined start of route
 uri="cxf:bean:countryInfoProxyServiceClient?dataFormat=RAW"/>
 because PAYLOAD and CXF-MESSAGE data formats cause exception Message
 part {http://www.demo.com/countryinfo <http://www.demo.com/countryinfo>}VsetkyInformacieKrajiny was not
 recognized. (Does it exist in service WSDL?)
 
 I have tried get values from input body to create input for service as
 POJO (because service has data format POJO and converting output was
 very easy using java).
 method="getVsetkyInformacieKrajiny2FullCountryInfo"/>
 @Bean
   public FullCountryInfo
 getVsetkyInformacieKrajiny2FullCountryInfo(@Body VsetkyInformacieKrajiny
 proxyRequest) {
   FullCountryInfo request = new FullCountryInfo();
   request.setSCountryISOCode(proxyRequest.getKodKrajiny());
   return request; }
 But I get exception
 Caused by: org.apache.camel.InvalidPayloadException: No body available
 of type: com.demo.countryinfo.VsetkyInformacieKrajiny but has value:
 org.apache.cxf.transport.http.AbstractHTTPDestination$1@381d44a1 of
 type: null on: Message[]. Caused by: Error during type conversion from
 type: null to the required type:
 com.demo.countryinfo.VsetkyInformacieKrajiny with value
 org.apache.cxf.transport.http.AbstractHTTPDestination$1@381d44a1 due
 null.
 
 I found example where input is treated as org.w3c.dom.Document
 method="getDocument2FullCountryInfo"/>
 @Bean public FullCountryInfo getDocument2FullCountryInfo(@Body Document
 doc) {
   Node node = doc.getElementsByTagName("Kod_Krajiny").item(0);
   FullCountryInfo request = new FullCountryInfo();
   request.setSCountryISOCode(node.getTextContent());
   return request; }
 but then I get similar exception
 Caused by: org.apache.camel.InvalidPayloadException: No body available
 of type: org.w3c.dom.Document but has value:
 org.apache.cxf.transport.http.AbstractHTTPDestination$1@343ffe61 of
 type: null on: Message[].
 Caused by: Error during type conversion from type: java.lang.String to
 the required type: org.w3c.dom.Document with value [Body is instance of
 java.io.InputStream] due org.xml.sax.SAXParseException; lineNumber: 1;
 columnNumber: 1; Premature end of file..
 
 What type is input in camel context route in this case and how to parse
 it?