BAEL-611 Add JAX-WS client and JUnit Test (#1725)

* Add NDC and JBoss Logging to the demo application

* NDC for Log4j, Log4j2 and JBoss Logging

* Simplify NDC example by making it a single operation instead of two

* Make NDC example as RestController, Use JBoss Logging only as a logging bridge

* Fix merge conflicts in pull request - log-mdc pom.xml updated

* BAEL-445 Update to Spring security SpEL example

* BAEL-445: Change tabs to spaces in the updated code

* BAEL-245: Add Enum Serialization exmaple

* BAEL-245: Remove the folder jackson/src/test/java/com/baeldung/jackson/dtos/withEnum as the example is not used anymore

* Add more enum serialization examples to align with previous example and prevent build fail

* BAEL-611: Minor formatting changes

* BAEL-611: Update Test case method names

* BAEL-611 Add JAX-WS client and JUnit Test
This commit is contained in:
Sunil Mogadati 2017-04-25 00:56:08 -06:00 committed by GitHub
parent cee7e71400
commit 6aeb90de5b
24 changed files with 1559 additions and 36 deletions

View File

@ -171,6 +171,7 @@
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
</configuration>
</plugin>

View File

@ -0,0 +1,79 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for addEmployee complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="addEmployee">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="arg1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "addEmployee", propOrder = {
"arg0",
"arg1"
})
public class AddEmployee {
protected int arg0;
protected String arg1;
/**
* Gets the value of the arg0 property.
*
*/
public int getArg0() {
return arg0;
}
/**
* Sets the value of the arg0 property.
*
*/
public void setArg0(int value) {
this.arg0 = value;
}
/**
* Gets the value of the arg1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getArg1() {
return arg1;
}
/**
* Sets the value of the arg1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setArg1(String value) {
this.arg1 = value;
}
}

View File

@ -0,0 +1,62 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for addEmployeeResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="addEmployeeResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{http://bottomup.server.jaxws.baeldung.com/}employee" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "addEmployeeResponse", propOrder = {
"_return"
})
public class AddEmployeeResponse {
@XmlElement(name = "return")
protected Employee _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link Employee }
*
*/
public Employee getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link Employee }
*
*/
public void setReturn(Employee value) {
this._return = value;
}
}

View File

@ -0,0 +1,32 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for countEmployees complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="countEmployees">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "countEmployees")
public class CountEmployees {
}

View File

@ -0,0 +1,54 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for countEmployeesResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="countEmployeesResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "countEmployeesResponse", propOrder = {
"_return"
})
public class CountEmployeesResponse {
@XmlElement(name = "return")
protected int _return;
/**
* Gets the value of the return property.
*
*/
public int getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
*/
public void setReturn(int value) {
this._return = value;
}
}

View File

@ -0,0 +1,52 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for deleteEmployee complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="deleteEmployee">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "deleteEmployee", propOrder = {
"arg0"
})
public class DeleteEmployee {
protected int arg0;
/**
* Gets the value of the arg0 property.
*
*/
public int getArg0() {
return arg0;
}
/**
* Sets the value of the arg0 property.
*
*/
public void setArg0(int value) {
this.arg0 = value;
}
}

View File

@ -0,0 +1,54 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for deleteEmployeeResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="deleteEmployeeResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "deleteEmployeeResponse", propOrder = {
"_return"
})
public class DeleteEmployeeResponse {
@XmlElement(name = "return")
protected boolean _return;
/**
* Gets the value of the return property.
*
*/
public boolean isReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
*/
public void setReturn(boolean value) {
this._return = value;
}
}

View File

@ -0,0 +1,79 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for employee complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="employee">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="firstName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "employee", propOrder = {
"firstName",
"id"
})
public class Employee {
protected String firstName;
protected int id;
/**
* Gets the value of the firstName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFirstName() {
return firstName;
}
/**
* Sets the value of the firstName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFirstName(String value) {
this.firstName = value;
}
/**
* Gets the value of the id property.
*
*/
public int getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(int value) {
this.id = value;
}
}

View File

@ -0,0 +1,60 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for EmployeeAlreadyExists complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="EmployeeAlreadyExists">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EmployeeAlreadyExists", propOrder = {
"message"
})
public class EmployeeAlreadyExists {
protected String message;
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
}

View File

@ -0,0 +1,54 @@
package com.baeldung.jaxws.client;
import javax.xml.ws.WebFault;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
@WebFault(name = "EmployeeAlreadyExists", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/")
public class EmployeeAlreadyExists_Exception
extends Exception
{
/**
* Java type that goes as soapenv:Fault detail element.
*
*/
private EmployeeAlreadyExists faultInfo;
/**
*
* @param faultInfo
* @param message
*/
public EmployeeAlreadyExists_Exception(String message, EmployeeAlreadyExists faultInfo) {
super(message);
this.faultInfo = faultInfo;
}
/**
*
* @param faultInfo
* @param cause
* @param message
*/
public EmployeeAlreadyExists_Exception(String message, EmployeeAlreadyExists faultInfo, Throwable cause) {
super(message, cause);
this.faultInfo = faultInfo;
}
/**
*
* @return
* returns fault bean: com.baeldung.jaxws.client.EmployeeAlreadyExists
*/
public EmployeeAlreadyExists getFaultInfo() {
return faultInfo;
}
}

View File

@ -0,0 +1,60 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for EmployeeNotFound complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="EmployeeNotFound">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EmployeeNotFound", propOrder = {
"message"
})
public class EmployeeNotFound {
protected String message;
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
}

View File

@ -0,0 +1,54 @@
package com.baeldung.jaxws.client;
import javax.xml.ws.WebFault;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
@WebFault(name = "EmployeeNotFound", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/")
public class EmployeeNotFound_Exception
extends Exception
{
/**
* Java type that goes as soapenv:Fault detail element.
*
*/
private EmployeeNotFound faultInfo;
/**
*
* @param faultInfo
* @param message
*/
public EmployeeNotFound_Exception(String message, EmployeeNotFound faultInfo) {
super(message);
this.faultInfo = faultInfo;
}
/**
*
* @param faultInfo
* @param cause
* @param message
*/
public EmployeeNotFound_Exception(String message, EmployeeNotFound faultInfo, Throwable cause) {
super(message, cause);
this.faultInfo = faultInfo;
}
/**
*
* @return
* returns fault bean: com.baeldung.jaxws.client.EmployeeNotFound
*/
public EmployeeNotFound getFaultInfo() {
return faultInfo;
}
}

View File

@ -0,0 +1,139 @@
package com.baeldung.jaxws.client;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.Action;
import javax.xml.ws.FaultAction;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
@WebService(name = "EmployeeService", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/")
@XmlSeeAlso({
ObjectFactory.class
})
public interface EmployeeService {
/**
*
* @param arg0
* @return
* returns com.baeldung.jaxws.client.Employee
* @throws EmployeeNotFound_Exception
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "getEmployee", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.GetEmployee")
@ResponseWrapper(localName = "getEmployeeResponse", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.GetEmployeeResponse")
@Action(input = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/getEmployeeRequest", output = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/getEmployeeResponse", fault = {
@FaultAction(className = EmployeeNotFound_Exception.class, value = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/getEmployee/Fault/EmployeeNotFound")
})
public Employee getEmployee(
@WebParam(name = "arg0", targetNamespace = "")
int arg0)
throws EmployeeNotFound_Exception
;
/**
*
* @param arg1
* @param arg0
* @return
* returns com.baeldung.jaxws.client.Employee
* @throws EmployeeNotFound_Exception
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "updateEmployee", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.UpdateEmployee")
@ResponseWrapper(localName = "updateEmployeeResponse", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.UpdateEmployeeResponse")
@Action(input = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/updateEmployeeRequest", output = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/updateEmployeeResponse", fault = {
@FaultAction(className = EmployeeNotFound_Exception.class, value = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/updateEmployee/Fault/EmployeeNotFound")
})
public Employee updateEmployee(
@WebParam(name = "arg0", targetNamespace = "")
int arg0,
@WebParam(name = "arg1", targetNamespace = "")
String arg1)
throws EmployeeNotFound_Exception
;
/**
*
* @return
* returns java.util.List<com.baeldung.jaxws.client.Employee>
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "getAllEmployees", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.GetAllEmployees")
@ResponseWrapper(localName = "getAllEmployeesResponse", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.GetAllEmployeesResponse")
@Action(input = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/getAllEmployeesRequest", output = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/getAllEmployeesResponse")
public List<Employee> getAllEmployees();
/**
*
* @param arg0
* @return
* returns boolean
* @throws EmployeeNotFound_Exception
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "deleteEmployee", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.DeleteEmployee")
@ResponseWrapper(localName = "deleteEmployeeResponse", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.DeleteEmployeeResponse")
@Action(input = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/deleteEmployeeRequest", output = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/deleteEmployeeResponse", fault = {
@FaultAction(className = EmployeeNotFound_Exception.class, value = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/deleteEmployee/Fault/EmployeeNotFound")
})
public boolean deleteEmployee(
@WebParam(name = "arg0", targetNamespace = "")
int arg0)
throws EmployeeNotFound_Exception
;
/**
*
* @param arg1
* @param arg0
* @return
* returns com.baeldung.jaxws.client.Employee
* @throws EmployeeAlreadyExists_Exception
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "addEmployee", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.AddEmployee")
@ResponseWrapper(localName = "addEmployeeResponse", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.AddEmployeeResponse")
@Action(input = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/addEmployeeRequest", output = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/addEmployeeResponse", fault = {
@FaultAction(className = EmployeeAlreadyExists_Exception.class, value = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/addEmployee/Fault/EmployeeAlreadyExists")
})
public Employee addEmployee(
@WebParam(name = "arg0", targetNamespace = "")
int arg0,
@WebParam(name = "arg1", targetNamespace = "")
String arg1)
throws EmployeeAlreadyExists_Exception
;
/**
*
* @return
* returns int
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "countEmployees", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.CountEmployees")
@ResponseWrapper(localName = "countEmployeesResponse", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", className = "com.baeldung.jaxws.client.CountEmployeesResponse")
@Action(input = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/countEmployeesRequest", output = "http://bottomup.server.jaxws.baeldung.com/EmployeeService/countEmployeesResponse")
public int countEmployees();
}

View File

@ -1,25 +1,18 @@
package com.baeldung.jaxws.client;
import com.baeldung.jaxws.server.bottomup.EmployeeService;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;
import java.util.List;
public class EmployeeServiceClient {
public static void main(String[] args) throws Exception {
URL url = new URL("http://localhost:8081/employeeservice?wsdl");
QName qname = new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeServiceImplService");
URL url = new URL("http://localhost:8080/employeeservice?wsdl");
Service service = Service.create(url, qname);
EmployeeService_Service employeeService_Service = new EmployeeService_Service(url);
EmployeeService employeeServiceProxy = employeeService_Service.getEmployeeServiceImplPort();
EmployeeService employeeService = service.getPort(EmployeeService.class);
employeeService.countEmployees();
System.out.println(employeeService.countEmployees());
List<Employee> allEmployees = employeeServiceProxy.getAllEmployees();
}
}

View File

@ -0,0 +1,94 @@
package com.baeldung.jaxws.client;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "EmployeeService", targetNamespace = "http://bottomup.server.jaxws.baeldung.com/", wsdlLocation = "http://localhost:8080/employeeservice?wsdl")
public class EmployeeService_Service
extends Service
{
private final static URL EMPLOYEESERVICE_WSDL_LOCATION;
private final static WebServiceException EMPLOYEESERVICE_EXCEPTION;
private final static QName EMPLOYEESERVICE_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeService");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("http://localhost:8080/employeeservice?wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
EMPLOYEESERVICE_WSDL_LOCATION = url;
EMPLOYEESERVICE_EXCEPTION = e;
}
public EmployeeService_Service() {
super(__getWsdlLocation(), EMPLOYEESERVICE_QNAME);
}
public EmployeeService_Service(WebServiceFeature... features) {
super(__getWsdlLocation(), EMPLOYEESERVICE_QNAME, features);
}
public EmployeeService_Service(URL wsdlLocation) {
super(wsdlLocation, EMPLOYEESERVICE_QNAME);
}
public EmployeeService_Service(URL wsdlLocation, WebServiceFeature... features) {
super(wsdlLocation, EMPLOYEESERVICE_QNAME, features);
}
public EmployeeService_Service(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public EmployeeService_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns EmployeeService
*/
@WebEndpoint(name = "EmployeeServiceImplPort")
public EmployeeService getEmployeeServiceImplPort() {
return super.getPort(new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeServiceImplPort"), EmployeeService.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns EmployeeService
*/
@WebEndpoint(name = "EmployeeServiceImplPort")
public EmployeeService getEmployeeServiceImplPort(WebServiceFeature... features) {
return super.getPort(new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeServiceImplPort"), EmployeeService.class, features);
}
private static URL __getWsdlLocation() {
if (EMPLOYEESERVICE_EXCEPTION!= null) {
throw EMPLOYEESERVICE_EXCEPTION;
}
return EMPLOYEESERVICE_WSDL_LOCATION;
}
}

View File

@ -0,0 +1,32 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getAllEmployees complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="getAllEmployees">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getAllEmployees")
public class GetAllEmployees {
}

View File

@ -0,0 +1,69 @@
package com.baeldung.jaxws.client;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getAllEmployeesResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="getAllEmployeesResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{http://bottomup.server.jaxws.baeldung.com/}employee" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getAllEmployeesResponse", propOrder = {
"_return"
})
public class GetAllEmployeesResponse {
@XmlElement(name = "return")
protected List<Employee> _return;
/**
* Gets the value of the return property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the return property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getReturn().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Employee }
*
*
*/
public List<Employee> getReturn() {
if (_return == null) {
_return = new ArrayList<Employee>();
}
return this._return;
}
}

View File

@ -0,0 +1,52 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getEmployee complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="getEmployee">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getEmployee", propOrder = {
"arg0"
})
public class GetEmployee {
protected int arg0;
/**
* Gets the value of the arg0 property.
*
*/
public int getArg0() {
return arg0;
}
/**
* Sets the value of the arg0 property.
*
*/
public void setArg0(int value) {
this.arg0 = value;
}
}

View File

@ -0,0 +1,62 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getEmployeeResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="getEmployeeResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{http://bottomup.server.jaxws.baeldung.com/}employee" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getEmployeeResponse", propOrder = {
"_return"
})
public class GetEmployeeResponse {
@XmlElement(name = "return")
protected Employee _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link Employee }
*
*/
public Employee getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link Employee }
*
*/
public void setReturn(Employee value) {
this._return = value;
}
}

View File

@ -0,0 +1,295 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.baeldung.jaxws.client package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _AddEmployeeResponse_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "addEmployeeResponse");
private final static QName _EmployeeAlreadyExists_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeAlreadyExists");
private final static QName _GetEmployeeResponse_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "getEmployeeResponse");
private final static QName _EmployeeNotFound_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeNotFound");
private final static QName _CountEmployees_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "countEmployees");
private final static QName _UpdateEmployee_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "updateEmployee");
private final static QName _DeleteEmployeeResponse_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "deleteEmployeeResponse");
private final static QName _GetAllEmployeesResponse_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "getAllEmployeesResponse");
private final static QName _DeleteEmployee_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "deleteEmployee");
private final static QName _UpdateEmployeeResponse_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "updateEmployeeResponse");
private final static QName _AddEmployee_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "addEmployee");
private final static QName _GetAllEmployees_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "getAllEmployees");
private final static QName _CountEmployeesResponse_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "countEmployeesResponse");
private final static QName _GetEmployee_QNAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "getEmployee");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.jaxws.client
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link EmployeeNotFound }
*
*/
public EmployeeNotFound createEmployeeNotFound() {
return new EmployeeNotFound();
}
/**
* Create an instance of {@link CountEmployees }
*
*/
public CountEmployees createCountEmployees() {
return new CountEmployees();
}
/**
* Create an instance of {@link AddEmployeeResponse }
*
*/
public AddEmployeeResponse createAddEmployeeResponse() {
return new AddEmployeeResponse();
}
/**
* Create an instance of {@link EmployeeAlreadyExists }
*
*/
public EmployeeAlreadyExists createEmployeeAlreadyExists() {
return new EmployeeAlreadyExists();
}
/**
* Create an instance of {@link GetEmployeeResponse }
*
*/
public GetEmployeeResponse createGetEmployeeResponse() {
return new GetEmployeeResponse();
}
/**
* Create an instance of {@link DeleteEmployeeResponse }
*
*/
public DeleteEmployeeResponse createDeleteEmployeeResponse() {
return new DeleteEmployeeResponse();
}
/**
* Create an instance of {@link GetAllEmployeesResponse }
*
*/
public GetAllEmployeesResponse createGetAllEmployeesResponse() {
return new GetAllEmployeesResponse();
}
/**
* Create an instance of {@link UpdateEmployee }
*
*/
public UpdateEmployee createUpdateEmployee() {
return new UpdateEmployee();
}
/**
* Create an instance of {@link CountEmployeesResponse }
*
*/
public CountEmployeesResponse createCountEmployeesResponse() {
return new CountEmployeesResponse();
}
/**
* Create an instance of {@link GetEmployee }
*
*/
public GetEmployee createGetEmployee() {
return new GetEmployee();
}
/**
* Create an instance of {@link DeleteEmployee }
*
*/
public DeleteEmployee createDeleteEmployee() {
return new DeleteEmployee();
}
/**
* Create an instance of {@link UpdateEmployeeResponse }
*
*/
public UpdateEmployeeResponse createUpdateEmployeeResponse() {
return new UpdateEmployeeResponse();
}
/**
* Create an instance of {@link AddEmployee }
*
*/
public AddEmployee createAddEmployee() {
return new AddEmployee();
}
/**
* Create an instance of {@link GetAllEmployees }
*
*/
public GetAllEmployees createGetAllEmployees() {
return new GetAllEmployees();
}
/**
* Create an instance of {@link Employee }
*
*/
public Employee createEmployee() {
return new Employee();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link AddEmployeeResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "addEmployeeResponse")
public JAXBElement<AddEmployeeResponse> createAddEmployeeResponse(AddEmployeeResponse value) {
return new JAXBElement<AddEmployeeResponse>(_AddEmployeeResponse_QNAME, AddEmployeeResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link EmployeeAlreadyExists }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "EmployeeAlreadyExists")
public JAXBElement<EmployeeAlreadyExists> createEmployeeAlreadyExists(EmployeeAlreadyExists value) {
return new JAXBElement<EmployeeAlreadyExists>(_EmployeeAlreadyExists_QNAME, EmployeeAlreadyExists.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetEmployeeResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "getEmployeeResponse")
public JAXBElement<GetEmployeeResponse> createGetEmployeeResponse(GetEmployeeResponse value) {
return new JAXBElement<GetEmployeeResponse>(_GetEmployeeResponse_QNAME, GetEmployeeResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link EmployeeNotFound }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "EmployeeNotFound")
public JAXBElement<EmployeeNotFound> createEmployeeNotFound(EmployeeNotFound value) {
return new JAXBElement<EmployeeNotFound>(_EmployeeNotFound_QNAME, EmployeeNotFound.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CountEmployees }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "countEmployees")
public JAXBElement<CountEmployees> createCountEmployees(CountEmployees value) {
return new JAXBElement<CountEmployees>(_CountEmployees_QNAME, CountEmployees.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateEmployee }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "updateEmployee")
public JAXBElement<UpdateEmployee> createUpdateEmployee(UpdateEmployee value) {
return new JAXBElement<UpdateEmployee>(_UpdateEmployee_QNAME, UpdateEmployee.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteEmployeeResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "deleteEmployeeResponse")
public JAXBElement<DeleteEmployeeResponse> createDeleteEmployeeResponse(DeleteEmployeeResponse value) {
return new JAXBElement<DeleteEmployeeResponse>(_DeleteEmployeeResponse_QNAME, DeleteEmployeeResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetAllEmployeesResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "getAllEmployeesResponse")
public JAXBElement<GetAllEmployeesResponse> createGetAllEmployeesResponse(GetAllEmployeesResponse value) {
return new JAXBElement<GetAllEmployeesResponse>(_GetAllEmployeesResponse_QNAME, GetAllEmployeesResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteEmployee }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "deleteEmployee")
public JAXBElement<DeleteEmployee> createDeleteEmployee(DeleteEmployee value) {
return new JAXBElement<DeleteEmployee>(_DeleteEmployee_QNAME, DeleteEmployee.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateEmployeeResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "updateEmployeeResponse")
public JAXBElement<UpdateEmployeeResponse> createUpdateEmployeeResponse(UpdateEmployeeResponse value) {
return new JAXBElement<UpdateEmployeeResponse>(_UpdateEmployeeResponse_QNAME, UpdateEmployeeResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link AddEmployee }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "addEmployee")
public JAXBElement<AddEmployee> createAddEmployee(AddEmployee value) {
return new JAXBElement<AddEmployee>(_AddEmployee_QNAME, AddEmployee.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetAllEmployees }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "getAllEmployees")
public JAXBElement<GetAllEmployees> createGetAllEmployees(GetAllEmployees value) {
return new JAXBElement<GetAllEmployees>(_GetAllEmployees_QNAME, GetAllEmployees.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CountEmployeesResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "countEmployeesResponse")
public JAXBElement<CountEmployeesResponse> createCountEmployeesResponse(CountEmployeesResponse value) {
return new JAXBElement<CountEmployeesResponse>(_CountEmployeesResponse_QNAME, CountEmployeesResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link GetEmployee }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://bottomup.server.jaxws.baeldung.com/", name = "getEmployee")
public JAXBElement<GetEmployee> createGetEmployee(GetEmployee value) {
return new JAXBElement<GetEmployee>(_GetEmployee_QNAME, GetEmployee.class, null, value);
}
}

View File

@ -0,0 +1,79 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for updateEmployee complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="updateEmployee">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="arg1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "updateEmployee", propOrder = {
"arg0",
"arg1"
})
public class UpdateEmployee {
protected int arg0;
protected String arg1;
/**
* Gets the value of the arg0 property.
*
*/
public int getArg0() {
return arg0;
}
/**
* Sets the value of the arg0 property.
*
*/
public void setArg0(int value) {
this.arg0 = value;
}
/**
* Gets the value of the arg1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getArg1() {
return arg1;
}
/**
* Sets the value of the arg1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setArg1(String value) {
this.arg1 = value;
}
}

View File

@ -0,0 +1,62 @@
package com.baeldung.jaxws.client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for updateEmployeeResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="updateEmployeeResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{http://bottomup.server.jaxws.baeldung.com/}employee" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "updateEmployeeResponse", propOrder = {
"_return"
})
public class UpdateEmployeeResponse {
@XmlElement(name = "return")
protected Employee _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link Employee }
*
*/
public Employee getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link Employee }
*
*/
public void setReturn(Employee value) {
this._return = value;
}
}

View File

@ -0,0 +1,2 @@
@javax.xml.bind.annotation.XmlSchema(namespace = "http://bottomup.server.jaxws.baeldung.com/")
package com.baeldung.jaxws.client;

View File

@ -1,4 +1,4 @@
/*package com.baeldung.jaxws;
package com.baeldung.jaxws;
import static org.junit.Assert.assertEquals;
@ -7,7 +7,6 @@ import java.net.URL;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
@ -19,17 +18,18 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.baeldung.jaxws.exception.EmployeeAlreadyExists;
import com.baeldung.jaxws.exception.EmployeeNotFound;
import com.baeldung.jaxws.model.Employee;
import com.baeldung.jaxws.repository.EmployeeRepository;
import com.baeldung.jaxws.client.Employee;
import com.baeldung.jaxws.client.EmployeeAlreadyExists_Exception;
import com.baeldung.jaxws.client.EmployeeNotFound_Exception;
import com.baeldung.jaxws.client.EmployeeService;
import com.baeldung.jaxws.client.EmployeeService_Service;
@RunWith(Arquillian.class)
public class EmployeeServiceLiveTest {
private static final String APP_NAME = "jee7";
private static final String WSDL_PATH = "EmployeeService?wsdl";
private static QName SERVICE_NAME = new QName("http://jaxws.baeldung.com/", "EmployeeService");
private static QName SERVICE_NAME = new QName("http://bottomup.server.jaxws.baeldung.com/", "EmployeeService");
private static URL wsdlUrl;
@ArquillianResource
@ -39,8 +39,12 @@ public class EmployeeServiceLiveTest {
@Deployment(testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, APP_NAME + ".war").addPackage(EmployeeService.class.getPackage()).addPackage(Employee.class.getPackage()).addPackage(EmployeeNotFound.class.getPackage()).addPackage(EmployeeRepository.class.getPackage())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
return ShrinkWrap.create(WebArchive.class, APP_NAME + ".war")
.addPackage(com.baeldung.jaxws.server.bottomup.EmployeeService.class.getPackage())
.addPackage(com.baeldung.jaxws.server.bottomup.model.Employee.class.getPackage())
.addPackage(com.baeldung.jaxws.server.bottomup.exception.EmployeeNotFound.class.getPackage())
.addPackage(com.baeldung.jaxws.server.repository.EmployeeRepository.class.getPackage())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Before
@ -51,8 +55,8 @@ public class EmployeeServiceLiveTest {
e.printStackTrace();
}
Service service = Service.create(wsdlUrl, SERVICE_NAME);
employeeServiceProxy = service.getPort(EmployeeService.class);
EmployeeService_Service employeeService_Service = new EmployeeService_Service(wsdlUrl);
employeeServiceProxy = employeeService_Service.getEmployeeServiceImplPort();
}
@Test
@ -63,49 +67,48 @@ public class EmployeeServiceLiveTest {
}
@Test
public void givenEmployees_whenGetAvailableEmployee_thenCorrectEmployeeReturned() throws EmployeeNotFound {
public void givenEmployees_whenGetAvailableEmployee_thenCorrectEmployeeReturned() throws EmployeeNotFound_Exception {
Employee employee = employeeServiceProxy.getEmployee(2);
assertEquals(employee.getFirstName(), "Jack");
}
@Test(expected = EmployeeNotFound.class)
public void givenEmployees_whenGetNonAvailableEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
@Test(expected = EmployeeNotFound_Exception.class)
public void givenEmployees_whenGetNonAvailableEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound_Exception {
employeeServiceProxy.getEmployee(20);
}
@Test
public void givenEmployees_whenAddNewEmployee_thenEmployeeCountIncreased() throws EmployeeAlreadyExists {
public void givenEmployees_whenAddNewEmployee_thenEmployeeCountIncreased() throws EmployeeAlreadyExists_Exception {
int employeeCount = employeeServiceProxy.countEmployees();
employeeServiceProxy.addEmployee(4, "Anna");
assertEquals(employeeServiceProxy.countEmployees(), employeeCount + 1);
}
@Test(expected = EmployeeAlreadyExists.class)
public void givenEmployees_whenAddAlreadyExistingEmployee_thenEmployeeAlreadyExistsException() throws EmployeeAlreadyExists {
@Test(expected = EmployeeAlreadyExists_Exception.class)
public void givenEmployees_whenAddAlreadyExistingEmployee_thenEmployeeAlreadyExistsException() throws EmployeeAlreadyExists_Exception {
employeeServiceProxy.addEmployee(1, "Anna");
}
@Test
public void givenEmployees_whenUpdateExistingEmployee_thenUpdatedEmployeeReturned() throws EmployeeNotFound {
public void givenEmployees_whenUpdateExistingEmployee_thenUpdatedEmployeeReturned() throws EmployeeNotFound_Exception {
Employee updated = employeeServiceProxy.updateEmployee(1, "Joan");
assertEquals(updated.getFirstName(), "Joan");
}
@Test(expected = EmployeeNotFound.class)
public void givenEmployees_whenUpdateNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
@Test(expected = EmployeeNotFound_Exception.class)
public void givenEmployees_whenUpdateNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound_Exception {
employeeServiceProxy.updateEmployee(20, "Joan");
}
@Test
public void givenEmployees_whenDeleteExistingEmployee_thenSuccessReturned() throws EmployeeNotFound {
public void givenEmployees_whenDeleteExistingEmployee_thenSuccessReturned() throws EmployeeNotFound_Exception {
boolean deleteEmployee = employeeServiceProxy.deleteEmployee(3);
assertEquals(deleteEmployee, true);
}
@Test(expected = EmployeeNotFound.class)
public void givenEmployee_whenDeleteNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
@Test(expected = EmployeeNotFound_Exception.class)
public void givenEmployee_whenDeleteNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound_Exception {
employeeServiceProxy.deleteEmployee(20);
}
}
*/