Project Requirement Make a Netbeans Web Project.In it develop a Web Service application using the JAX-RPC concept.The Web Service should have operation for interest calculation.Overall develop a Client application for the Web Service.
Solution
Create a web project

Figuer. 1
in Figuer.2

Figuer 2

Figuer 3
Create an interface

Figuer. 4

Figuer 5
package pack1;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
/**
*
* @author roseindia
*/
@WebService
@SOAPBinding(style=SOAPBinding.Style.RPC)
public interface JAX1 {
public int interest(int amount,int time,int rate);
}

Figuer 6

Figuer. 7
package pack1;
import javax.jws.WebService;
@WebService(endpointInterface="JAX1")
public class JAXImpl implements JAX1{
public int interest(int amount, int time, int rate) {
return ((amount*time*rate)/100);
}
}

Now we can test our Web Service
Right Click on the Web Service JaxImpl
Select Test Web Service operation as shown below in Figuer. 8

Figuer 8
http://localhost:8080/Jax-RPC/JAXImplService?Tester








<%
try {
pack1.JAXImplService service = new pack1.JAXImplService();
pack1.JAX1 port = service.getJAXImplPort();
// TODO initialize WS operation arguments here
int arg0 = 2000;
int arg1 = 10;
int arg2 = 4;
// TODO process result here
int result = port.interest(arg0, arg1, arg2);
out.println("Interset is = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>


|
Recommend the tutorial |



Ask Questions? Discuss: Application Using JAX-RPC
Post your Comment