Steps for creating a WS with AXIS
1. Create the interface for your application.
2. Create the Impl of your Intf.
3. Compile Intf and Impl
4. Java2WSDL : Generate WSDL for the given Interface
- Name of output WSDL (
mailSender.wsdl) - URL of the Web service (http://localhost:8080/axis/services/mailSender)
- Target namespace for the WSDL (
urn:mailSender) - Map Java package = namespace (mailSender
= urn:mailSender) - Fully qualified class itself (
com.usta.mail.MailSender)
The full command for our example becomes something like:
% java org.apache.axis.wsdl.Java2WSDL -o mailSender.w
sdl -l"http://localhost:8080/axis/services/mailSender" -n urn:mailSender -p"mail
Sender" urn:mailSender com.usta.mail.MailSender
mailSender.wsdl is generated after the execution
- Base output directory (.)
- Scope of deployment (Application, Request, or Session)
- Turn on server-side generation (we wouldn't do this if we were accessing an external Web service, as we would then just need the client stub)
- Package to place code (com.usta.mail.ws
) - Name of WSDL file (
mailSender.wsdl)
The full command for our example becomes something like:
% java org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -p com.usta.mail.ws mailSender.wsdl
After running this program, following codes have been generated in the fibonacci\ws directory:
MailSenderSoapBindingImpl.java: This is the implementation code for our Web service. This is the one file we will need to edit, tying it to our existingFibonacciImpl.MailSender.java: This is a remote interface to the Fibonacci system (extendsRemote, and methods from the originalFibonacci.javathrowRemoteExceptions).MailSenderService.java: Service interface of the Web services. TheServiceLocatorimplements this interface.MailSenderServiceLocator.java: Helper factory for retrieving a handle to the service.MailSenderSoapBindingSkeleton.java: Server-side skeleton code.MailSenderSoapBindingStub.java: Client-side stub code that encapsulates client access.deploy.wsdd: Deployment descriptor that we pass to the Axis system to deploy these Web services.undeploy.wsdd: Deployment descriptor that will undeploy the Web services from the Axis system.
SMailSenderSoapBindingImpl : Fill in wrapper to call the existing code7. Deploy the service to Apache Axis
Compile ws java files
package ws, and app classes :
jar cvf mailer.jar com/usta/mail/*.class com/usta/mail/ws/*.classCopy jar file under TOMCAT_HOME/webapps/axis/WEB-INF/lib
Deploy the web service
: java org.apache.axis.client.AdminClient deploy.wsdd
8. Write a client that uses the generated stubs to easily access the web service
In the code get access to the service via the ServiceLocator, and then call methods on the remote handle that we have in order to use the service.ref. http://www.onjava.com/pub/a/onjava/2002/06/05/axis.html?page=2


0 Comments:
Post a Comment
<< Home