Added: webservices/axis2/site/tools/1_4/CodegenToolReference.html URL: http://svn.apache.org/viewvc/webservices/axis2/site/tools/1_4/CodegenToolReference.html?rev=652665&view=auto ============================================================================== --- webservices/axis2/site/tools/1_4/CodegenToolReference.html (added) +++ webservices/axis2/site/tools/1_4/CodegenToolReference.html Thu May 1 14:20:27 2008 @@ -0,0 +1,1177 @@ + + + + + + + + + + + + + + + Maven - + + + + + + + +
+ +
+
+
+ Code Generator Tool Guide for Command Line and Ant +Task

Code Generator Tool Guide for Command Line and Ant Task

The Code Generator tool consists of a command line version and +an Ant Task. This document will list the command line references +and Ant task references. Also in detail, this document shows how to +build file using custom Ant task and invoking the Code Generator +from Ant.

+

This tool is bundled with the Axis2 Binary +Distribution +.

+

Content

+ +

Introduction

This basic tool is implemented by the WSDL2Code class and just +for the convenience in the case of Java (which would be the +majority) there is another WSDL2Java class. One can choose to run +the main classes directly or use one of the scripts to run the +WSDL2Code and WSDL2Java appropriately. (the scripts are found in +the bin directory of the Standard Binary +Distribution +)

+ +

Command Line Version

For those users who wish to use the command line version of the +tool, this section will be of value.

+ +

Option Reference

Usage WSDL2Code <option_reference>

+

E.g. :- WSDL2Code -uri <Location of WSDL> +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Short OptionLong OptionDescription
-uri <Location of WSDL>NoneWSDL file location. This should point to a WSDL +file in the local file system.
-o <output Location>--output <output Location>Output file location. This is where the files would +be copied once the code generation is done. If this option is +omitted the generated files would be copied to the working +directory.
-l <language>--language <language>Output language. Currently the code generator can +generate code in Java but it has the ability to be extended to +support other languages.
-p <package name>--package <package name>The target package name. If omitted, a default +package (formed using the target namespace of the WSDL) will be +used.
-a--asyncGenerate code only for async style. When this +option is used the generated stubs will have only the asynchronous +invocation methods. Switched off by default.
-s--syncGenerate 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 used with the -a +option, this takes precedence.
-t--test-caseGenerates a test case. In the case of Java it would +be a JUnit test case.
-ss--server-sideGenerates server side code (i.e. skeletons). +Default is off.
-sd--service-descriptionGenerates the service descriptor (i.e. server.xml). +Default is off. Only valid with -ss, the server side code +generation option.
-d <databinding>--databinding-method <databinding>Specifies the Databinding framework. Valid values +are xmlbeans, adb, jibx, and none. Default is adb.
-g--generate-allGenerates all the classes. This option is valid +only with the -ss (server side code generation) option. When on, +the client code (stubs) will also be generated along with the +skeleton.
-u--unpack-classesUnpack classes. This option specifies whether to +unpack the classes and generate separate classes for the +databinders.
-sn <service name>--service-name <service name>Specifies the service name to be code generated. If +the service name is not specified, then the first service will be +picked.
-pn <port name>--port-name <port name>Specifies the port name to be code generated. If +the port name is not specified, then the first port (of the +selected service) will be picked.
-ns2p--namespace2packageSpecifies a comma separated list of namespaces and +packages where the given package will be used in the place of the +auto generated package for the relevant namespace. The list will be +the format of ns1=pkg1,ns2=pkg2.
-ssi--serverside-interfaceGenerate an interface for the service +skeleton.
-wv--wsdl-versionWSDL Version. Valid Options : 2, 2.0, 1.1
-S--source-folderSpecify a directory path for generated source
-R--resource-folderSpecify a directory path for generated resources
-em--external-mappingSpecify an external mapping file
-f--flatten-filesFlattens the generated files
-uw--unwrap-paramsSwitch on un-wrapping
-xsdconfigUse XMLBeans .xsdconfig file. Valid only with -d xmlbeans
-ap--all-portsGenerate code for all ports
-or--over-rideOverwrite the existing classes
-b--backword-compatibleGenerate Axis 1.x backword compatible code
-sp--suppress-prefixesSuppress namespace prefixes (Optimzation that reduces size of soap request/response)
--noBuildXMLDon't generate the build.xml in the output directory
--noWSDLDon't generate WSDL's in the resources directory
--noMessageReceiverDon't generate a MessageReceiver in the generated sources
+

Apart from these mentioned options one can pass extra options by +prefixing them with -E (uppercase). These extra options will be +processed by the extensions. The extra options that can be passed +are documented separately with the extensions documentation (For +example with ADB).

+ +

Ant Task

The code generator also comes bundled with an Ant task. The ant +task is implemented by the org.apache.axis2.tool.ant.AntCodegenTask +class. Following are the ant task attributes.

+ +

Ant Task Reference

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
wsdlfilenameWSDL file location. Maps to the -uri option of the command line +tool.
outputOutput file location. This is where the files would be copied +once the code generation is done. If this option is omitted the +generated files would be copied to the working directory. Maps to +the -o option of the command line tool.
languageOutput language. Currently the code generator can generate code +in Java. Maps to the -l option of the command line tool.
packageNameThe target package name. If omitted, a default package (formed +using the target namespace of the WSDL) will be used. Maps to the +-p option of the command line tool.
databindingNameData binding framework name. Maps to the -d option of the +command line tool. Possible values include "adb", "xmlbeans", +"jibx".
serviceNameThe name of the service in the case of multiple services. Maps +to -sn options of the command line tool.
portNameThe name of the port in the presence of multiple ports. Maps to +-pn options of the command line tool.
asyncOnlyGenerate code only for async style. When this option is used +the generated stubs will have only the asynchronous invocation +methods. Defaults to false if omitted. Only true and false are +applicable as values. Maps to the -a option of the command line +tool.
syncOnlyGenerate code only for sync style. When this option is used the +generated stubs will have only the synchronous invocation methods. +Defaults to false if omitted. Only true and false are applicable as +values. Maps to the -s option of the command line tool.
serverSideGenerates server side code (i.e. skeletons). Only true and +false are applicable as values. Default is false. Maps to the -ss +option of the command line tool.
testcaseGenerates a test case. Possible values are true and false. Maps +to the -t options of the command line tool.
generateServiceXmlGenerates server side code (i.e. skeletons). Only true and +false are applicable as values. Default is false. Maps to the -sd +option of the command line tool.
unpackClassesUnpacks the generated classes. This forces the databinding +classes to be generated separately, which otherwise would have been +generated as inner classes.
generateAllClassesGenerates all the classes including client and server side +code. Maps to the -g option of the command line tool.
namespaceToPackagesA list of namespace to package mappings.
serverSideInterfaceFlag stating whether to generate an interface for the server +side skeleton.
repositoryPathSets the repository path to be used. Maps to the -r option of +the command line tool.
wsdlVersionSets the version of the wsdl that is being used during +codegeneration. This deafults to 1.1 and one can set this to 2, +when trying to work with a WSDL 2.0 document. Maps to the -wv +option of the command line tool.
externalMappingLocation of the external mapping file to be used. Maps to the +-em option of the command line tool.
targetSourceFolderLocationRather than dumping all the code in the same location, one has +the option to make the sources to be generated in a different +location, given using this option. Maps to the -S option of the +command line tool.
targetResourcesFolderLocationRather than dumping all the code in the same location, one has +the option to make the resources to be generated in a different +location, given using this option. Maps to the -R option of the +command line tool.
unwrapThis will select between wrapped and unwrapped during code +generation. Default is set to false. Maps to the -uw option of the +command line tool.
+ +

Example Build File Using the Custom Ant Task

Following is an example ant build file that uses the custom Ant +task. You can use any wsdl file to test the example. Replace the +"CombinedService.wsdl" with the name of your wsdl file in the +following script.

+
+1 <?xml version="1.0"?>
+    2 <project name="CodegenExample" default="main" basedir=".">
+    3
+    4 <path id="example.classpath">
+    5 <fileset dir="classes">
+    6 <include name="**/*.jar" />
+    7 </fileset>
+    8 </path>
+    9
+    10 <target name="declare" >
+    11 <taskdef name="codegen"
+    12 classname="org.apache.axis2.tool.ant.AntCodegenTask"
+    13 classpathref="example.classpath"/>
+    15 </target>
+    16
+    17 <target name="main" depends="declare">
+    18 <codegen
+    19 wsdlfilename="C:\test\wsdl\CombinedService.wsdl"
+    20 output="C:\output"
+    21 serverside="true"
+    22 generateservicexml="true"/>
+    23 </target>
+    24
+    25 </project>
+

In the above build script, from line 4 to 8 it sets the +classpath and includes all the .jar files (which are listed below) +into the classpath. From line 10 to 15 it creates a target to +declare a task called "codegen" and sets the appropriate class +(org.apache.axis2.tool.ant.AntCodegenTask) within the classpath in +line 12. From line 17 to 23 it creates the "main" target to +generate the code from the given wsdl. There are some arguments set +form line 19 to 22. Here in line 19 it sets the location of the +wsdl. In line 20 it sets the output directory in which the code is +generated. Line 21 indicates that this build generates the server +side code(skeleton) and line 22 indicates that the services.xml is +also generated.

+

Notice the main target that uses the "codegen" task which will +use the org.apache.axis2.tool.ant.AntCodegenTask class and run the +code generation tool internally while passing the relevant +arguments and do the proper generation. If a user types

+

>ant or >ant main

+

it will generate the server side code and services.xml for the +given WSDL file (C:\test\wsdl\CombinedService.wsdl -in the above +instance) and the generated code will be written to the specified +output path (C:\output - in the above instance).

+

For this Ant task to work the following jars need to be in the +class path.

+ + +

Invoking the Code Generator From Ant

Since the users may find altering their ant class path a bit +daunting they can also follow an easier technique. The code +generator main class can be invoked directly through the build +file.

+

Below is an example of a full build.xml needed to run WSDL2Java +and generate the Java source files, compile the sources, and build +an AAR file ready for deployment (These are done one by one, by +calling the targets in the build file separately):

+
+<!DOCTYPE project>
+
+<project name="wsdl2java-example" default="usage" basedir=".">
+
+<property name="project-name" value="wsdl2java-example"/>
+<property file="build.properties"/>
+
+<property name="build" value="build"/>
+<property name="src" value="src"/>
+<property name="build.classes" value="build/classes" />
+
+<path id="axis.classpath">
+<pathelement location="build/classes" />
+<fileset dir="${axis.home}/lib">
+<include name="**/*.jar" />
+</fileset>
+<pathelement location="${build.classes}" />
+</path>
+
+<path id="axis_client.classpath">
+<pathelement location="build/classes" />
+<fileset dir="${axis.home}">
+<include name="**/*.jar" />
+</fileset>
+<fileset dir="lib">
+<include name="*.jar" />
+</fileset>
+<pathelement location="${build.classes}" />
+</path>
+
+<target name="usage" description="Build file usage info (default task)">
+<echo message=" " />
+<echo message="${project-name} " />
+<echo message="-------------------------------------------------------" />
+<echo message=" " />
+<echo message="Available Targets:" />
+<echo message=" " />
+<echo message=" Compiling:" />
+<echo message=" compile - Compiles the WSDL2Java source code" />
+<echo message=" " />
+<echo message=" Compiling client:" />
+<echo message=" compile_client - Compiles the client source code" />
+<echo message=" " />
+<echo message=" Cleaning up:" />
+<echo message=" clean - Delete class files" />
+<echo message=" " />
+<echo message=" WSDL:" />
+<echo message=" wsdl2java - Generate source from WSDL" />
+<echo message=" " />
+<echo message=" AAR:" />
+<echo message=" aar - Generate an .aar for deployment into WEB-INF/services" />
+<echo message=" " />
+<echo message=" Executing:" />
+<echo message=" runLogin - Execute the runLogin client" />
+</target>
+
+<target name="prepare" >
+<mkdir dir="${build.classes}" />
+</target>
+
+<target name="clean" >
+<delete dir="${build}" />
+<delete dir="${dist}" />
+</target>
+
+<target name="compile">
+<echo message="Compiling wsdl2 files"/>
+
+<javac
+srcdir="output"
+destdir="${build.classes}"
+deprecation="true"
+failonerror="true" debug="true">
+
+<classpath refid="axis.classpath"/>
+</javac>
+
+</target>
+
+<target name="wsdl2java" depends="clean,prepare">
+<delete dir="output" />
+<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+<classpath refid="axis.classpath"/>
+<arg value="-d"/>
+<arg value="xmlbeans"/>
+<arg value="-uri"/>
+<arg file="wsdl/LoginEndpoint.wsdl"/>
+<arg value="-ss"/>
+<arg value="-g"/>
+<arg value="-sd"/>
+<arg value="-o"/>
+<arg file="output"/>
+<arg value="-p"/>
+<arg value="org.example.types"/>
+</java>
+
+<!-- Move the schema folder to classpath-->
+<move todir="${build.classes}">
+<fileset dir="output/resources">
+<include name="**/*schema*/**/*.class"/>
+<include name="**/*schema*/**/*.xsb"/>
+</fileset>
+</move>
+
+</target>
+
+<target name="jar_wsdl" depends="compile">
+<jar jarfile="lib/axis2_example_wsdl.jar" >
+<fileset dir="${build.classes}" />
+</jar>
+</target>
+
+<!-- build an .aar file for axis2 web services -->
+<target name="aar" depends="compile">
+<delete dir="${build.classes}/META-INF" />
+<mkdir dir="${build.classes}/META-INF" />
+<copy todir="${build.classes}/META-INF" >
+<fileset dir="output/resources" >
+<!-- axis2 web services definitions file -->
+<include name="services.xml"/>
+</fileset>
+<fileset dir="wsdl" >
+<include name="LoginEndpoint.wsdl"/>
+</fileset>
+</copy>
+<jar jarfile="dist/LoginEndpoint.aar" >
+<fileset dir="${build.classes}" />
+</jar>
+</target>
+
+<target name="compile_client">
+<echo message="Compiling client files"/>
+
+<javac
+srcdir="src"
+destdir="${build.classes}"
+deprecation="true"
+failonerror="true" debug="true">
+
+<classpath refid="axis.classpath"/>
+</javac>
+
+</target>
+
+<target name="runLogin" depends="prepare,compile_client" description="run simple Login client">
+<java classname="org.client.LoginClient" >
+<classpath refid="axis_client.classpath"/>
+</java>
+</target>
+
+</project>
+

Place the above build.xml file in the 'bin' directory of the +axis2 binary distribution. Then create a build.properties file in +the same directory and specify the axis.home path pointing to the +axis2 binary distribution

+

E.g. :- axis.home=C://Axis2//axis2-1.1-bin

+

The above build.xml example also assumes three empty directories +exist, 'dist', 'lib', and 'src'.

+

Below is a validated WSDL Document following the +Document/Literal Style. The name of this file matches the name used +in the WSDL2Java ant task above, LoginEndpoint.wsdl.

+
+<?xml version="1.0" encoding="UTF-8"?>
+
+    <definitions name="LoginService" targetNamespace="http://login" xmlns:tns="http://login"
+    xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns2="http://login/types">
+
+    <types>
+    <schema targetNamespace="http://login/types" xmlns:tns="http://login/types"
+    xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns="http://www.w3.org/2001/XMLSchema">
+    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
+    <element name="returnWebLoginElement">
+    <complexType>
+    <sequence>
+
+    <element ref="tns:soap_session_idElement"/>
+    <element ref="tns:web_user_nameElement"/>
+    </sequence>
+    </complexType>
+    </element>
+    <element name="webLoginElement">
+
+    <complexType>
+    <sequence>
+    <element ref="tns:user_nameElement"/>
+    <element ref="tns:user_passwordElement"/>
+    </sequence>
+    </complexType>
+
+    </element>
+    <element name="user_nameElement" type="xsd:string"/>
+    <element name="user_passwordElement" type="xsd:string"/>
+    <element name="soap_session_idElement" type="xsd:string"/>
+    <element name="web_user_nameElement" type="xsd:string"/>
+    </schema></types>
+
+    <message name="LoginEndpoint_webLogin">
+    <part name="parameters" element="ns2:webLoginElement"/>
+    </message>
+    <message name="LoginEndpoint_webLoginResponse">
+    <part name="result" element="ns2:returnWebLoginElement"/>
+    </message>
+
+    <portType name="LoginEndpoint">
+    <operation name="webLogin">
+    <input message="tns:LoginEndpoint_webLogin" name="LoginEndpoint_webLogin"/>
+    <output message="tns:LoginEndpoint_webLoginResponse" name="LoginEndpoint_webLoginResponse"/>
+    </operation>
+    </portType>
+
+    <binding name="LoginEndpointBinding" type="tns:LoginEndpoint">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+    <operation name="webLogin">
+    <soap:operation soapAction="webLogin"/>
+    <input name="LoginEndpoint_webLogin">
+    <soap:body use="literal"/>
+
+    </input>
+    <output name="LoginEndpoint_webLoginResponse">
+    <soap:body use="literal"/>
+    </output>
+    </operation>
+    </binding>
+
+    <service name="LoginService">
+    <port name="LoginEndpointPort" binding="tns:LoginEndpointBinding">
+    <soap:address location="http://localhost:8080/axis2/services/LoginService"/></port>
+    </service></definitions>
+

Place the above file, named LoginEndpoint.wsdl, in the directory +'wsdl' which is also inside the 'bin' directory. Run the wsdl2java +command via the ant task defined above (>ant wsdl2java), and +there will be a directory called 'output' created. This directory +contains the WSDL2Java generated source.

+

An important detail is that an XMLBean class file is also +generated by WSDL2Java, TypeSystemHolder.class. That file is placed +into build/classes by the above ant task and will be needed to +compile the generated sources. A frequent problem is users get an +error such as:

+

ClassNotFoundException : Cannot load SchemaTypeSystem. +Unable to load class with name +schemaorg_apache_xmlbeans.system.s68C41DB812F52C975439BA10FE4FEE54.TypeSystemHolder. +Make sure the generated binary files are on the +classpath. +

+

The TypeSystemHolder.class generated by WSDL2Java must be placed +in your classpath in order to avoid this error.

+

The next step is to modify the generated Skeleton Java Source +file - the Web service. This file as generated returns null and +needs to be updated to contain the business logic.

+

After the WSDL2Java command runs the file LoginEndpoint.wsdl, +edit the following file:

+

output/src/org/example/types/LoginServiceSkeleton.java. You +should see the following code:

+
+/**
+    * LoginServiceSkeleton.java
+    *
+    * This file was auto-generated from WSDL
+    * by the Apache Axis2 version: 1.0-RC4 Apr 28, 2006 (05:23:23 IST)
+    */
+    package org.example.types;
+    /**
+    * LoginServiceSkeleton java skeleton for the axisService
+    */
+    public class LoginServiceSkeleton {
+
+
+    /**
+    * Auto generated method signature
+
+    * @param param0
+
+    */
+    public login.types.ReturnWebLoginElementDocument webLogin
+    (login.types.WebLoginElementDocument param0 )
+
+    {
+    //Todo fill this with the necessary business logic
+    throw new java.lang.UnsupportedOperationException();
+    }
+
+    }
+

Replace the contents of this file with the following, which uses +the complex types generated by WSDL2Java and the example wsdl +file:

+
+/**
+    * LoginServiceSkeleton.java
+    *
+    * This file was auto-generated from WSDL
+    * by the Apache Axis2 version: 1.0-RC4 Apr 28, 2006 (05:23:23 IST)
+    */
+    package org.example.types;
+    import login.types.ReturnWebLoginElementDocument;
+    import login.types.ReturnWebLoginElementDocument.*;
+    import login.types.WebLoginElementDocument;
+    import login.types.WebLoginElementDocument.*;
+
+    /**
+    * Auto generated java skeleton for the service by the Axis code generator
+    */
+    public class LoginServiceSkeleton {
+
+    /**
+    * Auto generated method signature
+
+    * @param webLoginElementDocument changed from param0
+
+    */
+    public ReturnWebLoginElementDocument webLogin
+    (WebLoginElementDocument webLoginElementDocument ){
+
+    //Todo fill this with the necessary business logic
+    System.out.println("LoginServiceSkeleton.webLogin reached successfully!");
+
+    // Get parameters passed in
+    WebLoginElement webLoginElement = webLoginElementDocument.getWebLoginElement();
+    String userName = webLoginElement.getUserNameElement();
+    String password = webLoginElement.getUserPasswordElement();
+    System.out.println("LoginServiceSkeleton.webLogin userName: " + userName);
+    System.out.println("LoginServiceSkeleton.webLogin password: " + password);
+
+    // input paramaters would be used here
+
+    // prepare output
+    ReturnWebLoginElementDocument retDoc =
+    ReturnWebLoginElementDocument.Factory.newInstance();
+
+    ReturnWebLoginElement retElement = ReturnWebLoginElement.Factory.newInstance();
+
+    retElement.setWebUserNameElement("joe sixpack");
+    retElement.setSoapSessionIdElement("some_random_string");
+    System.out.println("validate retElement: " + retElement.validate());
+
+    retDoc.setReturnWebLoginElement(retElement);
+    System.out.println("validate retDoc: " + retDoc.validate());
+
+    System.out.println("LoginServiceSkeleton.webLogin returning...");
+
+    return retDoc;
+
+    }
+    }
+

The next steps assume the axis2.war has been deployed and has +expanded in a servlet container.

+

Run the 'jar_wsdl' ant task from the example build.xml (>ant +jar_wsdl), which generates a jar file axis2_example_wsdl.jar in the +'bin/lib' directory. This jar will be used to compile the client, +and also will be placed in the servlet container.

+

Next, run the 'aar' ant task from the example build.xml (>ant +aar), which generates the deployable axis2 Web service. Place +dist/LoginEndpoint.aar into axis2/WEB-INF/services . Place +lib/axis2_example_wsdl.jar into axis2/WEB-INF/lib . Verify the +happy axis page loaded the services correctly - there should be the +service 'LoginEndpoint' with the available operation 'webLogin' +displayed.

+

The last step is to create and run the client. In the src +directory create the file org.client.LoginClient.java, with the +contents below:

+
+package org.client;
+
+    import org.apache.axis2.AxisFault;
+
+    import login.types.ReturnWebLoginElementDocument;
+    import login.types.ReturnWebLoginElementDocument.*;
+    import login.types.WebLoginElementDocument;
+    import login.types.WebLoginElementDocument.*;
+    import org.example.types.LoginServiceStub;
+
+    /**
+    * Login.
+    *
+    */
+    public class LoginClient {
+
+    public static void main(String[] args) {
+    try {
+
+    System.out.println("webLogin, firing...");
+    LoginServiceStub stub = new LoginServiceStub();
+
+    WebLoginElementDocument webLoginElementDocument
+    = WebLoginElementDocument.Factory.newInstance();
+    WebLoginElement webLoginElement =
+    WebLoginElement.Factory.newInstance();
+    webLoginElement.setUserNameElement("joe");
+    webLoginElement.setUserPasswordElement("sixpack");
+
+    webLoginElementDocument.setWebLoginElement(webLoginElement);
+
+    System.out.println("validate: " + webLoginElement.validate());
+    stub.webLogin(webLoginElementDocument);
+
+    ReturnWebLoginElementDocument returnWebLoginElementDocument =
+    stub.webLogin(webLoginElementDocument);
+
+    System.out.println("Client returned");
+
+    ReturnWebLoginElementDocument.ReturnWebLoginElement
+    retElement = returnWebLoginElementDocument.getReturnWebLoginElement();
+
+    System.out.println("WebUserName: " + retElement.getWebUserNameElement());
+    System.out.println("SOAPSessionId: " + retElement.getSoapSessionIdElement());
+    System.out.println("webLogin, completed!!!");
+
+    } catch (AxisFault axisFault) {
+    axisFault.printStackTrace();
+    } catch (Exception ex) {
+    ex.printStackTrace();
+    }
+    }
+    }
+

Now run the ant task 'runLogin' (>ant runLogin). The +following output should appear:

+
+runLogin:
+    [echo] running the webLogin client
+    [java] webLogin, firing...
+    [java] validate: true
+    [java] Client returned
+    [java] WebUserName: joe sixpack
+    [java] SOAPSessionId: some_random_string
+    [java] webLogin, completed!!!
+
+

Appendix

+ +
+
+
+
+
+ + + Added: webservices/axis2/site/tools/1_4/eclipse/servicearchiver-plugin.html URL: http://svn.apache.org/viewvc/webservices/axis2/site/tools/1_4/eclipse/servicearchiver-plugin.html?rev=652665&view=auto ============================================================================== --- webservices/axis2/site/tools/1_4/eclipse/servicearchiver-plugin.html (added) +++ webservices/axis2/site/tools/1_4/eclipse/servicearchiver-plugin.html Thu May 1 14:20:27 2008 @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + Maven - + + + + + + + +
+ +
+
+
+ Service Archive Generator Wizard Guide for Eclipse +Plug-in

Service Archive Generator Wizard Guide for Eclipse Plug-in

This document will guide you through the installation and usage +of the archive generator Eclipse plug-in.

+

[Download Plugin Tool] +

+

Content

+ +

Introduction

As part of the Axis2 tool set, the service archive generator is +an important tool that allows the generation of service archives +("aar" file or a "jar" files) that can be deployed as a web +services to the Axis2.

+ +

Installation

One can easily download + the +plugin

+

If one needs to build the plug-in from source, Maven2 and Ant +builds arevailabe. Please refer the readme.txt located at +module/tools on Axis2 source.

+

Once you've obtained the plug-in just unzip the content of the +plug-in archive to the Eclipse plug-in directory (if it is the +zipped-binary version) or copy the necessary folders to the Eclipse +plug-in directory and restart Eclipse.

+

NOTE : This plug-in works on Eclipse version +3.1 and upwards, also the java version should be 1.4 or higher. The +provided screen shots may slightly differ with what the user would +actually see but the functionality has not been changed.

+ +

Operation

If the plug-in is properly installed you should see a new wizard +under the "New" section. (Use the File -> New -> Other or +Ctrl + N )

+

+

Selecting the wizard and pressing the "Next" button will start +the service generator wizard. Following is the first page of the +wizard.

+

Page 1:

+

+

Once the class file folder(which should be a folder in the +file system) is browsed and selected, the "Next" button will be +enabled and you can move to the next page. Note that you have the +option of either including all the files or the class files only of +the folder on page 1.

+

Page 2:

+

Page 2 of the wizard as seen below requires you to locate/browse +the WSDL file. If you do not wish to add a WSDL file to the service +archive, select skip WSDL, else you can select the location of the +WSDL file by selecting the select WSDL option.

+

+

Page 3:

+

Select the services.xml file on this wizard page by browsing or +select the option of generating service xml automatically, after +which you can click "Next" button to go to the next page. Notice +how the browsing option disables when the "Generate service xml +automatically" check box is ticked.

+

+

Page 4:

+

The next step is to add the libraries. The library addition page +looks like this :

+

+

The library name (with full path) can be either typed on the +text box or browsed for using the "Browse" button.

+

+

Once there is a library name with full path on the text box, hit +the "Add" button to add the library to the list. Added libraries +should be displayed in the "Added libraries" list box. This way you +can add as many external libraries as you wish. See the screen +shots below.

+

+

+

If any added library needs to be removed, highlight it or in +other words, select it from the "Added libraries" list and hit on +the "Remove" button as shown below. Click on the "Next" button to +proceed to the last page of the wizard if the user did not select +to auto generate the services.xml file. If user select to auto +generate the services.xml file then the services.xml option page +will be displayed.

+

+

Page 5:

+

This page only appears if the user select to generate the +services.xml at page 3 of the wizard. If the user have selected a +services.xml then the user will be directed to the last page of the +wizard.

+

After entering the correct service name and valid fully +qualified class name, try to load the existing methods of that +class by clicking the load button.

+

+

If successfully loaded the user will be presented with a table +at the bottom of the page with the details of the loaded class. By +checking and unchecking the user can select the necessary methods +to include in the services.xml

+

+

By clicking on the search declared method only check box, the +user can remove the inherited methods from the class. Click on the +"Next" button to proceed to the last page of the wizard

+

+

Page 6:

+

The last page of the wizard asks for the output file location +and the output archive file name. To be able to finish the wizard, +user must enter valid output file location and output file +name.

+

+

Once all the parameters are filled, hit the "Finish" button to +complete the wizard and generate the service archive.

+

+

If you see the above message, then you've successfully generated +the service archive! This service archive can be hot deployed +(deployed at run time) to the axis2

+

Appendix

+ +
+
+
+
+
+ + + Added: webservices/axis2/site/tools/1_4/eclipse/wsdl2java-plugin.html URL: http://svn.apache.org/viewvc/webservices/axis2/site/tools/1_4/eclipse/wsdl2java-plugin.html?rev=652665&view=auto ============================================================================== --- webservices/axis2/site/tools/1_4/eclipse/wsdl2java-plugin.html (added) +++ webservices/axis2/site/tools/1_4/eclipse/wsdl2java-plugin.html Thu May 1 14:20:27 2008 @@ -0,0 +1,443 @@ + + + + + + + + + + + + + + + Maven - + + + + + + + +
+ +
+
+
+ Code Generator Wizard Guide for Eclipse Plug-in

Code Generator Wizard Guide for Eclipse Plug-in

This document explains the usage of this code generator plug-in +for Eclipse. In other words, this document will guide you through +the operations of generating a WSDL file from a Java class and/or +generating a Java class file from a WSDL file.

+

[Download Plugin Tool] +

+

Content

+ +

Introduction

The Axis2 code generator comes built-in with an Eclipse + plug-in. This plug-in can be +used to generate a WSDL file from a java class (Java2WSDL) and/or a +java class file from a WSDL (WSDL2Java). First you need to install +the plug-in. The instructions for the installation process are +given below.

+ +

Installation

One can easily download + the +plugin

+

If one needs to build the plug-in from source, Maven2 and Ant +builds arevailabe. Please refer the readme.txt located at +module/tools on Axis2 source.

+

Once you've obtained the plug-in just unzip the content of the +plug-in archive to the Eclipse plug-in directory (if it is the +zipped-binary version) or copy the necessary folders to the Eclipse +plug-in directory and restart Eclipse.

+

NOTE : This plug-in works on Eclipse version +3.1 and upwards, also the java version should be 1.4 or higher. The +provided screen shots may slightly differ with what the user would +actually see but the functionality has not been changed.

+ +

Operation - WSDL2Java

If the plug-in is properly installed you should see a new wizard +under the "New" section.(use the File -> New -> Other or Ctrl ++ N )

+

+

Selecting the wizard and pressing the "Next" button will start +the code generator wizard. Following is the first wizard page.

+

Page 1:

+

+

Selecting the "Generate Java source code from WSDL file" option +and clicking "Next" leads to the following page.

+

WSDL2Java Page 2 :

+

+

To move on to the next page the WSDL file location must be +given. The "Browse" button can be used to easily browse for a file +rather than typing the whole path.

+

WSDL2Java Page 3 :

+

Once the WSDL file is selected, the next page will take you to +the page from where codegen options are to be +selected. By far this is the most important page in this wizard. +This page determines the characteristics of the code being +generated.

+

Novices need not worry about these options since the most common +options are defaulted, but advanced users will find it very easy to +turn the knobs using these options.

+

+

What advanced users can do is select custom from the select +codegen options drop down list and then change/edit the fields that +you need.

+

+

Once the options are selected, only the final step of the code +generation is left which is the selection of the output file +location.

+

WSDL2Java Page 4 :

+

Here you can select the output file path by typing or browsing +using the "Browse" button. You have the option of browsing only +eclipse workspace projects by selecting the "Add the source to a +project on current eclipse workspace" radio button. Or else you +have the option to save the codegen resutls to file system

+

+

Here also you have the option to add some value to the codegen +results. If you have enabled the check box "Add Axis2 libraries to +the codegen result project" then all other controls below will get +enabled. What you can do is point the downloaded Axis2_HOME +location via the "Browse" button. Then you can verify the +availability of the Axis2 libs by clicking on the "Check Libs" +button. If all goes well then you can add the axis 2 libs to the +codegen results location. Another option is available to generate a +jar file if the user needs to add the codegen results to a project +as a compiled jar file to the selected locations lib directory.

+

+

When the output file location is selected, the "Finish" button +will be enabled. Clicking the "Finish" button will generate the +code and a message box will pop up acknowledging the success. Well +Done! You've successfully completed Axis2 code generation.

+ +

Operation - Java2WSDL

Page 1:

+

For this operation you need to select the option which says +"Generate a WSDL from a Java source file"

+

+

Then click the "Next" button which will lead to the next page +below.

+

Java2WSDL Page 2:

+

+

In this page one needs to select the class to be exposed and the +relevant jar files /classes to be loaded as the classpath. After +the libraries have been set, the "Test Class Loading" button must +be clicked in order to test whether the class is loadable. Unless +the class loading is successful proceeding to the "Next" button +will not be enabled.

+

Once the classloading is successful and "Next" button is clicked +the page below will appear.

+

Java2WSDL Page 3:

+

This page allows the parameters to be modified by setting the +options for the generator.

+

+

Java2WSDL Page 4:

+

Here you can select the output file path by typing or browsing +using the "Browse" button. You have the option of browsing only +Eclipse workspace projects by selecting the "Add the source to a +project on current eclipse workspace" radio button . Or else you +have the option to save the codegen resutls to file system. Once +the output file location and the output WSDL file name is added you +can click the "Finish" button to complete generation.

+

+

If a message box pops up acknowledging the success, then you've +successfully completed the Java2WSDL code generation.

+

Appendix

+ +
+
+
+
+
+ + + --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org