From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../src/examples/session/ws/Hello.java | 15 +++++ .../src/examples/session/ws/HelloBean.java | 18 ++++++ .../src/examples/session/ws/JAXWSClient.java | 40 ++++++++++++ .../src/examples/session/ws/META-INF/ejb-jar.xml | 5 ++ .../src/examples/session/ws/build.xml | 72 ++++++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java create mode 100644 Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java create mode 100644 Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java create mode 100644 Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml create mode 100644 Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws') diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java new file mode 100644 index 0000000..22ad6ea --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java @@ -0,0 +1,15 @@ +package examples.session.ws; + + +/** + * This is the Hello business interface. + */ + + +public interface Hello { + + public String hello(); + + public void foo(); + +} diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java new file mode 100644 index 0000000..13e6eef --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java @@ -0,0 +1,18 @@ +package examples.session.ws; + +import javax.ejb.Stateless; +import javax.jws.WebService; + +@Stateless +@WebService(serviceName="Greeter", portName="GreeterPort") +public class HelloBean { + + public String hello() { + System.out.println("hello()"); + return "Hello, World!"; + } + + public void foo() { + ; + } +} diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java new file mode 100644 index 0000000..be8401e --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java @@ -0,0 +1,40 @@ +package examples.session.ws; + +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; + +/** + * This is an example of a standalone JAX-WS client. To compile, + * it requires some XML artifacts to be generated from the service's + * WSDL. This is done in the build file. + * + * The mapped XML classes used her are + * 1. the HelloBean port type class (this is NOT the bean impl. class!) + * 2. the Greeter service class + */ +public class JAXWSClient { + + static String host = "localhost"; + static String portType = "HelloBean"; + static String serviceName = "Greeter"; + static String serviceEndpointAddress = "http://" + host + ":8080/" + serviceName; + static String nameSpace = "urn:ws.session.examples"; + + public static void main(String[] args) throws Exception { + + URL wsdlLocation = new URL(serviceEndpointAddress + "/" + portType + "?WSDL"); + QName serviceNameQ = new QName( nameSpace, serviceName); + + // dynamic service usage + Service service = Service.create(wsdlLocation, serviceNameQ); + HelloBean firstGreeterPort = service.getPort(HelloBean.class); + System.out.println("1: " + firstGreeterPort.hello()); + + // static service usage +// Greeter greeter = new Greeter(); +// HelloBean secondGreeterPort = greeter.getGreeterPort(); +// System.out.println("2: " +secondGreeterPort.hello()); + } +} diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml new file mode 100644 index 0000000..9503e74 --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml new file mode 100644 index 0000000..2d4a975 --- /dev/null +++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml @@ -0,0 +1,72 @@ + + ]> + + + + + + + + + + + + + + + + + + &include; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3