Skip to content

Instantly share code, notes, and snippets.

@gregbown
Last active March 17, 2023 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregbown/94b1127dddcd32a1eb512e0ae47b55d5 to your computer and use it in GitHub Desktop.
Save gregbown/94b1127dddcd32a1eb512e0ae47b55d5 to your computer and use it in GitHub Desktop.
Axis wsdl2java Java code generation from .wsdl
/**
* Address.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4.1-SNAPSHOT Mar 11, 2019 (00:47:30 UTC) WSDL2Java emitter.
*/
package com.projectname.webservice.generated;
public class Address implements java.io.Serializable {
. . .
public Address(
java.lang.String addr1,
java.lang.String addr2,
java.lang.String city,
java.lang.String state,
java.lang.String country,
java.lang.String zip) {
this.addr1 = addr1;
this.addr2 = addr2;
this.city = city;
this.state = state;
this.country = country;
this.zip = zip;
}
. . .
. . .
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Windows env var pointing to users github workspace -->
<!-- If your git clones are in C:\Users\uname\Documents, create windows env var name: GITHUB_ROOT value: C:\Users\uname\Documents -->
<gihub.root>${env.GITHUB_ROOT}</github.root>
. . .
<!-- AXIS 1.4.1 Requires adding repository http://repository.apache.org/snapshots to Maven settings.xml -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>wsdl2java-maven-plugin</artifactId>
<version>1.4.1-SNAPSHOT</version>
</dependency>
. . .
<plugins>
. . .
<!-- AXIS 1.4.1 See: https://axis.apache.org/axis/java/maven/wsdl2java/generate-sources-mojo.html -->
<!-- Note: Requires adding repository http://repository.apache.org/snapshots to Maven settings.xml -->
<plugin>
<groupId>org.apache.axis</groupId>
<artifactId>wsdl2java-maven-plugin</artifactId>
<version>1.4.1-SNAPSHOT</version>
<executions>
<execution>
<!-- The Maven phase you will use Run wsdl2java:generate-sources --debug --log-file ./axis-generate-sources.log -->
<id>generate-sources</id>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<!-- variable for external git directory on disc. Use <url> if external See: https://axis.apache.org/axis/java/maven/wsdl2java/generate-sources-mojo.html#url -->
<file>${github.root}/some-git-project/web-services/tpws/some.wsdl</file>
<generate>both</generate>
<mappings>
<mapping>
<!-- This value comes from the wsdl targetNamespace property -->
<namespace>urn:mybackend:Service</namespace>
<!-- This is the package you want the generated classes to reside in -->
<packageName>com.projectname.webservice.generated</packageName>
</mapping>
</mappings>
<!-- This tells axis to generate the classes in your java directory -->
<sourceOutputDirectory>src/main/java</sourceOutputDirectory>
</configuration>
</plugin>
</plugins>
. . .
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">
<localRepository>${env.USERPROFILE}/.m2/repository</localRepository>
<profiles>
<profile>
<id>default</id>
. . .
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>allow-snapshots</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
<!-- This allows you to use a non-https repo with latest version of Maven -->
<mirrors>
<mirror>
<id>apache-unblock</id>
<mirrorOf>external:http:*</mirrorOf>
<url>http://repository.apache.org/snapshots</url>
<blocked>false</blocked>
</mirror>
</mirrors>
</settings>
. . .
<wsdl:definitions
name="Service"
targetNamespace="urn:mybackend:Service"
. . .
<!-- example of mapping that will generate a class -->
<xsd:complexType name="Address">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="addr1" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="addr2" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="city" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="state" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="country" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="zip" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment