2 Replies Latest reply on Sep 27, 2009 7:47 PM by Gert Vanthienen

    Camel router does not send response back to service caller

    William Gorder Newbie

      use the following archetecture:

       

      Binding component for the webservices ->  Service Engine->Camel Router

      (hosted in fuseESB)                                                    (webservice)

       

       

      The camel router receives a message from a webservice through the normalized message router (NMR), The router does the XSLT transformation processing successfully, and we are able to read the processed xml message in the .process method, however once the process is complete we are unable to send any type of response message back the the calling service.   Can any expert provide an example on how this should be done.

       

      below is the configure() from routebuilder.java

       

      below is  also the invokecation from the calling service and the service response handler

      -


       

      public void configure() {

                from("jbi:service:http://service1.test.com/service/someRouter")      

              .convertBodyTo("javax.xml.transform.sax.SAXSource")

              .to("jbi:service:http://service1.test.com/service1/transformRequest_v1_0?mep=in-out")                    

              .to("file://c://tmp//SAMPLE_TEXT.TXT");

          }

       

       

      -


       

              public String invokeRouter(String xmlRequest)throws Exception

              {

          String response = null;

          ServiceMixClient client = createClient();

          if(client != null)

          {

              Destination destination = client.createDestination("service:http://service1.test.com/service/someRouter");

              InOut exchange = destination.createInOutExchange();

              NormalizedMessage request = exchange.getInMessage();

                      String strXML =  "" "<Person>"

                                              "";

       

               

              request.setContent(new SAXSource(new InputSource(new StringReader(xmlString))));

              client.sendSync(exchange);

              if(exchange.getError() != null)

                  throw new Exception(exchange.getError().getMessage());

              NormalizedMessage responseMsg = exchange.getOutMessage();              

       

              if(null != responseMsg)

              {

                  javax.xml.transform.Source responseContent = responseMsg.getContent();

                  response = (new SourceTransformer()).toString(responseContent);

              }

              xmlRequest = null;

          } else

          {

              response = xmlRequest;

              throw new Exception("Error invoking some Router. Could not create ServiceMixClient.");

          }

          client.close();

          return response;

      }