There is an RMI-based service provider A which I would like to expose to client B as a WebService.
To do it I create an ESB service (base on webservice_producer sample) which is using SOAPProcessor.
Here is the code (stripped for visibility):
<service category="SiusSellerService" name="WSWrapper" description="WS Frontend speaks natively to the ESB"><listeners><jbr-listener name="Http-Gateway" busidref="Http-1" is-gateway="true"/><jms-listener name="JMS-ESBListener" busidref="SiusSellerServiceEsbChannel"/></listeners><actions><action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor"><property name="jbossws-endpoint" value="ServiceProviderAWS"/></action></actions></service>
ServiceProviderAWS is a simple JWS, like the one in sample. Inside I call service A like this:
Registry registry = LocateRegistry.getRegistry(RMI_REG_HOST,RMI_REG_PORT);
RemoteRMIService service = (RemoteRMIService) registry.lookup(SERVICE_NAME);
someList = service.getSomethingMethod();
It works quite fine.
Now I have another service provider - E - it is EJB 3.0 with some methods. I would also like to expose it to client B as a WS.
I'm wondering how to do it. My idea is to create two new Actions: EJBProcessor and MyCustomAction.
Action pipeline would look like this:
MyCustomAction ----->EJBProcessor ------>SOAPProcessor
MyCustomAction would take the ESBMessage, extract what is the name of the method that WSClient B wants to call on the WS (the one backing EJB), save the name in the body of the ESBMessage - keyed for example with 'method-to-call'.
EJBProcessor would use value 'method-to-call' as a value for 'method' property. Call EJB and put returned value in ESBMessage's body as 'ret-val'.
ServiceProviderAWS would not call RMI service as in the code above but would simply do smth like that:
someList = esbMessage.getBody().get('ret-val');
And SOAP response, prepared by ServiceProviderAWS, would be at the end sent to the client B, who called the WS.
Could you tell me if this is a right way to do it?
Actually, it may seem a bit silly because I'm trying to call EJB with EJBProcessor instead of calling it within JWS methods. Isn't it?
I'm a beginner when it comes to all that SOA stuff.