You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

How to Configure a Maven pom.xml to consume web service WSDL

This document only addresses how to configure pom.xml for generating java code based on a published web service wsdl
during maven build. This is not a tutorial on how to use Maven.

PREREQUISITES

Before you begin, you must have the following:

  • an application certificate Java keystore.
    If you do not have an application certificate Java keystore, click here for instructions on how to create an application certificate Java keystore.
  • a trusted server Java keystore.
    If you do not have a Trusted Server Java keystore, click here for instructions on how to create a trusted server Java keystore.
  • the pom.xml configuration below has been verified to work with the Maven cli and with the Netbeans IDE.

1. The Configuration of pom.xml

To generate java code using the uaws web service WSDL, use the Maven maven-antrun-plugin and place following xml statements within the <plugins> element of the Maven project's pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>generate java code from wsdl</id>
            <phase>generate-sources</phase>
            <configuration>
                <tasks>
                    <property name="service.wsdl" value="https://mapws.mit.edu/uaws/services/ua?wsdl"/>
                    <property name="server.truststore" value="/path/to/keystore/<the name of your Trused Servers keystore>.jks" />
                    <property name="client.keystore" value="/path/to/keystore/<the name of your application certificate keystore>.jks." />
                    <property name="compile_classpath" refid="maven.compile.classpath" />
                    <java classname="org.apache.axis.wsdl.WSDL2Java" fork="true" classpathref="maven.compile.classpath" dir="src/main/java">
                        <sysproperty key="javax.net.ssl.keyStore" value="${client.keystore}" />
                        <sysproperty key="javax.net.ssl.keyStorePassword" value="<clientKeystorePassword>" />
                        <sysproperty key="javax.net.ssl.keyStoreType" value="jks"/>
                        <sysproperty key="javax.net.ssl.trustStore" value="${server.truststore}" />
                        <sysproperty key="javax.net.ssl.trustStorePassword" value="<trustStorePassword>" />
                        <sysproperty key="javax.net.ssl.trustStoreType" value="jks" />
                        <arg value="-v" />
                        <arg value="-o${basedir}/src/main/java" />
                        <arg value="${service.wsdl}" />
                    </java>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>
${renderedContent}
${renderedContent}
${renderedContent}
${renderedContent}
${renderedContent}
${renderedContent}
${renderedContent}

The following are the web service wsdl's that are currently available from DSPS:

${renderedContent}
${renderedContent}
${renderedContent}
${renderedContent}
  • No labels