Home Webservices Netbeans Application Using JAX-RPC
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Application Using JAX-RPC

Advertisement
Project Requirement Make a Netbeans Web Project.In it develop a Web Service application using the JAX-RPC concept.

Application Using JAX-RPC

 

   

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

  • Develop web project
  • In it create an interface using JAX-RPC
  • Create a web service to implement above interface
  • Build the project.
  • Deploy the project.
  • Test the web service.
  • Develop a Web Client

Create a web project

  • Take a new Project
  • Select Web Application as given below in Figuer1.

Application Using JAX-RPC

  Figuer. 1

  • Give the name of the Project as Jax-RPC as shown in given below

   in Figuer.2 

  • Click on Next

Application Using JAX-RPC

     Figuer 2

  • Select the Server name as GlassFish
  • Click on Next button. As shown below in Figuer 3.
  • Click on Finish  Button .

Application Using JAX-RPC

   Figuer 3
Create an interface

  • Make a Jax-RPC  interface 
  • Right Click on the Project.
  • Select java->java interface
  • Click on the next as shown in Figuer 4 given below

Application Using JAX-RPC

Figuer. 4

  • In the given wizard give the name of the interface
  • Type JAX1 in class name.
  • Click on the Next Button as shown in Figuer 5 given below

Application Using JAX-RPC
   
     Figuer 5

  • Click on the Finish Button as shown in Figuer 5
  • It generates a interface named JAX1
  • Add an operation name interest in it.
  • Also add @WebService  and @SOAPBinding annotation

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);
}

  • After Creating Inteface now make a web service program
  • Right Click and select NewàWeb Service as given below in Figuer 6

Application Using JAX-RPC

    Figuer 6

  • Give the name of the Web Sevice as  JAXImpl
  • Give the package name as pack1
  • Click on The Next button as shown in Figuer 7 below

Application Using JAX-RPC
      
     Figuer. 7

  • Click on Finish
  • It will generates the Web Service in design view
  • Click on the source view
  • In it  implements the interface JAX1 as shown below

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 build the project
  • After building, deploy it on the server as shown below in Figuer 8.

Application Using JAX-RPC

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

Application Using JAX-RPC

     Figuer 8

  • It will open the browser with the url

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

  • Give the values in three text boxes for amount, rate and time respectively
  • Click  on  interest Button as shown in below in Figuer 9.

Application Using JAX-RPC

 

Application Using JAX-RPC

 

Application Using JAX-RPC

Application Using JAX-RPC

Application Using JAX-RPC

Application Using JAX-RPC

Application Using JAX-RPC

Application Using JAX-RPC

<%
  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
  }
  %>
Application Using JAX-RPC

Application Using JAX-RPC

Download Code

   

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 22, 2009

Ask Questions?    Discuss: Application Using JAX-RPC  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
abcd
October 3, 2011
hello...

good
abdelatif
May 15, 2013
Systeme information

web service and P2P
esra
April 1, 2013
JAX-RPC

I applied all steps that you declared in the article. But My application didn't work. It gives error WS00024: class {0} referenced from annotation symbol cannot be loaded. How can I correct it ? "INFO: WS10010: Web service endpoint deployment events listener registered successfully. SEVERE: WS00024: class {0} referenced from annotation symbol cannot be loaded symbol: javax.jws.WebService location: class pack1.JAXImpl SEVERE: Annotations processing failed for file:/C:/Users/esranur.galip/Documents/NetBeansProjects/Jax-RPC/build/web/ INFO: WEB0671: Loading application [Jax-RPC] at [/Jax-RPC] INFO: Jax-RPC was successfully deployed in 1.155 milliseconds. "
DMCA.com