Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

JAX-WS RPC


JAX-WS Rpc Style example


JAX- WS RPC style web services use method name and parameters to generate XML structure.

1. Create a Web Service Endpoint Interface

JAXWSRPC.java
package com.devyan;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style=Style.RPC)
public interface JAXWSRPC{
       @WebMethod
       String getHellowWorldAsString(String name);

}


2. Create a Web Service Endpoint Implementation

JAXWSRPCImpl.java
package com.devyan;

import javax.jws.WebService;

@WebService(endpointInterface="com.devyan.JAXWSRPC")

public class JAXWSRPCImplimplements JAXWSRPC{
       @Override
       public String getHellowWorldAsString(String name)
       {
             return "Hello JAXWS RPC"+name;
       }

}



3. Create a Endpoint Publisher.

Publisher.java
package com.devyan;
import javax.xml.ws.Endpoint;

public class Publisher {

       public static void main(String[] args) {
             // TODO Auto-generated method stub
             Endpoint.publish("http://localhost:7779/ws/hello", new JAXWSRPCImpl());
       }

}

After running the publisher code, you can see the generated WSDL file by visiting the URL:



This post first appeared on Learning Help You To Achieve Your Biggest Goals, please read the originial post: here

Subscribe to Learning Help You To Achieve Your Biggest Goals

Get updates delivered right to your inbox!

Thank you for your subscription

×