Skip to content

Commit b32382d

Browse files
committed
Axis2 Hello World!
1 parent 2540ed6 commit b32382d

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import org.apache.ws.axis2.*;
2+
3+
public class Client {
4+
5+
public static void main(String[] args) throws Exception {
6+
// Create the stub object
7+
HelloServiceStub stub = new HelloServiceStub();
8+
9+
// Create the request
10+
HelloServiceStub.Add request = new HelloServiceStub.Add();
11+
12+
// Set the parameters
13+
request.setArgs0(10);
14+
request.setArgs1(20);
15+
16+
// Invoke the service
17+
HelloServiceStub.AddResponse response = stub.add(request);
18+
int ans = response.get_return(); // 10 + 20 = 30
19+
System.out.println("Response : " + ans);
20+
}
21+
22+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class HelloService {
2+
3+
/**
4+
* This method will be the add operation of the web service.
5+
*/
6+
public int add(int x, int y) {
7+
int ans = x + y;
8+
return ans;
9+
}
10+
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<service>
2+
<parameter locked="false" name="ServiceClass">HelloService</parameter>
3+
<operation name="add">
4+
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
5+
</operation>
6+
</service>

0 commit comments

Comments
 (0)