-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bjornvester/next
Version 1.1
- Loading branch information
Showing
10 changed files
with
216 additions
and
12 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
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
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
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,13 @@ | ||
plugins { | ||
id("com.github.bjornvester.wsdl2java") | ||
id("com.github.bjornvester.wsdl2java.internal.java-conventions") | ||
} | ||
|
||
dependencies { | ||
implementation("org.jvnet.jaxb2_commons:jaxb2-basics-runtime:1.11.1") | ||
xjcPlugins("org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1") | ||
} | ||
|
||
wsdl2java { | ||
options.addAll("-xjc-Xequals", "-xjc-XhashCode") | ||
} |
58 changes: 58 additions & 0 deletions
58
integration-test/xjc-plugins-test/src/main/resources/HelloXjcPluginService.wsdl
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,58 @@ | ||
<?xml version='1.0' encoding='UTF-8'?><!-- 5 --> | ||
<wsdl:definitions name="HelloWorldService" | ||
targetNamespace="http://github.com/bjornvester/example/xjcplugins" | ||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | ||
xmlns:tns="http://github.com/bjornvester/example/xjcplugins" | ||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | ||
<wsdl:types> | ||
<xs:schema targetNamespace="http://github.com/bjornvester/example/xjcplugins" | ||
xmlns="http://github.com/bjornvester/example/xjcplugins" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<xs:complexType name="sayHi"> | ||
<xs:sequence> | ||
<xs:element name="arg0" type="xs:string"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
<xs:complexType name="sayHiResponse"> | ||
<xs:sequence> | ||
<xs:element name="return" type="xs:string"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
<xs:element name="sayHi" nillable="true" type="sayHi"/> | ||
<xs:element name="sayHiResponse" nillable="true" type="sayHiResponse"/> | ||
</xs:schema> | ||
</wsdl:types> | ||
<wsdl:message name="sayHi"> | ||
<wsdl:part element="tns:sayHi" name="parameters"> | ||
</wsdl:part> | ||
</wsdl:message> | ||
<wsdl:message name="sayHiResponse"> | ||
<wsdl:part element="tns:sayHiResponse" name="parameters"> | ||
</wsdl:part> | ||
</wsdl:message> | ||
<wsdl:portType name="HelloWorld"> | ||
<wsdl:operation name="sayHi"> | ||
<wsdl:input message="tns:sayHi" name="sayHi"> | ||
</wsdl:input> | ||
<wsdl:output message="tns:sayHiResponse" name="sayHiResponse"> | ||
</wsdl:output> | ||
</wsdl:operation> | ||
</wsdl:portType> | ||
<wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorld"> | ||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<wsdl:operation name="sayHi"> | ||
<soap:operation soapAction="" style="document"/> | ||
<wsdl:input name="sayHi"> | ||
<soap:body use="literal"/> | ||
</wsdl:input> | ||
<wsdl:output name="sayHiResponse"> | ||
<soap:body use="literal"/> | ||
</wsdl:output> | ||
</wsdl:operation> | ||
</wsdl:binding> | ||
<wsdl:service name="HelloWorldService"> | ||
<wsdl:port name="HelloWorldPort" binding="tns:HelloWorldServiceSoapBinding"> | ||
<soap:address location="http://localhost:8080/MyCXFWebService/services/HelloWorldPort"/> | ||
</wsdl:port> | ||
</wsdl:service> | ||
</wsdl:definitions> |
14 changes: 14 additions & 0 deletions
14
...-test/xjc-plugins-test/src/test/java/com/github/bjornvester/wsdl2java/HelloWorldImpl.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,14 @@ | ||
package com.github.bjornvester.wsdl2java; | ||
|
||
import com.github.bjornvester.example.xjcplugins.HelloWorld; | ||
import com.github.bjornvester.example.xjcplugins.SayHi; | ||
import com.github.bjornvester.example.xjcplugins.SayHiResponse; | ||
|
||
public class HelloWorldImpl implements HelloWorld { | ||
@Override | ||
public SayHiResponse sayHi(SayHi request) { | ||
SayHiResponse response = new SayHiResponse(); | ||
response.setReturn("Hi, " + request.getArg0()); | ||
return response; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...-test/xjc-plugins-test/src/test/java/com/github/bjornvester/wsdl2java/HelloWorldTest.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,48 @@ | ||
package com.github.bjornvester.wsdl2java; | ||
|
||
import com.github.bjornvester.example.xjcplugins.HelloWorld; | ||
import com.github.bjornvester.example.xjcplugins.SayHi; | ||
import com.github.bjornvester.example.xjcplugins.SayHiResponse; | ||
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.jvnet.jaxb2_commons.lang.Equals2; | ||
import org.jvnet.jaxb2_commons.lang.HashCode2; | ||
|
||
import javax.xml.ws.Endpoint; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class HelloWorldTest { | ||
String serviceAddress = "http://localhost:8899/HellowWorldService"; | ||
Endpoint endpoint; | ||
|
||
@AfterEach | ||
void stopEndpoint() { | ||
if (endpoint != null) { | ||
endpoint.stop(); | ||
} | ||
} | ||
|
||
@Test | ||
void testServerClient() { | ||
// Create server | ||
endpoint = Endpoint.publish(serviceAddress, new HelloWorldImpl()); | ||
|
||
// Create client | ||
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); | ||
factory.setServiceClass(HelloWorld.class); | ||
factory.setAddress(serviceAddress); | ||
HelloWorld client = (HelloWorld) factory.create(); | ||
|
||
// Call the service | ||
SayHi sayHi = new SayHi(); | ||
sayHi.setArg0("Joe"); | ||
SayHiResponse response = client.sayHi(sayHi); | ||
assertTrue(response.getReturn().contains("Hi")); | ||
|
||
// Check the plugins | ||
assertTrue(sayHi instanceof Equals2); | ||
assertTrue(sayHi instanceof HashCode2); | ||
} | ||
} |
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
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
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