Creating Java proxy classes using JAX-WS

You can use JAX-WS to convert a LiveCycle service WSDL to Java proxy classes. These classes enable you to invoke LiveCycle services operations. Apache Ant lets you create a build script that generates Java proxy classes by referencing a LiveCycle service WSDL. You can generate JAX-WS proxy files by performing the following steps:

  1. Install Apache Ant on the client computer. (See http://ant.apache.org/bindownload.cgi.)

    • Add the bin directory to your class path.

    • Set the ANT_HOME environment variable to the directory where you installed Ant.

  2. Install JDK 1.6 or later.

    • Add the JDK bin directory to your class path.

    • Add the JRE bin directory to your class path. This bin is located in the [JDK_INSTALL_LOCATION]/jre directory.

    • Set the JAVA_HOME environment variable to the directory where you installed the JDK.

    JDK 1.6 includes the wsimport program used in the build.xml file. JDK 1.5 does not include that program.

  3. Install JAX-WS on the client computer. (See Java API for XML Web Services.)

  4. Use JAX-WS and Apache Ant to generate Java proxy classes. Create an Ant build script to accomplish this task. The following script is a sample Ant build script named build.xml:

    <?xml version="1.0" encoding="UTF-8"?> 
     
    <project basedir="." default="compile"> 
     
    <property name="port" value="8080" /> 
    <property name="host" value="localhost" /> 
    <property name="username" value="administrator" /> 
    <property name="password" value="password" /> 
    <property name="tests" value="all" /> 
     
    <target name="clean" > 
           <delete dir="classes" /> 
    </target> 
     
    <target name="wsdl" depends="clean"> 
           <mkdir dir="classes"/> 
           <exec executable="wsimport" failifexecutionfails="false" failonerror="true" resultproperty="foundWSIMPORT"> 
               <arg line="-keep -d classes http://${host}:${port}/soap/services/EncryptionService?wsdl&amp;lc_version=9.0.1"/> 
           </exec> 
           <fail unless="foundWSIMPORT"> 
              !!! Failed to execute JDK's wsimport tool. Make sure that JDK 1.6 (or later) is on your PATH !!! 
           </fail> 
    </target> 
     
    <target name="compile" depends="clean, wsdl" > 
         <javac destdir="./classes" fork="true" debug="true"> 
            <src path="./src"/> 
         </javac> 
    </target> 
     
    <target name="run"> 
         <java classname="Client" fork="yes" failonerror="true" maxmemory="200M"> 
            <classpath> 
              <pathelement location="./classes"/> 
            </classpath> 
            <arg value="${port}"/> 
            <arg value="${host}"/> 
            <arg value="${username}"/> 
            <arg value="${password}"/> 
            <arg value="${tests}"/> 
         </java> 
    </target> 
    </project>

    Within this Ant build script, notice that the url property is set to reference the Encryption service WSDL running on localhost. The username and password properties must be set to a valid LiveCycle user name and password. Notice that the URL contains the lc_version attribute. Without specifying the lc_version option, you cannot invoke new LiveCycle service operations.

    Hinweis: Replace EncryptionService with the LiveCycle service name that you want to invoke using Java proxy classes. For example, to create Java proxy classes for the Rights Management service, specify:
    http://localhost:8080/soap/services/RightsManagementService?WSDL&lc_version=9.0.1
  5. Create a BAT file to execute the Ant build script. The following command can be located within a BAT file that is responsible for executing the Ant build script:

    ant -buildfile "build.xml" wsdl

    Place the ANT build script in the C:\Program Files\Java\jaxws-ri\bin directory. The script writes the JAVA files to the ./classes folder. The script generates JAVA files that can invoke the service.

  6. Package the JAVA files into a JAR file. If you are working on Eclipse, follow these steps:

    • Create a new Java project that is used to package the proxy JAVA files into a JAR file.

    • Create a source folder in the project.

    • Create a com.adobe.idp.services package in the Source folder.

    • Select the com.adobe.idp.services package and then import the JAVA files from the adobe/idp/services folder into the package.

    • If necessary, create an org/apache/xml/xmlsoap package in the Source folder.

    • Select the source folder and then import the JAVA files from the org/apache/xml/xmlsoap folder.

    • Set the Java compiler’s compliance level to 5.0 or greater.

    • Build the project.

    • Export the project as a JAR file.

    • Import this JAR file in a client project’s class path. In addition, import all of the JAR files located in <Install Directory>\Adobe\Adobe LiveCycle ES4\sdk\client-libs\thirdparty.

    Hinweis: All Java web service quick starts (except for the Forms service) located in Programming with LiveCycle create Java proxy files using JAX-WS. In addition, all Java web service quick starts, use SwaRef. (See Invoking LiveCycle using SwaRef.)