Create a web service application with axis2.. Step 1:Create a dynamic web project with project name is AddServerServer Result project and create more two class as figure below :... Then
Trang 1Web service
1 Create a web service application with axis2.
Note :Elipse must install axis2
Step 1:Create a dynamic web project with project name is AddServerServer
Result project and create more two class as figure below :
Trang 2Step 2 :New->web service
Next :
Trang 3Then click next->next ….
Do one again with Calculator.java class
Step 3:Run that project in server tomcat with links as below
Trang 4Step 4 :Create a dynamic web project have name is AddServerClient similarly as at step 1
Step 5:Create 1 web server client
Trang 5Bổ sung:
Trang 6Do similarly with link :
http://localhost:1900/AddServerServer/services/HelloWorld?wsdl
Result :In project have name is AddServerClient created automatic four class
Trang 7Step 5:create Test.java class to test.
package org.operator;
import java.rmi.RemoteException;
import org.operator.CalculatorStub.Add;
public class Test {
public static void main(String[] args) throws RemoteException{
//Print int type
CalculatorStub calculatorStub=new CalculatorStub();
Add add0=new Add();
add0.setA(10);
add0.setB(9);
System.out.println((calculatorStub.add(add0).get_return()));
//Print String type
HelloWorldStub helloWorldStub=new HelloWorldStub();
HelloWorldStub.SaidHello param=new HelloWorldStub.SaidHello(); param.setMsg("Ngô Văn Thảo");
HelloWorldStub.SaidHelloResponse response=helloWorldStub.saidHello(param);
System.out.println(response.get_return());
}
}
Trang 8Step 6:Run in Java application.
Result in console :
19
Hello world Ngô Văn Thảo
Reference :
Video (Path : F:\Study\JAVA\Java Web\Web service\Video tutorial\ Create a web service +axis2+ java + Eclipse + tomcat.FLV)