Thursday, February 14, 2008

Starting Axis2 using WSO2 Registry

If I asked to name a project which I am most like , then the obvious answer would be Apache Axis2. I like Axis2 due to a number of reason , first its flexibility second its extensibility and third a number of features it has.

In the meantime few days ago WSO2 released its registry repository product called WSO2 Registry (Yes I am also a developer of the project). However most interesting thing I wanted to do is to get Axis2 and Registry work together (there a number of ways to do that , will implement them soon) . So I got first integration working let's follow the step then we will be able to start Axis2 using WSO2 registry,

  • First download WSO2 Registry

  • Then deploy wso2registry.war into any given application server (In my case I will use Apache tomcat) and start the application server

  • Then go to http://localhost:8080/wso2registry

  • Login to system given username (admin) and password (admin)

  • Then go to add collection , there create a collection with the name “axis2-repo” , and select Media Type as “application/vnd.apache.axis2”

  • You will see it creates collection called “axis2-repo” and inside that there would be three sub collection called “services” , “modules” and “conf”

  • At the moment let's forget about modules and conf directory

  • Next download services.list and version.aar

  • Now go to directory / axis2-repo/services and upload those two files

Now let's see how we are going to start Axis2 , here we are going to start Axis2 using URL repository. So following are the codes to start Axis2,

ConfigurationContext configctx = ConfigurationContextFactory.createConfigurationContextFromURIs(

null, new URL("http://localhost:8080/wso2registry/resources/axis2-repo/"));

SimpleHTTPServer smt = new SimpleHTTPServer(configctx, 9090);

smt.start();

In the above code we are starting SimpleHTTPServer in port 9090.

Now go to http://localhost:9090/axis2/services/Version/getVersion , there we will be able to invoke the service in REST manner


Conclusion

We were able to start Axis2 with WSO2 Registry !!!

9 comments:

Charitha said...

Deepal,
I confirm that WSO2 WSAS can also be started successfully using WSO2 registry. I configured WSO2 registry as a URL repo in WSAS_HOME/conf/server.xml and uploaded all the administration modules/services to the repository configured in WSO2 registry. Then I was able to start and invoke sample service in WSAS without having any issue.
regards
Charitha

Prabath said...

Hi Deepal;

Download link in the post for services.list goes to services.xml. I guess file needs to be corrected as services.list.

Thanks & regards.
- Prabath

Deepal Jayasinghe said...

Thank you Parabth,
Now I have fixed that.

nafi said...

Hi I Deepal aiya i have a requirement of changing the repo for a remote location i tried this approach it works.
but if i am having axis2 which is working on tomcat, will i be able the change the repo of that using the same code. coz when i tried it once tomcat is up using 8080 port it doesn't change.

Nafran.

Deepal Jayasinghe said...

Hi Nafran,
For remote repo for the Tomcat please have a look at the following article

http://www.developer.com/java/ent/article.php/10933_3777111_2

nafi said...

thanks aiya i wanted to get it done using code since the repository might change
anyway i got this link
http://wso2.org/library/262
in this case i can work without tomcat i think.

thanks alot.

nafi said...

Hi deepal aiya i checked the link you gave me also but even after doing the changes in web.xml its not working do i have to do any changes in axis2.xml also ?

Nafran

Deepal Jayasinghe said...

I did the following changes and it worked fine.

<param-name>axis2.repository.url</param-name>
<param-value>http://people.apache.org/~deepal/acus07/quick-start/urlrepo/</param-value>

nafi said...

Thanks aiya i checked with your repo it works for me to think its something to do with my repo coz i only had services folder on it.

thanks a lot for the help :)

nafran