websevice jax-ws-rpc style:
-----------------------------------
NOTE: 1) maven dependeccy pom.xml , we can get from previous example.
SayHaiService .java
--------------
package madhav;
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 SayHaiService {
@WebMethod
public String sayHai(String hai);
}
SayHaiServiceImpl .java
---------------
package madhav;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(endpointInterface = "madhav.SayHaiService")
public class SayHaiServiceImpl implements SayHaiService{
@Override
@WebMethod
public String sayHai(String hai) {
return hai;
}
}
Publish .java
--------------
package madhav;
import javax.xml.ws.Endpoint;
public class Publish {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8080/webservice-JAX-WS-RPC/sayhai", new SayHaiServiceImpl());
System.out.println("say hai service is published");
}
}
import javax.xml.ws.Endpoint;
public class Publish {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8080/webservice-JAX-WS-RPC/sayhai", new SayHaiServiceImpl());
System.out.println("say hai service is published");
}
}
---------------
package madhav;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class Client {
public static void main(String[] args) {
URL url = null;
try {
url = new URL("http://localhost:8080/webservice-JAX-WS-RPC/sayhai?wsdl");
} catch (MalformedURLException e) {
e.printStackTrace();
}
QName qname = new QName("http://madhav/",
"SayHaiServiceImplService");
Service service = Service.create(url, qname);
SayHaiService sayHaiService = service.getPort(SayHaiService.class);
System.out.println(sayHaiService.sayHai("hai how r u"));
}
}
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class Client {
public static void main(String[] args) {
URL url = null;
try {
url = new URL("http://localhost:8080/webservice-JAX-WS-RPC/sayhai?wsdl");
} catch (MalformedURLException e) {
e.printStackTrace();
}
QName qname = new QName("http://madhav/",
"SayHaiServiceImplService");
Service service = Service.create(url, qname);
SayHaiService sayHaiService = service.getPort(SayHaiService.class);
System.out.println(sayHaiService.sayHai("hai how r u"));
}
}
Related topics:
6. spring data jpa onetoone
Related topics:
6. spring data jpa onetoone
6. spring data jpa onetoone
TUTIORALS FROM MADHAV:
No comments:
Post a Comment