You are on page 1of 2

EXPERIMENT NO-7

AIM: Write a program to implement Windows application-based web service

Task To Be Done:
In this practical we have to create windows application to add two numbers given by user but for
this Windows Application will be create using JavaFrame. Finally result will get displayed to
user. But before that we need to do two task first create web service and next create client
service. The code for GUI will be written inside client service and operation code is implemented
inside web service.

CODE:
Client Service
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {

int num1=Integer.parseInt(a.getText());
int num2=Integer.parseInt(b.getText());
int res = num1+num2;

c.setText(""+add(num1,num2));
}

Web Service
package com.add;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "AddClass")
public class AddClass {
@WebMethod(operationName = "ADD")
public int hello(@WebParam(name = "a") int a,@WebParam(name="b") int b) {
return a+b;
}
}

OUTPUT:

Learning Outcome:
1. To build desktop application using JFrame
2. Linking web service to client service

You might also like