Skip to content

Commit 3579ee7

Browse files
jochenseeberJochen Seeber
authored and
Jochen Seeber
committed
Initial commit
0 parents  commit 3579ee7

File tree

28 files changed

+2155
-0
lines changed

28 files changed

+2155
-0
lines changed

.derived

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
target

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*~
2+
/.classpath
3+
/.gradle
4+
/.project
5+
/.settings
6+
/bin
7+
/build
8+
/target
9+
\#*\#
10+
/.checkstyle
11+
/bin/
12+
/build/
13+
/target/
14+
/src/main/checkstyle/checkstyle.xml
15+
/src/test/checkstyle/checkstyle.xml

LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2016, Jochen Seeber
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Gradle WSImport Plugin
2+
======================
3+
4+
This is a plugin to run [wsimport](https://jax-ws.java.net/2.2.10/docs/ch04.html#tools-wsimport) on WSDL files to generate the Java code required to access a web service (aka the really comprehensibly named "JAX-WS portable artifacts" ;-).
5+
6+
With this plugin, you can create builds that do not require a network connection to download WSDL files during build time. Instead, you can use a separate download task to update the local WSDL files, so everything required to build is availably locally.
7+
8+
Applying the plugin
9+
-------------------
10+
11+
```gradle
12+
plugins {
13+
id "me.seeber.gradle-wsimport-plugin" version "1.0.0"
14+
}
15+
```
16+
17+
Usage
18+
-----
19+
20+
The plugin will automatically process all WSDL files found in `src/main/wsdl`. This works for all source sets, so files in `src/test/wsdl` and any other source set you define will also be processed.
21+
22+
The package name for the generated Java classes will be determined by the subdirectory of the WSDL file, e.g. for `src/main/wsdl/com/company/boringenterpriseservice.wsdl` the plugin will use the package name `com.company`.
23+
24+
Currently there are no configuration options.
25+
26+
### Downloading the WSDLs
27+
28+
You can use the [download plugin](https://github.com/michel-kraemer/gradle-download-task) to download the WSDLs. Here's an example from the demo projects:
29+
30+
```gradle
31+
plugins {
32+
id "de.undercouch.download" version "1.2"
33+
}
34+
35+
import de.undercouch.gradle.tasks.download.Download
36+
37+
task downloadWsdl(type: Download) {
38+
description "Download WSDL"
39+
src "http://www-inf.int-evry.fr/cours/WebServices/TP_BPEL/files/PingPong.wsdl"
40+
dest "src/main/wsdl/me/seeber/gradle/wsimport/demo/hello/client/PingPong.wsdl"
41+
}
42+
```
43+
44+
Then you can update the local WSDL file with
45+
46+
```bash
47+
gradle downloadWsdl
48+
```
49+
50+
Examples
51+
--------
52+
53+
See the [demo project](https://github.com/jochenseeber/gradle-wsimport-demo) for an example.
54+
55+
License
56+
-------
57+
58+
This plugin is licensed under the [BSD 2-Clause](LICENSE.txt) license.

build.gradle

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
mavenCentral()
5+
jcenter()
6+
maven { url "https://plugins.gradle.org/m2/" }
7+
}
8+
9+
dependencies {
10+
classpath group: "me.seeber.gradle", name: "gradle-bintray-config", version: "1.0.0"
11+
classpath group: "me.seeber.gradle", name: "gradle-license-config", version: "1.0.0"
12+
classpath group: "me.seeber.gradle", name: "gradle-github-config", version: "1.0.0"
13+
classpath group: "me.seeber.gradle", name: "gradle-plugin-publish-config", version: "1.0.0"
14+
}
15+
}
16+
17+
version = "1.0.0"
18+
group = "me.seeber.gradle"
19+
description = "Run wsimport on WSDL files to generate Java code required to access web services"
20+
21+
apply plugin: "me.seeber.distribution.bintray"
22+
apply plugin: "me.seeber.distribution.gradle-plugin"
23+
apply plugin: "me.seeber.distribution.maven"
24+
apply plugin: "me.seeber.ide.eclipse"
25+
apply plugin: "me.seeber.project.gradle-plugin"
26+
apply plugin: "me.seeber.repository.github"
27+
apply plugin: "me.seeber.setup.license"
28+
apply plugin: "me.seeber.validation.checkstyle"
29+
30+
model {
31+
projectConfig {
32+
organization.name = "Jochen Seeber"
33+
inceptionYear = 2016
34+
license.id = "BSD 2-Clause"
35+
}
36+
37+
githubConfig { user = "jochenseeber" }
38+
}
39+
40+
dependencies {
41+
compile(group: "com.google.guava", name: "guava", version: "19.0")
42+
}
43+
44+
pluginBundle {
45+
tags = ["soap", "wsdl", "wsimport"]
46+
47+
plugins { wsimportPlugin.id = "me.seeber.wsimport" }
48+
}

demo/wsimport-hello/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*~
2+
/.classpath
3+
/.gradle
4+
/.project
5+
/.settings
6+
/bin
7+
/build
8+
/target
9+
\#*\#

demo/wsimport-hello/LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2015, Jochen Seeber
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

demo/wsimport-hello/build.gradle

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
mavenCentral()
5+
jcenter()
6+
}
7+
8+
dependencies {
9+
classpath group: "me.seeber.gradle", name: "gradle-wsimport-plugin", version: "1.0.0"
10+
}
11+
}
12+
13+
plugins {
14+
id "de.undercouch.download" version "1.2"
15+
id "com.github.hierynomus.license" version "0.11.0"
16+
}
17+
18+
import de.undercouch.gradle.tasks.download.Download
19+
20+
group = "me.seeber.gradle.wsimport.demo"
21+
version = "1.0.0"
22+
description = "Hello world demo project for Gradle wsimport plugin"
23+
24+
repositories {
25+
mavenLocal()
26+
mavenCentral()
27+
jcenter()
28+
}
29+
30+
apply plugin: "java"
31+
apply plugin: "eclipse"
32+
apply plugin: "me.seeber.wsimport"
33+
34+
task downloadWsdl(type: Download) {
35+
description "Download WSDL"
36+
src "http://www-inf.int-evry.fr/cours/WebServices/TP_BPEL/files/PingPong.wsdl"
37+
dest "src/main/wsdl/me/seeber/gradle/wsimport/demo/hello/client/PingPong.wsdl"
38+
}
39+
40+
jar {
41+
manifest {
42+
attributes "Main-Class": "me.seeber.gradle.wsimport.demo.hello.HelloMain"
43+
}
44+
}
45+
46+
eclipse {
47+
classpath {
48+
downloadSources = true
49+
downloadJavadoc = true
50+
}
51+
}
52+
53+
license {
54+
header = file("LICENSE.txt")
55+
}
56+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* BSD 2-Clause License
3+
*
4+
* Copyright (c) 2015, Jochen Seeber
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* * Redistributions of source code must retain the above copyright notice, this
11+
* list of conditions and the following disclaimer.
12+
*
13+
* * Redistributions in binary form must reproduce the above copyright notice,
14+
* this list of conditions and the following disclaimer in the documentation
15+
* and/or other materials provided with the distribution.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
package me.seeber.gradle.wsimport.demo.hello;
29+
30+
import java.net.MalformedURLException;
31+
import java.net.URL;
32+
33+
import me.seeber.gradle.wsimport.demo.hello.client.PingPong;
34+
import me.seeber.gradle.wsimport.demo.hello.client.PingPongService;
35+
36+
public class HelloMain {
37+
38+
public static void main(String[] arguments) {
39+
HelloMain hello = new HelloMain();
40+
hello.run();
41+
}
42+
43+
public void run() {
44+
try {
45+
PingPongService service = new PingPongService(new URL(
46+
"http://www-inf.int-evry.fr/cours/WebServices/TP_BPEL/files/PingPong.wsdl"));
47+
PingPong pingPong = service.getPingPong();
48+
String echoInput = pingPong.echoInput("Hello world!");
49+
System.out.println(echoInput);
50+
}
51+
catch (MalformedURLException e) {
52+
System.err.println(e.getMessage());
53+
}
54+
}
55+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<wsdl:definitions targetNamespace="http://pingpong.bpel.tps" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://pingpong.bpel.tps" xmlns:intf="http://pingpong.bpel.tps" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3+
<!--WSDL created by Apache Axis version: 1.4
4+
Built on Apr 22, 2006 (06:55:48 PDT)-->
5+
<wsdl:types>
6+
<schema elementFormDefault="qualified" targetNamespace="http://pingpong.bpel.tps" xmlns="http://www.w3.org/2001/XMLSchema">
7+
<element name="echoInput">
8+
<complexType>
9+
<sequence>
10+
<element name="input" type="xsd:string"/>
11+
</sequence>
12+
</complexType>
13+
</element>
14+
<element name="echoInputResponse">
15+
<complexType>
16+
<sequence>
17+
<element name="echoInputReturn" type="xsd:string"/>
18+
</sequence>
19+
</complexType>
20+
</element>
21+
</schema>
22+
</wsdl:types>
23+
24+
<wsdl:message name="echoInputResponse">
25+
26+
<wsdl:part element="impl:echoInputResponse" name="parameters"/>
27+
28+
</wsdl:message>
29+
30+
<wsdl:message name="echoInputRequest">
31+
32+
<wsdl:part element="impl:echoInput" name="parameters"/>
33+
34+
</wsdl:message>
35+
36+
<wsdl:portType name="PingPong">
37+
38+
<wsdl:operation name="echoInput">
39+
40+
<wsdl:input message="impl:echoInputRequest" name="echoInputRequest"/>
41+
42+
<wsdl:output message="impl:echoInputResponse" name="echoInputResponse"/>
43+
44+
</wsdl:operation>
45+
46+
</wsdl:portType>
47+
48+
<wsdl:binding name="PingPongSoapBinding" type="impl:PingPong">
49+
50+
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
51+
52+
<wsdl:operation name="echoInput">
53+
54+
<wsdlsoap:operation soapAction=""/>
55+
56+
<wsdl:input name="echoInputRequest">
57+
58+
<wsdlsoap:body use="literal"/>
59+
60+
</wsdl:input>
61+
62+
<wsdl:output name="echoInputResponse">
63+
64+
<wsdlsoap:body use="literal"/>
65+
66+
</wsdl:output>
67+
68+
</wsdl:operation>
69+
70+
</wsdl:binding>
71+
72+
<wsdl:service name="PingPongService">
73+
74+
<wsdl:port binding="impl:PingPongSoapBinding" name="PingPong">
75+
76+
<wsdlsoap:address location="http://157.159.110.224:9000/PingPong/services/PingPong"/>
77+
78+
</wsdl:port>
79+
80+
</wsdl:service>
81+
82+
</wsdl:definitions>

demo/wsimport-weather/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*~
2+
/.classpath
3+
/.gradle
4+
/.project
5+
/.settings
6+
/bin
7+
/build
8+
/target
9+
\#*\#

0 commit comments

Comments
 (0)