Você está na página 1de 6

Web Services Documentation

Basic requirements axis-ant.jar and axis.jar libraries should present in Java Build Path of project. Follow below steps to create your own web-service Step 1: Create an inteface, declarin all the methods which you want to e!pose to the outside side world.
package com.test.RXML; import java.rmi.Remote; import java.rmi.RemoteException; public interface TestWebService exten s Remote! public String m"TestMet#o $String in%& t#ro's RemoteException; (

"n this case my#est$ethod%&trin in'( is the method which we need to implement at client end. Step 2: )enerate *&+, File For the )iven "nterface. %Java-*&+,( a. Run . Debug Configuration b. &elect Java App ication in left panel.

c. "n $ain tab on ri ht panel select org.apac!e.axis."s# .Java2WSD$ in the $ain Class. %use search button to search the pac/a e( %refer above screen shot(

d. &elect Argument tab and copy below command with respective ar uments. -o src0com0test012$,0#est*eb&ervice.wsdl %+estination file( -l 3http400localhost45'5'0a!is0services0#est*eb&ervice3%61, where web-service will be deploy( -n urn4#est*eb&ervice -p3#est*eb&ervice3 #est*eb&ervice com.test.12$,.#est*eb&ervice %path of interface class( %refer above screen shot( &elect App %. #hen Run. "t will enerate &estWebService."s# in src'com'test'R()$' path.

Step *: )enerate stub for client side access. %i.e. client side wrapper 7 *&+,-Java(

a. Perform a 8 b same as step -. Just select org.apac!e.axis."s# .WSD$2Java in the $ain Class. %refer above screen shot(

b. &elect Argument tab and copy below command with respective ar uments. -o . -d &ession -s -p src0com0test012$,0+eploy0 %destination path( home0yo 09:;wor/space09:0src0com0test012$,0#est*eb&ervice.wsdl %*&+, source path( %refer above screen shot( &elect App %. #hen Run. "t will enerate below files on src'com'test'R()$'Dep o%' path. #est*eb&ervice;Port#ype.java #est*eb&ervice&ervice.java #est*eb&ervice&ervice,ocator.java #est*eb&ervice&oapBindin "mpl.java #est*eb&ervice&oapBindin &tub.java deploy.wsdd undeploy.wsdd

Step +:

+eploy the &ervice to <pache <!is =ow we are ready to deploy this service. *e have to do the followin 4 a. Compile the &ervice Code we et in step >. b. #ransfer the compiled code in the a!is folder path4- ja,arta-tomcat-+.-.2.'"ebapps'axis'W/0-123'c asses' c. +eploy the *eb &ervice usin the *&++ +eployment +escriptor. Copy content from #ep o%."s## file in server-config."s## file just above 4transport name56!ttp67 ta in tomcat. path4- ja,arta-tomcat-+.-.2.'"ebapps'axis'W/0-123'server-config."s## Content of #ep o%."s##?service name@3#est*eb&ervice3 provider@3java41PC3 style@3rpc3 use@3encoded3A ?parameter name@3wsdl#ar et=amespace3 value@3urn4#est*eb&ervice30A ?parameter name@3wsdl&ervice9lement3 value@3#est*eb&ervice&ervice30A ?parameter name@3wsdl&ervicePort3 value@3#est*eb&ervice30A ?parameter name@3class=ame3 value@3com.test.12$,.+eploy.#est*eb&ervice&oapBindin "mpl30A ?parameter name@3wsdlPort#ype3 value@3#est*eb&ervice30A ?parameter name@3type$appin Bersion3 value@3C.-30A ?operation name@3my#est$ethod3 qname@3oper=&4my#est$ethod3 !mlns4oper=&@3urn4#est*eb&ervice3 returnD=ame@3my#est$ethod1eturn3 return#ype@3rtns4strin 3 !mlns4rtns@3http400schemas.!mlsoap.or 0soap0encodin 03 soap<ction@33 A ?parameter qname@3in'3 type@3tns4strin 3 !mlns4tns@3http400schemas.!mlsoap.or 0soap0encodin 030A ?0operationA ?parameter name@3allowed$ethods3 value@3my#est$ethod30A ?parameter name@3scope3 value@3&ession30A ?0serviceA

d. =ow start tomcat server. 6se below 61, to chec/ your service. http400localhost45'5'0a!is0 Clic/ on view lin/ and chec/ your test service methods. &ame as below.