Thursday, April 17, 2008

Webserivces With Apache Axis Continued...

In continuation with my previous post,this post explores various ways of deploying a webservice using Apache Axis and how stubs can be generated with tools provided in Apache Axis.

Deploying A Webservice:
Web services can be deployed in axis in two ways
-JWS (Java Web Service) Files - Instant Deployment
-Custom Deployment - Introducing WSDD

JWS Deployment:
-Copy the *.java file into your web directory, and rename it *.jws.
-You're done!
You should now be able to access the service at the following URL (assuming your Axis web application is on port 8080):
https://localhost:8080/axis/Calculator.jws
Axis automatically locates the file, compiles the class, and converts SOAP calls correctly into Java invocations of your service class

Custom Deployment - Introducing WSDD:
Axis uses *.wsdd files to deploy Web services. This is a Axis specific format for deploying custom web services.

Steps to Deploy a Class File as Webservice:
-Create the class file.
-Write a deploy.wsdd file for that class
-Run AdminClient as follows :
java org.apache.axis.client.AdminClient -lhttps://localhost:8080/axis deploy.wsdd
-Done !
Now you'll be able to view this web service wsdl file at the path
https://localhost:8080/axis/services/MyService?wsdl

Generating Stubs For A Web Service:
-Run following command at the command prompt
java org.apache.axis.wsdl.WSDL2Java -v -p -o
Here is an exmaple
java org.apache.axis.wsdl.WSDL2Java -v -p com.punsoft.ws.client.generated

https://localhost:9080/WSAxis/services/HelloWorldEJBService?wsdl-o javasource/com/punsoft/ws/client/generated

0 comments :

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker