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(); } }
Jim Ma has been doing some work on this recently. Se the following thread on the Design Forum: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=137278.