IntershopCommunicationsAG / wsdl-gradle-plugin

Apache License 2.0
9 stars 14 forks source link
build-automation gradle gradle-plugin

= WSDL Gradle Plugin :latestRevision: 3.0.0 :icons: font

NOTE: Version 3 of this plugin will only work with Gradle 6 and JDK 8.

== Summary This plugin generates Java code from WSDL files based on Apache Axis 1 (see http://axis.apache.org/axis/) or Apache Axis 2 (see http://axis.apache.org/axis2/java/core/).

== Usage To apply the WSDL Gradle Plugin to your projects, add the following in your build script:

++++

Groovy ++++ [source,groovy] [subs=+attributes] .build.gradle ---- plugins { id 'com.intershop.gradle.wsdl' version '{latestRevision}' } wsdl { axis1 { genNameAxis1 { wsdlFile = file('staticfiles/wsdl/axis1File.wsdl') serverSide = true namespacePackageMappings { soap { namespace = 'http://soapinterop.org/' packageName = 'samples.axis1' } soapxsd { namespace = 'http://soapinterop.org/xsd' packageName = 'samples.axis1' } } // more parameters are possible } } axis2 { genNameAxis2 { wsdlFile = file('staticfiles/wsdl/axis2File.wsdl') serverSide = true allPorts = true serviceDescription = true packageName = 'samples.axis2' databindingMethod = 'none' // more parameters are possible } } // set special JVM configuration parameter for code generation tasks of Axis1 tasks.withType(com.intershop.gradle.wsdl.tasks.axis1.WSDL2Java) { forkOptions { JavaForkOptions options -> options.setMaxHeapSize('64m') options.jvmArgs += ['-Dhttp.proxyHost=10.0.0.100', '-Dhttp.proxyPort=8800'] } } tasks.withType(om.intershop.gradle.wsdl.tasks.axis2.WSDL2Java) { forkOptions { JavaForkOptions options -> options.setMaxHeapSize('64m') options.jvmArgs += ['-Dhttp.proxyHost=10.0.0.100', '-Dhttp.proxyPort=8800'] } } ---- ++++

++++

++++

Kotlin ++++ [source,kotlin] [subs=+attributes] .build.gradle.kts ---- plugins { id("com.intershop.gradle.wsdl") version "{latestRevision}" } wsdl { axis1 { register("genNameAxis1") { wsdlFile = file("staticfiles/wsdl/axis1File.wsdl") serverSide = true namespacePackageMappings { soap { namespace = "http://soapinterop.org/" packageName = "samples.axis1" } soapxsd { namespace = "http://soapinterop.org/xsd" packageName = "samples.axis1" } } // more parameters are possible } } axis2 { register("genNameAxis2") { wsdlFile = file("staticfiles/wsdl/axis2File.wsdl") serverSide = true allPorts = true serviceDescription = true packageName = "samples.axis2" databindingMethod = "none" // more parameters are possible } } // set special JVM configuration parameter for code generation tasks of Axis1 tasks.withType(com.intershop.gradle.wsdl.tasks.axis1.WSDL2Java::class.java) { forkOptions { maxHeapSize = "64m" systemProperty("http.proxyHost", "10.0.0.100") systemProperty("http.proxyPort", "8800") } } tasks.withType(om.intershop.gradle.wsdl.tasks.axis2.WSDL2Java::class.java) { forkOptions { maxHeapSize = "64m" systemProperty("http.proxyHost", "10.0.0.100") systemProperty("http.proxyPort", "8800") } } } ---- ++++

++++ If the JavaBasePlugin is applied to the project, generated java sources will be added to the specified source set. Per default the main source set is used.

IMPORTANT: This plugin uses the version 1.4 of Axis 1 and 1.7.7 of Axis 2. It is possible to change or extend the configuration with special configurations.

== Tasks The WSDL Gradle plugin adds one task wsdl2java to the project. A special task is added for each configuration. The task wsdl2java depends on all other tasks.

[cols="25%,30%,45%", width="90%, options="header"] |=== |Task name | Type |Description |wsdl2java | Task | Overall wsdl2java code generation task of a project. This task depends on all axis1Wsdl2java and axis2Wsdl2java tasks. |axis1Wsdl2java | com.intershop.gradle.wsdl.tasks.axis1.WSDL2Java | This task generates Java code from WSDL file using Axis 1. |axis2Wsdl2java | com.intershop.gradle.wsdl.tasks.axis2.WSDL2Java | This task generates Java code from WSDL file using Axis 2. |===

== Project Extension 'wsdl' This plugin adds an extension wsdl to the project.

=== Methods [cols="20%,15%,65%", width="90%", options="header"] |=== |Method | Values | Description |axis1 | <<axis1, axis1>> | This contains all code generation configurations for Axis 1. |axis2 | <<axis2, axis2>> | This contains all code generation configurations for Axis 2. |===

==== [[axis1]]Object 'axis1' (com.intershop.gradle.wsdl.extension.Axis1)

===== Properties

[cols="25%,10%,10%,55%", width="90%, options="header"] |=== |Property | Type | Default value | Description | noImports | boolean | false | Only generate code for the WSDL document that appears on the command line if this value is true. The default behaviour is to generate files for all WSDL documents, the immediate one and all imported ones. + WSDL2Java Parameter: -n, --noImports | timeout | int | 240 | Timeout in seconds. The default is 240. Use -1 to disable the timeout. + WSDL2Java Parameter: -O, --timeout | noWrapped | boolean | false | If this value is true, it turns off the special treatment of what is called "wrapped" document/literal style operations. By default, WSDL2Java will recognize the following conditions: +

The default output dir is <project build dir>/generated/wsdl2java/axis1/<configuration name>

===== Methods

[cols="17%,17%,66%", width="90%, options="header"] |=== |Method | Parameter | Description |addAarg | String | Add an additional command line argument passed to the WSDL2Java command |addAargs | List<String> | Add additional command line arguments passed to the WSDL2Java command |===

==== [[axis1]]Object 'axis2' (com.intershop.gradle.wsdl.extension.Axis2)

===== Properties

[cols="25%,10%,10%,55%", width="90%, options="header"] |=== |Property | Type | Default value | Description | async | boolean | false | Generate code only for async style. When this option is used the generated stubs will have only the asynchronous invocation methods. Switched off by default. + WSDL2Java Parameter: -a, --async | sync | boolean | false | Generate code only for sync style. When this option is used the generated stubs will have only the synchronous invocation methods. Switched off by default. When async is set to true, this takes precedence. + WSDL2Java Parameter: -s, --sync | serverSide | boolean | false | Generates server side code (i.e. skeletons). + WSDL2Java Parameter: -ss, --server-side | serviceDescription | boolean | false | Generates the service descriptor (i.e. server.xml). Default is false. + Only valid if serverSide is true, the server side code generation option. + WSDL2Java Parameter: -sd, --service-description | databindingMethod | String | adb | Specifies the Databinding framework. Valid values are +

The default output dir is <project build dir>/generated/wsdl2java/axis2/<configuration name>

===== Methods

[cols="17%,17%,66%", width="90%, options="header"] |=== |Method | Parameter | Description |addAarg | String | Add an additional command line argument passed to the WSDL2Java command |addAargs | List<String> | Add additional command line arguments passed to the WSDL2Java command |===

== WSDL2Java Command Line Tool / Additonal Java VM configuration

The code generator task uses the WSDL2Java commandline tool of Axis 1 or Axis 2. It is possible to add additional environment variables to these JVM. See main example.

== Version Configuration for WSDL2Java tasks

This plugin adds two configurations wsdlAxis1 for Axis 1 and wsdlAxis2 for Axis 2. These dependencies are used for the classpath of WSDL command line tool.

=== Axis 1 The base configuration uses dependencies of Axis 1 with version 1.4.

[source,groovy] [subs=+attributes] .build.gradle

'axis:axis-wsdl4j:1.5.1' 'commons-discovery:commons-discovery:0.5' 'javax.activation:activation:1.1.1' 'javax.mail:mail:1.4.7' 'commons-logging:commons-logging:1.2' 'org.apache.axis:axis:1.4' 'org.apache.axis:axis-jaxrpc:1.4'

It is possible to change the configuration / version of the used dependencies.

=== Axis 2 The base configuration uses dependencies of Axis 1 with version 1.7.7

[source,groovy] [subs=+attributes] .build.gradle

'org.apache.axis2:axis2-kernel:1.7.7' 'org.apache.axis2:axis2-codegen:1.7.7' 'org.apache.axis2:axis2-adb:1.7.7' 'org.apache.axis2:axis2-adb-codegen:1.7.7' 'org.apache.axis2:axis2-jaxbri:1.7.7' 'com.sun.xml.ws:jaxws-tools:2.2.10' 'wsdl4j:wsdl4j:1.6.3' 'commons-logging:commons-logging:1.2' 'org.apache.neethi:neethi:3.0.3' 'org.apache.ws.commons.axiom:axiom-api:1.2.20' 'org.apache.ws.commons.axiom:axiom-impl:1.2.20' 'org.apache.woden:woden-core:1.0M10' 'org.apache.ws.xmlschema:xmlschema-core:2.2.1' 'com.sun.xml.bind:jaxb-impl:2.2.6' 'com.sun.xml.bind:jaxb-xjc:2.2.6'

It is possible to change the configuration or version of the used dependencies. This configuration is used for a different databinding 'XMLBeans'.

[source,groovy] [subs=+attributes] .build.gradle

configurations {
    wsdlAxis2.extendsFrom(compile)
}

dependencies {
    wsdlAxis2 'org.apache.axis2:axis2-codegen:1.7.3'
    wsdlAxis2 'wsdl4j:wsdl4j:1.6.3'
    wsdlAxis2 'commons-logging:commons-logging:1.2'
    wsdlAxis2 'org.apache.neethi:neethi:3.0.3'
    wsdlAxis2 'org.apache.ws.commons.axiom:axiom-api:1.2.20'
    wsdlAxis2 'org.apache.ws.commons.axiom:axiom-impl:1.2.20'
    wsdlAxis2 'org.apache.woden:woden-core:1.0M10'
    wsdlAxis2 'org.apache.ws.xmlschema:xmlschema-core:2.2.1'
}

== License

Copyright 2014-2018 Intershop Communications.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.