0 Replies Latest reply on Mar 24, 2017 4:29 AM by Raymond de Hond

    Part {http://javainuse.com}out should be of type com.javainuse.OutputSOATest, not javax.xml.transform.stream.StreamSource

    Raymond de Hond Newbie

      Hi,

       

      I created the CamelRoute below. The problem is that I always get an error at the end of the process. All steps seem to work fine, but the last step fails and I get a soapfault in soapui saying:

       

      Part {http://javainuse.com}out should be of type com.javainuse.OutputSOATest, not javax.xml.transform.stream.StreamSource

       

      I really don't get it (as a newbie). When I debug the route I see that I return an instance of com.javainuse.OutputSOATest.

      I tried so many things, all kinds of convertBodyTo's, created a MessageContentList instance as a return type in the last step, used a processor in the last step. etc..so far no luck :-(

      I have no clue where the javax.xml.transform.stream.StreamSource is coming from...any ideas how to solve this?

       

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

       

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

          xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="              http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd              http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

          <cxf:cxfEndpoint address="/javainuse/test"

              endpointName="a:SOATestEndpoint" id="CXFTest"

              serviceClass="com.javainuse.SOATestEndpoint"

              serviceName="a:SOATestEndpointService" wsdlURL="wsdl/test.wsdl" xmlns:a="http://javainuse.com">

          </cxf:cxfEndpoint>

          <cxf:cxfEndpoint address="http://127.0.0.1:8088/mockCalculatorSoap"

              endpointName="s:CalculatorSoap" id="Calc"

              serviceClass="org.tempuri.CalculatorSoap"

              serviceName="s:Calculator" wsdlURL="wsdl/calc.wsdl" xmlns:s="http://tempuri.org/">

              <cxf:properties>

                  <entry key="dataFormat" value="PAYLOAD"/>

              </cxf:properties>

          </cxf:cxfEndpoint>

          <bean class="com.javainuse.beans.CamelProcessor" id="processor"/>

          <bean class="com.javainuse.beans.TransformBeanToAdd" id="TransformBeanToAdd"/>

          <bean class="com.javainuse.beans.TransformBeanToSoaTestResponse" id="TransformBeanToSoaTestResponse"/>

       

          <bean

              class="org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy" id="dropAllMessageHeadersStrategy">

              <!-- Set relayHeaders to false to drop all SOAP headers -->

              <property name="relayHeaders" value="false"/>

          </bean>

       

          <camelContext id="camelId" trace="true" xmlns="http://camel.apache.org/schema/blueprint">

              <route id="bookTicket">

               

                  <from id="_from1" uri="cxf:bean:CXFTest?loggingFeatureEnabled=true&amp;headerFilterStrategy=#dropAllMessageHeadersStrategy"/>

                  <setHeader headerName="operationName" id="_setHeader1">

                      <constant>Add</constant>

                  </setHeader>

                  <setHeader headerName="operationNamespace" id="_setHeader2">

                      <constant>http://tempuri.org/</constant>

                  </setHeader>

                  <bean id="TransformBeanToSoaTestResponse" ref="TransformBeanToSoaTestResponse"/>

                  <convertBodyTo id="_convertBodyTo1" type="org.tempuri.Add"/>

                  <to id="_to1" uri="cxf:bean:Calc?loggingFeatureEnabled=true&amp;exchangePattern=InOut&amp;dataFormat=PAYLOAD"/>

                  <convertBodyTo id="_convertBodyTo2" type="org.tempuri.AddResponse"/>

                  <bean id="TransformBeanToAdd" ref="TransformBeanToAdd"/>

              </route>

          </camelContext>

      </blueprint>

       

      java pojos:

       

      === POJO  TransformBeanToSoaTestResponse ===

       

      package com.javainuse.beans;

       

      import com.javainuse.InputSOATest;

      import org.tempuri.Add;

       

      public class TransformBeanToSoaTestResponse {

       

        public org.tempuri.Add map(InputSOATest inputSOATest) {

       

        Add add = new Add();

        add.setIntA(2);

        add.setIntB(3);

       

        return add;

          }

       

      }

       

      ==== POJO TransformBeanToAdd ===

       

       

      package com.javainuse.beans;

       

      import org.tempuri.AddResponse;

      import com.javainuse.OutputSOATest;

       

      public class TransformBeanToAdd {

       

        public OutputSOATest map(AddResponse addResponse) {

       

        OutputSOATest out = new OutputSOATest();

       

        String ff = Integer.toString(addResponse.getAddResult());

        out.setResult(ff);

       

        return out;

       

          }

       

      }