[jboss-dev-forums] [Design of JBoss ESB] - Publish ESB services to web services

Jim Ma do-not-reply at jboss.com
Tue Apr 22 03:17:21 EDT 2008


Can we take the following  steps to publish the ESB services to web sevices?

1. generate the wsdl contract for the given jboss-esb.xml when do initialization for 
    the esb service :
  <service category="ServiceESB" name="helloworld" description="Hello World">
  |        <actions mep="OneWay" input="serviceInput.xsd" output="serviceOutput.xsd" fault1="fault1.xsd">
  |                    <action name="action1" 
  |                    	class="org.jboss.soa.esb.actions.Action1" 
  |                    	process="displayMessage"/>      
  |                     <action name="action2" class="org.jboss.soa.esb.actions.Action2" process="invokeCount"/>
  |         </actions>
  |    </service>
   For the first stage, the input/output and fault xsd need to be provided, the  next stage , we can consider if we can generate these files by reflecting or analyzing the message. 

2. generate the web service implementation class used to publish web service.(to invoke the standard jaxws api 
Endpoint.publish(implementor) ). The generated web service implementation class for the above ESB service can be this :
    
@WebServiceProvider(portName = "SoapPortInGeneratedWSDL", serviceName = "serviceNameInGeneratedWSDL",
  |                       targetNamespace = "http://www.jboss.org/esb/service",
  |                       wsdlLocation = "wsdl/helloworld.wsdl")
  | @ServiceMode(value = Service.Mode.MESSAGE)
  | public class HelloWorldService implements Provider<SOAPMessage> {
  | 
  |     public HelloWorldService() {
  |         //Complete
  |     }
  | 
  |     public SOAPMessage invoke(SOAPMessage request) {
  |         // Compose the SOAPMessage to ESB awared message 
  |         Message message = MessageComposer.compose(request);
  |         //Get the action class name and process method from the esb service configuration 
  |         message = Action1.displayMessage(message);
  |         message = Action2.invokeCount(message);        
  |         SOAPMessage  response = MessageComposer.decompose(message);
  |         return response;
  |     }
  | }
     
I think using JAX-WS dispatch and provider style to publish a web service is the simple way to do that . 
Because we do not need to generate the types class and can easily line up the actions classes.   

3.  invoke the jboss-ws api to publish the web service with generated implementation class  when the 
    ESB service start up.

I do not investigate the ESB code base deeply and have two questions for Step 2:

a . Can each  response message  be easily transformed  to a javax.xml.SOAPMessage when we have the output xsd file ?

b.  How can we compose the  ActionProcessingException to soap message when we have fault xsd file?  Take ActionProcessingException as a exception bean to marshal and unmarshall fault message?

Any thoughts, comments and answer would be appreciated.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145699#4145699

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145699



More information about the jboss-dev-forums mailing list