Monday, August 18, 2008

Exposing OSGi service as a Web service using Apache Axis2

As part of Axis2/OSGi integration process, we have implemented the basic facility to expose an OSGi service as a Web service. Still some of the advanced functionalities related to this function is in development stage and we will update the progress as we go alone.

In order to facilitate this, register OSGi service with Directory object with name/value pair "org.apache.axis2.osgi.ws/name of WS". This will create an AxisService with default Axis2 properties. This includes message receivers to be RPC*, default schema/targetNamespace generation etc.

You can test this out from here. Follow "axis2_osgi_integration.pdf" to set up the environment.

The example has registered a simple Calculator POJO as an OSGi service and exposed it as a WS. The name/value pair for this instance is "org.apache.axis2.osgi.ws/myCal". Then one will be able to observe

wsdl -> http://localhost:8080/services/myCal?wsdl
wsdl2 -> http://localhost:8080/services/myCal?wsdl2
A request -> http://localhost:8080/services/myCal/add?x=10&y=10

5 comments:

Fatal said...

hi saminda,
i followed your instructions, but i miss the javax.servlet package. all other packages were generated without any problem, but javax.servlet isn't there and the pom.xml entry for it is missing, too.

Santiago Miguel Aranda Rojas said...

I am following your axis2_osgi_integration.pdf but I have had some doubts or problems. I have twenty eight bundles running correctly. But the last one "29 org.apache.axis2.osgi_1.0.0.SNAPSHOT" is not working because the import javax.jms can not be found or resolved. Do I need more bundles? What bundle have to export this package?
Thanks in advance

Rajesh Girish said...

Hi Saminda,

I followed your document in the Apache SVN ,I'm getting into problem finally after long hours of resolving bundles and packages.I tried adapting to the document thrice freshly but there is no success.. .I alway stuck into this problem or error which i could not solve.I request you to please please shed some light on this .. so that i can i get out of this problem ....

Rajesh Girish said...

Here is my Stacktrace... Please give me some solution or i will go mad as this is very urgent

org.osgi.framework.BundleException: Exception in org.apache.axis2.osgi.internal.Activator.start() of bundle org.apache.axis2.osgi.
Nested Exception:
java.lang.ClassNotFoundException: com.bea.xml.stream.MXParserFactory
at java.lang.ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:124)
at java.lang.ClassLoader.loadClass(Unknown Source)
at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:68)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)

Rajesh Girish said...

Hi Saminda

Axiom Bundles are not properly packaged so i'm facing problems.

Can you give me stable build Bundles of axiom which i can install...