Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Application Using JAX-RPC 
 

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

                     

» View all related tutorials
Related Tags: c gui web ide netbeans ui service help services vi deploy id tool developer oo beans to developers bean e

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.