1 Reply Latest reply on Jun 19, 2008 6:47 AM by Tom Fennelly

    question about publishing esb service to web service

    Dong Jinli Newbie

      Hello,

      I want to know if there is a proper way to publish esb service to web service.
      The following code can do some of the work, but I don't know if it is the best way.

      @WebService(name = "InvokeESB", targetNamespace = "http://testESB/invokeESB")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class InvokeESB {
       @WebMethod
       public String invoke(String ServiceCategory,String ServiceName,String XMLInput) {
       try {
       ServiceInvoker deliveryAdapter;
       Message reqMessage;
       Message resMessage = null;
      
       deliveryAdapter = new org.jboss.soa.esb.client.ServiceInvoker(ServiceCategory, ServiceName);
       reqMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
       reqMessage.getBody().add(XMLInput);
       resMessage = deliveryAdapter.deliverSync(reqMessage, 20000);
       } catch (Exception e) {
       System.out.println(e + "\n");
       e.printStackTrace(System.out);
       }
       return resMessage.getBody().get();
       }
      }
      

      Any suggestion is appreciated.

      Thanks. djl.