Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Deploying web service with Java and Axis

Digital Innovation Partner

Deploying web service with Java and Axis

In this article we see how can we deploy a web service, you need to have apache, tomcat and axis up and running.

To publish a simple webservice:
Create a simple text file, for example “Somma.jws” like this

Put this file in the axis directory, for example: /usr/local/apache-tomcat-6.0.13/webapps/axis
the web service is already available at: http://localhost:8080/axis/Somma.jws
the WSDL: http://localhost:8080/axis/Somma.jws?wsdl
direct invocation via query string: http://localhost:8080/axis/Somma.jws?method=somma&a=2&b=3
This is a very interesting feature, you can call the web service via simple web request, for example via javascript, without the complicated stuff needed for invoking a web service .

The jws web service is simple and fast, but they support only standard type String, int and so on.

For a more complex web service you have to deploy it from the java source code, and a wsdd (Web Service Deployment Descriptor) text file:

Example:

Run (you can do it via the eclipse run dialog)
java org.apache.axis.client.AdminClient deployCompanyWS.wsdd
You have deployed your WS.
try it http://localhost:8080/axis/services/CompanyRepository?method=getCompanyData
note how the Company class is serialized through xml

to undeploy

java org.apache.axis.client.AdminClient undeploy.wsdd

To create Java Helper class to call the web service just created:
java org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/services/CompanyRepository?wsdl

Tags:

Una risposta.

  1. […] this article to test your fresh installation with some custom […]

Lascia un commento