Thursday, 9 December 2010

What to do to expose EBS services as a Webservice

I got a comment (in Dutch) on my article about the EBS Adapter.
Since giving short answers on simple questions is not my strengths, I'll answer with a blogpost.

In the article you can make up that I'm not too enthusiastic about the EBS Adapter. The reality is often more nuanced than stated, you should consider the EBS adapter specific for your own situation.

Two of the main reasons to use the EBS Adapter are:
  • It sets the application context for you at connecting to the EBS instance
  • The Adapter Wizard enables you to introspect the available interfaces.
If these reasons are not applicable for you since for instance you set the Application Context yourself for whatever reason and/or you use customer pl/sql procedures, then might be too little to ratify the use.

But what would I do if I need to expose a pl/sql as a webservice from EBS?

EBS 11.5.10 indeed just works with JServe. From 12 onwards OC4J is used, at least initially in the 10.1.2 version (don't know if later relases are on 10.1.3).
So to start with, I'd use at least a managed OC4J 10.1.3.x Application server. Either single node or clustered. So not a standalone oc4j.  

Then it depends mainly if you can use SoaSuite. If you can use SoaSuite I would create a BPEL Process, an Oracle ESB or (in case of SoaSuite11g) OSB service, based on the SoaSuite database adapter. Then arrange for setting the application context in the implementation block of the package where you have put the pl/sql procedure in.

If you can't use SoaSuite you could generate a webservice from JDeveloper based on the pl/sql procedure. And deploy that as a WAR or EAR file to the application server. The main disadvantage of having JDeveloper generate the webservice is that you can't influence the way the generated code calls the pl/sql procedure. So I think I would create a standalone java application that uses JNDI for getting the jdbc-connection. Then code the call of the pl/sql procedure in the java-application. Test it stand-alone. If that works then create webservice on that application. Doing so you have separated the technical code that does the job (calling the pl/sql procedure) and the actual webservice. For an example on how to use JNDI in standalone applications that also have to run on an AS see this article.

For creating the webservice it self you also have two choices:
  • Let JDeveloper generated the code for you. But then JDeveloper generates the wsdl and you have very little (near to nothing) influence on how it looks like. Unless you generate the webservice based on the wsdl.
  • Use a soap stack that supports annotations (like Sun Glassfish Metro). Using annotations you have very large influence on how the generated wsdl looks like. See for instance this article. Only in that case the wsdl will be generated at startup of the webservice application in the application server.

So my preferred way to go is either use SoaSuite/OSB or create a annotation based webservice on a standalone java-app that calls my procedure.


Reuben said...

Hey Martien,

just realised i never updated you on how this worked out. In the end we did make the webservice with jDeveloper based on pl/sql and it is now running on a standalone application server. For 11i this is definitely the best way to go. Am still waiting for a customer with R12 and a desire for webservices so we can try the built in OC4J ;-)

many thanks,

Martien van den Akker said...

Hi Rueben,

Thanks for the feedback. For R12 (>12.1.3) you surely should take a look into the SOAGateway. With that you can expose EBS services (native as well as custom) as a webservice in a declarative way.

I provided a workshop on this earlier this year. We could organize it again.


Anonymous said...

Thank you for the post. I am exploring an option of implementing synchronous web service on oc4j (oracle apps server 10g). How to I create integrate with the database without DB adapter.I have created BPEL processes but the idea of directly deploying service on OC4j is new to me. If possible could you please point me to a tutorial.

thanks, rimi_1

Martien van den Akker|Darwin-IT said...

Hi Rimi,

I don't have a howto. But it comes together on creating a db-connection. Browse to the pl/sql procedure in JDeveloper, right click and choose generate webservice on it. Or do something like it via the New-gallery. Unfortunately I don't have a 10g installation at hand anymore. So you might do some investigation. But the tool helps you with it al the way.


Martien van den Akker|Darwin-IT said...

Oh, but I would not recommend it if you have SOASuite available. I can't imagine that using a java-webservice is significantly faster then the database adapter. But using the database adapter and bpel is much easier to configure and it provides you with better error-handling and means of maintenance.