Tải bản đầy đủ (.doc) (10 trang)

Web Service tutorials

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.26 MB, 10 trang )

Web 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 :
Step 2 :New->web service
Next :
Then click next->next ….
Do one again with Calculator.java class.
Step 3:Run that project in server tomcat with links as below.
Step 4 :Create a dynamic web project have name is AddServerClient similarly as at
step 1.
Step 5:Create 1 web server client.
Bổ sung:
Do similarly with link :
http://localhost:1900/AddServerServer/services/HelloWorld?wsdl
Result :In project have name is AddServerClient created automatic four class .
Step 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());
}
}
Step 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)


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×