Hi All,
I am trying to create the following flow in camel: queue->web
serevice->queue

The problem is that messages does not reach webservice (that is deployed on
jetty using cxf). They only reach first processor(see below).

When I just make
from("cxf:bean:routerEndpoint").to("cxf:bean:serviceEndpoint") everything
works fine. Also routing directly from one queue to another also works fine.

Please check my route, config and message below.

Route:

from("activemq:vasea")
.process(new Processor() {

                       public void process(Exchange ex) throws Exception {

System.out.println(">>>>>>"+ex.getIn().getBody(String.class));
                               JAXBContext ctx =
JAXBContext.newInstance(new Class[]
{InputReportIncident.class});
                       Unmarshaller um = ctx.createUnmarshaller();
                       InputReportIncident report = (InputReportIncident)
um.unmarshal(new StringReader(ex.getIn().getBody(String.class)));

                       ArrayList<InputReportIncident> list = new
ArrayList<InputReportIncident>();
                       list.add(report);
                       ex.getIn().setBody(list);

ex.getIn().setHeader(CxfConstants.OPERATION_NAME, "ReportIncident");

                       }
               })
.to("cxf:bean:serviceEndpoint")
.process(new Processor() {

                       public void process(Exchange ex) throws Exception {

System.out.println(">>>AFTER>>>"+ex.getIn().getBody());

//ex.getIn().setBody(ex.getIn().getBody(String.class));
                               JAXBContext ctx =
JAXBContext.newInstance(new Class[]
{OutputReportIncident.class});
                       Marshaller um = ctx.createMarshaller();
                       StringWriter writer = new StringWriter();
                       um.marshal(((List)ex.getIn().getBody()).get(0), writer);

                       ex.getIn().setBody(writer.toString());

                       }
               })
.to("activemq:petea");

Message(as submited to jms):

<ns2:inputReportIncident
       xmlns:ns2="http://reportincident.sandbox.xxx.com";>
       <incidentId>?</incidentId>
       <incidentDate>?</incidentDate>
       <givenName>?</givenName>
       <familyName>?</familyName>
       <summary>?</summary>
       <details>?</details>
       ?
       <phone>?</phone>
</ns2:inputReportIncident>

camel-context.xml:
       <camelContext xmlns="http://activemq.apache.org/camel/schema/spring";>
               <package>com.xxx.sandbox</package>
       </camelContext>

      <cxf:cxfEndpoint id="routerEndpoint"
               
address="http://localhost:8081/integration-ws/webservices/incident";
               
serviceClass="com.xxx.sandbox.reportincident.ReportIncidentEndpoint"
/>
       <cxf:cxfEndpoint id="serviceEndpoint"
               
wsdlURL="http://localhost:8080/integration-ws/webservices/incident?wsdl";
               
serviceClass="com.xxx.sandbox.reportincident.ReportIncidentEndpoint"
               endpointName="s:ReportIncedentEndpointImplPort"
serviceName="s:ReportIncedentEndpointImplService"
               xmlns:s="http://service.sandbox.xxx.com/";>
       </cxf:cxfEndpoint>

       <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
               <property name="connectionFactory">
                       <bean
class="org.apache.activemq.ActiveMQConnectionFactory">
                               <property name="brokerURL"
value="tcp://localhost:61616" />
                       </bean>
               </property>
       </bean>

Reply via email to