forked from matijaklj/kumuluzee-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
451 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# KumuluzEE JAX-RS sample | ||
|
||
> JAX-WS usage sample with KumuluzEE | ||
This sample demonstrates how to configure and use Java EE JAX-WS technologies using KumuluzEE. | ||
|
||
## Requirements | ||
|
||
In order to run this example you will need the following: | ||
|
||
1. Java 8 (or newer), you can use any implementation: | ||
* If you have installed Java, you can check the version by typing the following in a command line: | ||
|
||
``` | ||
java -version | ||
``` | ||
2. Maven 3.2.1 (or newer): | ||
* If you have installed Maven, you can check the version by typing the following in a command line: | ||
``` | ||
mvn -version | ||
``` | ||
3. Git: | ||
* If you have installed Git, you can check the version by typing the following in a command line: | ||
``` | ||
git --version | ||
``` | ||
## Prerequisites | ||
This sample does not contain any prerequisites and can be started on its own. | ||
## Usage | ||
The example uses docker to build and run the microservices. | ||
1. Build the sample using maven: | ||
```bash | ||
$ cd jax-ws | ||
$ mvn clean package | ||
``` | ||
2. Run the sample: | ||
```bash | ||
$ java -cp target/classes:target/dependency/* com.kumuluz.ee.EeApplication | ||
``` | ||
<!--- | ||
2. Run each individual microservice separately (separate terminal) with a single command with the appropriate environment variables that serve as the applications config: | ||
* `PORT` should containt the port on which the microservice will accept connections | ||
* `DATABASE_UNIT` should contain the microservice persistence unit (defaults are obtained from the `persistence.xml` file) | ||
* `DATABASE_URL` should contain the jdbc URL for the persistence unit specified above (defaults are obtained from the `persistence.xml` file) | ||
* `DATABASE_USER` should contain the database username (defaults are obtained from the `persistence.xml` file) | ||
* `DATABASE_PASS` should contain the database password (defaults are obtained from the `persistence.xml` file) | ||
```bash | ||
$ PORT=3000 java -cp catalogue/target/classes:catalogue/target/dependency/* com.kumuluz.ee.EeApplication | ||
$ PORT=3001 java -cp orders/target/classes:orders/target/dependency/* com.kumuluz.ee.EeApplication | ||
``` | ||
--> | ||
The application/service can be accessed on the following URL: | ||
* JAX-WS SOAP endpoint - http://localhost:8080/CustomerEndpoint | ||
* JAX-WS SOAP WSDL - http://localhost:8080/CustomerEndpoint?WSDL | ||
To shut down the example simply stop the processes in the foreground. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>kumuluzee-samples</artifactId> | ||
<groupId>com.kumuluz.ee.samples</groupId> | ||
<version>2.3.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>jax-ws</artifactId> | ||
|
||
<name>KumuluzEE JAX-WS sample</name> | ||
<description>JAX-WS usage sample with KumuluzEE</description> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.kumuluz.ee</groupId> | ||
<artifactId>kumuluzee-bom</artifactId> | ||
<version>${kumuluzee.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.kumuluz.ee</groupId> | ||
<artifactId>kumuluzee-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.kumuluz.ee</groupId> | ||
<artifactId>kumuluzee-servlet-jetty</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.kumuluz.ee</groupId> | ||
<artifactId>kumuluzee-jax-ws-metro</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.10</version> | ||
<executions> | ||
<execution> | ||
<id>copy-dependencies</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>copy-dependencies</goal> | ||
</goals> | ||
<configuration> | ||
<includeScope>runtime</includeScope> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
73 changes: 73 additions & 0 deletions
73
jax-ws/src/main/java/com/kumuluz/ee/samples/jaxws/Customer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2014-2017 Kumuluz and/or its affiliates | ||
* and other contributors as indicated by the @author tags and | ||
* the contributor list. | ||
* | ||
* Licensed under the MIT License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or | ||
* implied, including but not limited to the warranties of merchantability, | ||
* fitness for a particular purpose and noninfringement. in no event shall the | ||
* authors or copyright holders be liable for any claim, damages or other | ||
* liability, whether in an action of contract, tort or otherwise, arising from, | ||
* out of or in connection with the software or the use or other dealings in the | ||
* software. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.kumuluz.ee.samples.jaxws; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Benjamin on 26. apr. 2017. | ||
*/ | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType( | ||
name = "Customer", | ||
propOrder = { | ||
"id", | ||
"firstName", | ||
"lastName" | ||
} | ||
) | ||
public class Customer implements Serializable { | ||
|
||
@XmlElement(required = true) | ||
private String id; | ||
@XmlElement(required = true) | ||
private String firstName; | ||
@XmlElement(required = true) | ||
private String lastName; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
|
||
public void setFirstName(String firstName) { | ||
this.firstName = firstName; | ||
} | ||
|
||
public String getLastName() { | ||
return lastName; | ||
} | ||
|
||
public void setLastName(String lastName) { | ||
this.lastName = lastName; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
jax-ws/src/main/java/com/kumuluz/ee/samples/jaxws/CustomerEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (c) 2014-2017 Kumuluz and/or its affiliates | ||
* and other contributors as indicated by the @author tags and | ||
* the contributor list. | ||
* | ||
* Licensed under the MIT License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or | ||
* implied, including but not limited to the warranties of merchantability, | ||
* fitness for a particular purpose and noninfringement. in no event shall the | ||
* authors or copyright holders be liable for any claim, damages or other | ||
* liability, whether in an action of contract, tort or otherwise, arising from, | ||
* out of or in connection with the software or the use or other dealings in the | ||
* software. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.kumuluz.ee.samples.jaxws; | ||
|
||
import javax.jws.WebMethod; | ||
import javax.jws.WebResult; | ||
import javax.jws.WebService; | ||
import javax.xml.ws.ResponseWrapper; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by Benjamin on 26. apr. 2017. | ||
*/ | ||
@WebService( | ||
targetNamespace = "http://kumuluz.com/samples/jax-ws/customers/v1", | ||
serviceName = "CustomerEndpoint", | ||
portName = "CustomerEndpointSOAP" | ||
) | ||
public class CustomerEndpoint { | ||
|
||
@WebMethod(operationName = "GetCustomers", action = "http://kumuluz.com/samples/jax-ws/customers/v1/GetCustomers") | ||
@WebResult(name = "output") | ||
@ResponseWrapper( | ||
localName = "GetCustomersResponse", | ||
targetNamespace = "http://kumuluz.com/samples/jax-ws/customers/v1", | ||
className = "com.kumuluz.ee.samples.jaxws.GetCustomersResponse" | ||
) | ||
public GetCustomersResponseMessage getCustomers() { | ||
Customer customer1 = new Customer(); | ||
customer1.setId("1"); | ||
customer1.setFirstName("John"); | ||
customer1.setLastName("Doe"); | ||
|
||
Customer customer2 = new Customer(); | ||
customer2.setId("2"); | ||
customer2.setFirstName("Alice"); | ||
customer2.setLastName("Cooper"); | ||
|
||
Customer customer3 = new Customer(); | ||
customer3.setId("3"); | ||
customer3.setFirstName("Bob"); | ||
customer3.setLastName("Builder"); | ||
|
||
List<Customer> customers = new ArrayList<>(); | ||
customers.add(customer1); | ||
customers.add(customer2); | ||
customers.add(customer3); | ||
|
||
CustomersList customersList = new CustomersList(); | ||
customersList.setCustomer(customers); | ||
|
||
GetCustomersResponseMessage message = new GetCustomersResponseMessage(); | ||
message.setCustomers(customersList); | ||
|
||
return message; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
jax-ws/src/main/java/com/kumuluz/ee/samples/jaxws/CustomersList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2014-2017 Kumuluz and/or its affiliates | ||
* and other contributors as indicated by the @author tags and | ||
* the contributor list. | ||
* | ||
* Licensed under the MIT License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or | ||
* implied, including but not limited to the warranties of merchantability, | ||
* fitness for a particular purpose and noninfringement. in no event shall the | ||
* authors or copyright holders be liable for any claim, damages or other | ||
* liability, whether in an action of contract, tort or otherwise, arising from, | ||
* out of or in connection with the software or the use or other dealings in the | ||
* software. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.kumuluz.ee.samples.jaxws; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by Benjamin on 26. apr. 2017. | ||
*/ | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType( | ||
name = "CustomersList", | ||
propOrder = { | ||
"customer" | ||
} | ||
) | ||
public class CustomersList implements Serializable { | ||
|
||
@XmlElement(required = true) | ||
private List<Customer> customer; | ||
|
||
public List<Customer> getCustomer() { | ||
return customer; | ||
} | ||
|
||
public void setCustomer(List<Customer> customer) { | ||
this.customer = customer; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
jax-ws/src/main/java/com/kumuluz/ee/samples/jaxws/GetCustomersResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2014-2017 Kumuluz and/or its affiliates | ||
* and other contributors as indicated by the @author tags and | ||
* the contributor list. | ||
* | ||
* Licensed under the MIT License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/MIT | ||
* | ||
* The software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, express or | ||
* implied, including but not limited to the warranties of merchantability, | ||
* fitness for a particular purpose and noninfringement. in no event shall the | ||
* authors or copyright holders be liable for any claim, damages or other | ||
* liability, whether in an action of contract, tort or otherwise, arising from, | ||
* out of or in connection with the software or the use or other dealings in the | ||
* software. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.kumuluz.ee.samples.jaxws; | ||
|
||
import javax.xml.bind.annotation.*; | ||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by Benjamin on 26. apr. 2017. | ||
*/ | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType( | ||
name = "", | ||
propOrder = { | ||
"output" | ||
} | ||
) | ||
@XmlRootElement(name = "GetCustomersResponse") | ||
public class GetCustomersResponse implements Serializable { | ||
|
||
@XmlElement(required = true) | ||
private GetCustomersResponseMessage output; | ||
|
||
public GetCustomersResponseMessage getOutput() { | ||
return output; | ||
} | ||
|
||
public void setOutput(GetCustomersResponseMessage output) { | ||
this.output = output; | ||
} | ||
} |
Oops, something went wrong.