BAEL-4362 - Generate WSDL Stubs with Maven
Initial version of the codebase
This commit is contained in:
parent
a50909b228
commit
7c4fd01620
@ -25,12 +25,18 @@
|
|||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<wsdlDirectory>${project.basedir}/src/main/resources/</wsdlDirectory>
|
<wsdlDirectory>${project.basedir}/src/main/resources/</wsdlDirectory>
|
||||||
<!-- <wsdlUrls>-->
|
<packageName>com.baeldung.soap.ws.client</packageName>
|
||||||
<!-- <wsdlUrl>http://localhost:8888/ws/country?wsdl</wsdlUrl>-->
|
<sourceDestDir>
|
||||||
<!-- </wsdlUrls>-->
|
${project.build.directory}/generated-sources/
|
||||||
<keep>true</keep>
|
</sourceDestDir>
|
||||||
<packageName>com.baeldung.soap.ws.client.generated</packageName>
|
</configuration>
|
||||||
<sourceDestDir>src/main/java</sourceDestDir>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-verifier-plugin</artifactId>
|
||||||
|
<version>${maven.verifier.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<verificationFile>../input-resources/verifications.xml</verificationFile>
|
||||||
|
<failOnError>false</failOnError>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package com.baeldung.soap.ws.client;
|
package com.baeldung.soap.ws.client;
|
||||||
|
|
||||||
import com.baeldung.soap.ws.client.generated.Country;
|
|
||||||
import com.baeldung.soap.ws.client.generated.CountryService;
|
|
||||||
import com.baeldung.soap.ws.client.generated.Currency;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class CountryServiceClient {
|
public class CountryServiceClient {
|
||||||
|
@ -1,135 +0,0 @@
|
|||||||
|
|
||||||
package com.baeldung.soap.ws.client.generated;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlSchemaType;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Java class for country complex type.
|
|
||||||
*
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* <complexType name="country">
|
|
||||||
* <complexContent>
|
|
||||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
|
||||||
* <sequence>
|
|
||||||
* <element name="capital" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
|
||||||
* <element name="currency" type="{http://server.ws.soap.baeldung.com/}currency" minOccurs="0"/>
|
|
||||||
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
|
||||||
* <element name="population" type="{http://www.w3.org/2001/XMLSchema}int"/>
|
|
||||||
* </sequence>
|
|
||||||
* </restriction>
|
|
||||||
* </complexContent>
|
|
||||||
* </complexType>
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
|
||||||
@XmlType(name = "country", propOrder = {
|
|
||||||
"capital",
|
|
||||||
"currency",
|
|
||||||
"name",
|
|
||||||
"population"
|
|
||||||
})
|
|
||||||
public class Country {
|
|
||||||
|
|
||||||
protected String capital;
|
|
||||||
@XmlSchemaType(name = "string")
|
|
||||||
protected Currency currency;
|
|
||||||
protected String name;
|
|
||||||
protected int population;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the capital property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getCapital() {
|
|
||||||
return capital;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the capital property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setCapital(String value) {
|
|
||||||
this.capital = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the currency property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link Currency }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Currency getCurrency() {
|
|
||||||
return currency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the currency property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link Currency }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setCurrency(Currency value) {
|
|
||||||
this.currency = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the name property.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* possible object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the name property.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* allowed object is
|
|
||||||
* {@link String }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setName(String value) {
|
|
||||||
this.name = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value of the population property.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public int getPopulation() {
|
|
||||||
return population;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of the population property.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setPopulation(int value) {
|
|
||||||
this.population = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
package com.baeldung.soap.ws.client.generated;
|
|
||||||
|
|
||||||
import javax.jws.WebMethod;
|
|
||||||
import javax.jws.WebParam;
|
|
||||||
import javax.jws.WebResult;
|
|
||||||
import javax.jws.WebService;
|
|
||||||
import javax.jws.soap.SOAPBinding;
|
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
|
||||||
import javax.xml.ws.Action;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class was generated by the JAX-WS RI.
|
|
||||||
* JAX-WS RI 2.3.2
|
|
||||||
* Generated source version: 2.2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@WebService(name = "CountryService", targetNamespace = "http://server.ws.soap.baeldung.com/")
|
|
||||||
@SOAPBinding(style = SOAPBinding.Style.RPC)
|
|
||||||
@XmlSeeAlso({
|
|
||||||
ObjectFactory.class
|
|
||||||
})
|
|
||||||
public interface CountryService {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param arg0
|
|
||||||
* @return
|
|
||||||
* returns com.baeldung.soap.ws.client.generated.Country
|
|
||||||
*/
|
|
||||||
@WebMethod
|
|
||||||
@WebResult(partName = "return")
|
|
||||||
@Action(input = "http://server.ws.soap.baeldung.com/CountryService/findByNameRequest", output = "http://server.ws.soap.baeldung.com/CountryService/findByNameResponse")
|
|
||||||
public Country findByName(
|
|
||||||
@WebParam(name = "arg0", partName = "arg0")
|
|
||||||
String arg0);
|
|
||||||
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
|
|
||||||
package com.baeldung.soap.ws.client.generated;
|
|
||||||
|
|
||||||
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.3.2
|
|
||||||
* Generated source version: 2.2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@WebServiceClient(name = "CountryServiceImplService", targetNamespace = "http://server.ws.soap.baeldung.com/", wsdlLocation = "file:/D:/projetos/baeldung/tutorials/maven-modules/maven-plugins/jaxws/src/main/resources/country.wsdl")
|
|
||||||
public class CountryServiceImplService
|
|
||||||
extends Service
|
|
||||||
{
|
|
||||||
|
|
||||||
private final static URL COUNTRYSERVICEIMPLSERVICE_WSDL_LOCATION;
|
|
||||||
private final static WebServiceException COUNTRYSERVICEIMPLSERVICE_EXCEPTION;
|
|
||||||
private final static QName COUNTRYSERVICEIMPLSERVICE_QNAME = new QName("http://server.ws.soap.baeldung.com/", "CountryServiceImplService");
|
|
||||||
|
|
||||||
static {
|
|
||||||
URL url = null;
|
|
||||||
WebServiceException e = null;
|
|
||||||
try {
|
|
||||||
url = new URL("file:/D:/projetos/baeldung/tutorials/maven-modules/maven-plugins/jaxws/src/main/resources/country.wsdl");
|
|
||||||
} catch (MalformedURLException ex) {
|
|
||||||
e = new WebServiceException(ex);
|
|
||||||
}
|
|
||||||
COUNTRYSERVICEIMPLSERVICE_WSDL_LOCATION = url;
|
|
||||||
COUNTRYSERVICEIMPLSERVICE_EXCEPTION = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountryServiceImplService() {
|
|
||||||
super(__getWsdlLocation(), COUNTRYSERVICEIMPLSERVICE_QNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountryServiceImplService(WebServiceFeature... features) {
|
|
||||||
super(__getWsdlLocation(), COUNTRYSERVICEIMPLSERVICE_QNAME, features);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountryServiceImplService(URL wsdlLocation) {
|
|
||||||
super(wsdlLocation, COUNTRYSERVICEIMPLSERVICE_QNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountryServiceImplService(URL wsdlLocation, WebServiceFeature... features) {
|
|
||||||
super(wsdlLocation, COUNTRYSERVICEIMPLSERVICE_QNAME, features);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountryServiceImplService(URL wsdlLocation, QName serviceName) {
|
|
||||||
super(wsdlLocation, serviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CountryServiceImplService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
|
|
||||||
super(wsdlLocation, serviceName, features);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* returns CountryService
|
|
||||||
*/
|
|
||||||
@WebEndpoint(name = "CountryServiceImplPort")
|
|
||||||
public CountryService getCountryServiceImplPort() {
|
|
||||||
return super.getPort(new QName("http://server.ws.soap.baeldung.com/", "CountryServiceImplPort"), CountryService.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 CountryService
|
|
||||||
*/
|
|
||||||
@WebEndpoint(name = "CountryServiceImplPort")
|
|
||||||
public CountryService getCountryServiceImplPort(WebServiceFeature... features) {
|
|
||||||
return super.getPort(new QName("http://server.ws.soap.baeldung.com/", "CountryServiceImplPort"), CountryService.class, features);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static URL __getWsdlLocation() {
|
|
||||||
if (COUNTRYSERVICEIMPLSERVICE_EXCEPTION!= null) {
|
|
||||||
throw COUNTRYSERVICEIMPLSERVICE_EXCEPTION;
|
|
||||||
}
|
|
||||||
return COUNTRYSERVICEIMPLSERVICE_WSDL_LOCATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
package com.baeldung.soap.ws.client.generated;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlEnum;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Java class for currency.
|
|
||||||
*
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
* <p>
|
|
||||||
* <pre>
|
|
||||||
* <simpleType name="currency">
|
|
||||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
|
||||||
* <enumeration value="EUR"/>
|
|
||||||
* <enumeration value="INR"/>
|
|
||||||
* <enumeration value="USD"/>
|
|
||||||
* </restriction>
|
|
||||||
* </simpleType>
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlType(name = "currency")
|
|
||||||
@XmlEnum
|
|
||||||
public enum Currency {
|
|
||||||
|
|
||||||
EUR,
|
|
||||||
INR,
|
|
||||||
USD;
|
|
||||||
|
|
||||||
public String value() {
|
|
||||||
return name();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Currency fromValue(String v) {
|
|
||||||
return valueOf(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
package com.baeldung.soap.ws.client.generated;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRegistry;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object contains factory methods for each
|
|
||||||
* Java content interface and Java element interface
|
|
||||||
* generated in the com.baeldung.soap.ws.client.generated 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 {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.soap.ws.client.generated
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public ObjectFactory() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of {@link Country }
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Country createCountry() {
|
|
||||||
return new Country();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
@javax.xml.bind.annotation.XmlSchema(namespace = "http://server.ws.soap.baeldung.com/")
|
|
||||||
package com.baeldung.soap.ws.client.generated;
|
|
@ -3,7 +3,7 @@
|
|||||||
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server.ws.soap.baeldung.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server.ws.soap.baeldung.com/" name="CountryServiceImplService">
|
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server.ws.soap.baeldung.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server.ws.soap.baeldung.com/" name="CountryServiceImplService">
|
||||||
<types>
|
<types>
|
||||||
<xsd:schema>
|
<xsd:schema>
|
||||||
<xsd:import namespace="http://server.ws.soap.baeldung.com/" schemaLocation="http://localhost:8888/ws/country?xsd=1"/>
|
<xsd:import namespace="http://server.ws.soap.baeldung.com/" schemaLocation="country.xsd"/>
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
</types>
|
</types>
|
||||||
<message name="findByName">
|
<message name="findByName">
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e. -->
|
||||||
|
<xs:schema xmlns:tns="http://server.ws.soap.baeldung.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.0"
|
||||||
|
targetNamespace="http://server.ws.soap.baeldung.com/">
|
||||||
|
|
||||||
|
<xs:complexType name="country">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="capital" type="xs:string" minOccurs="0"></xs:element>
|
||||||
|
<xs:element name="currency" type="tns:currency" minOccurs="0"></xs:element>
|
||||||
|
<xs:element name="name" type="xs:string" minOccurs="0"></xs:element>
|
||||||
|
<xs:element name="population" type="xs:int"></xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:simpleType name="currency">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="EUR"></xs:enumeration>
|
||||||
|
<xs:enumeration value="INR"></xs:enumeration>
|
||||||
|
<xs:enumeration value="USD"></xs:enumeration>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:schema>
|
@ -1,14 +1,11 @@
|
|||||||
package com.baeldung.soap.ws.client;
|
package com.baeldung.soap.ws.client;
|
||||||
|
|
||||||
import com.baeldung.soap.ws.client.generated.Country;
|
|
||||||
import com.baeldung.soap.ws.client.generated.CountryService;
|
|
||||||
import com.baeldung.soap.ws.client.generated.Currency;
|
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
class CountryServiceClientTest {
|
class CountryServiceClientUnitTest {
|
||||||
|
|
||||||
CountryServiceClient countryServiceClient;
|
CountryServiceClient countryServiceClient;
|
||||||
CountryService countryService;
|
CountryService countryService;
|
Loading…
x
Reference in New Issue
Block a user