You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/04/20 15:19:14 UTC
svn commit: r395583 [1/2] - in /webservices/axis2/trunk/java/xdocs/latest:
CodegenToolReference.html WS_policy.html index.html userguide.html
webadminguide.html
Author: chatra
Date: Thu Apr 20 06:18:46 2006
New Revision: 395583
URL: http://svn.apache.org/viewcvs?rev=395583&view=rev
Log:
made updates & imprvements
Modified:
webservices/axis2/trunk/java/xdocs/latest/CodegenToolReference.html
webservices/axis2/trunk/java/xdocs/latest/WS_policy.html
webservices/axis2/trunk/java/xdocs/latest/index.html
webservices/axis2/trunk/java/xdocs/latest/userguide.html
webservices/axis2/trunk/java/xdocs/latest/webadminguide.html
Modified: webservices/axis2/trunk/java/xdocs/latest/CodegenToolReference.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/latest/CodegenToolReference.html?rev=395583&r1=395582&r2=395583&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/latest/CodegenToolReference.html (original)
+++ webservices/axis2/trunk/java/xdocs/latest/CodegenToolReference.html Thu Apr 20 06:18:46 2006
@@ -1,740 +1,766 @@
-<html>
-<head>
- <meta http-equiv="content-type" content="">
- <title>Code Generator-Command Line Tool</title>
-</head>
-
-<body>
-<h1>Code Generator - Command Line Tool</h1>
-
-<h2>Introduction</h2>
-
-<p>Just as old times there will be users who wish to use the command line
-version of the tool. This basic tool is implemented by the WSDL2Code class
-and just for the convenience in the java case (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 binary
-distribution)</p>
-
-<h2>Option Reference</h2>
-
-<table border="1" cellpadding="0" cellspacing="0"
-style="border-collapse: collapse" width="100%" id="AutoNumber1">
- <tbody>
- <tr>
- <td width="20%"><strong>Short Option</strong></td>
- <td width="20%"><strong>Long Option</strong></td>
- <td width="60%"><strong>Description</strong></td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-uri <Location of WSDL></td>
- <td width="20%">None</td>
- <td width="60%">WSDL file location. This should point to a WSDL file in
- the local file system</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-o <output Location> :</td>
- <td width="20%">--output</td>
- <td width="60%">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.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-l <language></td>
- <td width="20%">--language</td>
- <td width="60%">Output language. Currently the code generator can
- generate code in Java and CSharp. (CSharp support is experimental)
- When omitted defaults to Java.
-
- <p>Allowed options are</p>
- <ul>
- <li>java</li>
- <li>cs</li>
- </ul>
- </td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-p <package name></td>
- <td width="20%">--package</td>
- <td width="60%">The target package name. If omitted, a default package
- (formed using the target namespace of the WSDL) will be used.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-a</td>
- <td width="20%">--async</td>
- <td width="60%">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.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-s</td>
- <td width="20%">--sync</td>
- <td width="60%">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 used with the -a option, this
- takes precedence.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-t</td>
- <td width="20%">--test-case</td>
- <td width="60%">Generates a test case. In the case of Java it would be
- a junit test case.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-ss</td>
- <td width="20%">--server-side</td>
- <td width="60%">Generates server side code (i.e. skeletons). Default is
- off</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-sd</td>
- <td width="20%">--service-description</td>
- <td width="60%">Generates the service descriptor (i.e. server.xml).
- Default is off. only valid with -ss, the server side code generation
- option</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-d</td>
- <td width="20%">--databinding-method</td>
- <td width="60%">Specifies the Databinding framework. valid values are
- xmlbeans,adb and none. Default is adb.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-g</td>
- <td width="20%">--generate-all</td>
- <td width="60%">Genrates 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.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-u</td>
- <td width="20%">--unpack-classes</td>
- <td width="60%">Unpack classes. This option specifies whether to unpack
- the classes and generate separate classes for the databinders.</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-sn</td>
- <td width="20%">--service-name</td>
- <td width="60%">Specifies the service name to be code generated. If the
- service name is is not specified, then the first service will be
- picked</td>
- <td></td>
- </tr>
- <tr>
- <td width="20%">-pn</td>
- <td width="20%">--port-name</td>
- <td width="60%">Specifies the port name to be code generated. If the
- port name is is not specified, then the first port (of the selected
- service) will be picked</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<p>Apart from these mentioned options one can pass extra option 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)</p>
-
-<h1>Code Generator - Ant Task</h1>
-
-<p>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.</p>
-
-<h2>Ant Task Reference</h2>
-
-<table border="1" cellpadding="0" cellspacing="0"
-style="border-collapse: collapse" width="100%" id="AutoNumber2">
- <tbody>
- <tr>
- <td width="50%" height="19">wsdlfilename</td>
- <td width="50%" height="19">WSDL file location. Maps to the uri option
- of the command line tool</td>
- </tr>
- <tr>
- <td width="50%" height="76">output</td>
- <td width="50%" height="76">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. . Maps to the -o option of the command line tool</td>
- </tr>
- <tr>
- <td width="50%" height="171">language</td>
- <td width="50%" height="171">Output language. Currently the code
- generator can generate code in Java and CSharp. (CSharp support is
- limited) When omitted defaults to Java.
-
- <p>Allowed options are</p>
- <ul>
- <li>java</li>
- <li>cs</li>
- </ul>
-
- <p>Maps to the -l option of the command line tool</p>
- </td>
- </tr>
- <tr>
- <td width="50%" height="57">packagename</td>
- <td width="50%" height="57">The 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.</td>
- </tr>
- <tr>
- <td width="50%" height="75">asynconly</td>
- <td width="50%" height="75">Generate 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.</td>
- </tr>
- <tr>
- <td width="50%" height="16">testcase</td>
- <td width="50%" height="16">Generates a test case</td>
- </tr>
- <tr>
- <td width="50%" height="19">synconly</td>
- <td width="50%" height="19">Generate 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.</td>
- </tr>
- <tr>
- <td width="50%" height="19">serverside</td>
- <td width="50%" height="19">Generates 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</td>
- </tr>
- <tr>
- <td width="50%" height="18">generateserverxml</td>
- <td width="50%" height="18">Generates 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.</td>
- </tr>
- <tr>
- <td width="50%" height="18">unpackClasses</td>
- <td width="50%" height="18">unpackes the generated classes. This forces
- the databinding classes to be generated separately, which otherwise
- would have been generated as inner classes.</td>
- </tr>
- <tr>
- <td width="50%" height="18">serviceName</td>
- <td width="50%" height="18">The name of the service</td>
- </tr>
- <tr>
- <td width="50%" height="18">PortName</td>
- <td width="50%" height="18">The name of the port</td>
- </tr>
- </tbody>
-</table>
-
-<h2>Example build file using the custom Ant task</h2>
-
-<p>Following is an example ant build file that uses the custom Ant task.</p>
-
-<p></p>
-<pre><?xml version="1.0"?>
-<project name="CodegenExample" default="main" basedir=".">
-<target name="declare" >
-<taskdef name="codegen"
- classname="org.apache.axis2.tool.ant.AntCodegenTask"
- classpath="classes"/>
-</target>
-<target name="main" depends="declare">
-<codegen
- wsdlfilename="C:\test\wsdl\CombinedService.wsdl"
- output="C:\"
- serverside="true"
- generateserverxml="true"/>
-</target>
-</project></pre>
-
-<p>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</p>
-
-<p>>ant or >ant main</p>
-
-<p>it will generate the server side code and services.xml for the given WSDL
-file(C:\test\wsdl\CombinedService.wsdl) and the generated code will be
-written to C:\ directory.</p>
-
-<p>For this Ant task to work the following jars need to be in the class
-path.</p>
-<ul>
- <li>axis-*.jar (from the Axis2 distribution)</li>
- <li>axis-wsdl4j-1.2.jar (The WSDL4J implementation jar. Bundled with the
- Axis2 distribution)</li>
- <li>stax-api-1.0.jar (The StAX API's that contain the
- javax.xml.namespace.QName class. This jar may be replaced by any other
- jar that contains the javax.xml.namespace.QName implementation. However
- Axis2 uses this class from the stax-api-1.0.jar which comes bundled with
- the Axis2 distribution)
- <p></p>
- </li>
-</ul>
-
-<h1>Invoking the Code Generator from Ant</h1>
-
-<p>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.</p>
-
-<p>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:</p>
-<pre class="code"><!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>
-
- <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="-uri"/>
-
- <arg file="wsdl/LoginEndpoint.wsdl"/>
- <arg value="-ss"/>
- <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">
- <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/service_descriptors/LoginEndpoint" >
- <!-- 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="compile_client" description="run webLogin client">
-
- <echo message="running the webLogin client" />
- <java classname="org.client.LoginClient" >
- <classpath refid="axis.classpath"/>
- </java>
- </target>
-
-</project></pre>
-
-<p>The above build.xml depends on a build.properties file which defines
-'axis.home', such as:</p>
-
-<p>axis.home=/home/username/axis2-1.0-bin/</p>
-
-<p>The above build.xml example also assumes three empty directories exist,
-'dist', 'lib', and 'src'.</p>
-
-<p>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</p>
-<pre class="code"><?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/LoginEndpoint"/></port>
- </service></definitions></pre>
-
-<p>Place the above file, named LoginEndpoint.wsdl, in the directory 'wsdl'
-below the build.xml file. Run the WSDL2Java command via the ant task defined
-above, 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.</p>
-
-<p>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.</p>
-
-<p>After the WSDL2Java command runs the file LoginEndpoint.wsdl, edit the
-following file:</p>
-
-<p>output/org/example/types/LoginEndpointSkeleton.java. You should see the
-following code:</p>
-<pre class="code">package org.example.types;
- /**
- * Auto generated java skeleton for the service by the Axis code generator
- */
- public class LoginEndpointSkeleton {
-
-
- /**
- * Auto generated method signature
-
- * @param param0
-
- */
- public org.example.types.databinding.login.ReturnWebLoginElementDocument webLogin
- (org.example.types.databinding.login.WebLoginElementDocument param0 ){
- //Todo fill this with the necessary business logic
- return null;
- }
-
- }</pre>
-
-<p>Replace the contents of this file with the following, which uses the
-complex types generated by WSDL2Java and the example wsdl file:</p>
-<pre class="code">package org.example.types;
-import org.example.types.databinding.login.ReturnWebLoginElementDocument;
-import org.example.types.databinding.login.WebLoginElementDocument.WebLoginElement;
-
-/**
- * Auto generated java skeleton for the service by the Axis code generator
- */
-public class LoginEndpointSkeleton {
-
- /**
- * Auto generated method signature
-
- * @param webLoginElementDocument changed from param0
-
- */
- public org.example.types.databinding.login.ReturnWebLoginElementDocument webLogin
- (org.example.types.databinding.login.WebLoginElementDocument webLoginElementDocument ){
-
- //Todo fill this with the necessary business logic
- System.out.println("LoginEndpointSkeleton.webLogin reached successfully!");
-
- // Get parameters passed in
- WebLoginElement webLoginElement = webLoginElementDocument.getWebLoginElement();
- String userName = webLoginElement.getUserNameElement();
- String password = webLoginElement.getUserPasswordElement();
- System.out.println("LoginEndpointSkeleton.webLogin userName: " + userName);
- System.out.println("LoginEndpointSkeleton.webLogin password: " + password);
-
- // input paramaters would be used here
-
- // prepare output
- org.example.types.databinding.login.ReturnWebLoginElementDocument retDoc =
- org.example.types.databinding.login.ReturnWebLoginElementDocument.Factory.newInstance();
-
- org.example.types.databinding.login.ReturnWebLoginElementDocument.ReturnWebLoginElement
- retElement =
- org.example.types.databinding.login.ReturnWebLoginElementDocument.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("LoginEndpointSkeleton.webLogin returning...");
-
- return retDoc;
-
-
- }
-
-}</pre>
-
-<p>The next steps assume the axis2.war has been deployed and has expanded in
-a servlet container.</p>
-
-<p>Run the 'jar_wsdl' ant task from the example build.xml, which generates a
-jar file lib/axis2_example_wsdl.jar in the 'lib' directory under the
-build.xml . 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, 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.</p>
-
-<p>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:</p>
-<pre class="code">package org.client;
-
-import org.apache.axis2.AxisFault;
-
-import org.example.types.LoginEndpointStub;
-import org.example.types.databinding.login.WebLoginElementDocument;
-import org.example.types.databinding.login.WebLoginElementDocument.WebLoginElement;
-import org.example.types.databinding.login.ReturnWebLoginElementDocument;
-import org.example.types.databinding.login.WebLoginElementDocument;
-import org.example.types.databinding.login.WebLoginElementDocument.WebLoginElement;
-
-/**
- * Login.
- *
- */
-public class LoginClient {
-
- public static void main(String[] args) {
- try {
-
- System.out.println("webLogin, firing...");
- LoginEndpointStub stub =
- new LoginEndpointStub(null,
- "http://localhost:8080/axis2/services/LoginEndpoint");
-
- 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");
-
- org.example.types.databinding.login.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();
- }
- }
-}</pre>
-
-<p>Now run the ant task 'ant runLogin' . The following output should
-appear:</p>
-<pre class="code">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!!!</pre>
-
-<p></p>
-
-<h1>Appendix</h1>
-<ul>
- <li>Eclipse reference - <a href="http://www.eclipse.org/">
- http://www.eclipse.org/</a></li>
- <li>Custom Ant Tasks - <a
- href="http://ant.apache.org/manual/develop.html">
- http://ant.apache.org/manual/develop.html</a></li>
-</ul>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-</body>
-</html>
+<html>
+<head>
+ <meta http-equiv="content-type" content="">
+ <title>Code Generator-Command Line Tool</title>
+</head>
+
+<body>
+<h1>Code Generator Tool- Command Line & Ant Task</h1>
+
+<p>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.</p>
+
+<h2>Content</h2>
+<ul>
+ <li><a href="#intro">Introduction</a></li>
+ <li><a href="#cmdline">Command Line Version</a>
+ <ul>
+ <li><a href="#cmdref">Option Reference</a></li>
+ </ul>
+ </li>
+ <li><a href="#ant">Ant Task</a>
+ <ul>
+ <li><a href="#antref">Ant Task Reference</a></li>
+ <li><a href="#example">Example build file using the custom Ant
+ task</a></li>
+ <li><a href="#invoking">Invoking the Code Generator from Ant</a></li>
+ </ul>
+ </li>
+ <li><a href="#appendix">Appendix</a></li>
+</ul>
+<a name="intro"></a>
+
+<h2>Introduction</h2>
+
+<p>This basic tool is implemented by the WSDL2Code class and just for the
+convenience in the java case (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 binary distribution)</p>
+<a name="cmdline"></a>
+
+<h2>Command Line Version</h2>
+
+<p>For those users who wish to use the command line version of the tool, this
+section will be of value.</p>
+<a name="cmdref"></a>
+
+<h3>Option Reference</h3>
+
+<table border="1" cellpadding="0" cellspacing="0"
+style="border-collapse: collapse" width="100%" id="AutoNumber1">
+ <tbody>
+ <tr>
+ <td width="20%"><strong>Short Option</strong></td>
+ <td width="20%"><strong>Long Option</strong></td>
+ <td width="60%"><strong>Description</strong></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-uri <Location of WSDL></td>
+ <td width="20%">None</td>
+ <td width="60%">WSDL file location. This should point to a WSDL file in
+ the local file system</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-o <output Location> :</td>
+ <td width="20%">--output</td>
+ <td width="60%">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.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-l <language></td>
+ <td width="20%">--language</td>
+ <td width="60%">Output language. Currently the code generator can
+ generate code in Java and CSharp. (CSharp support is experimental)
+ When omitted defaults to Java.
+
+ <p>Allowed options are</p>
+ <ul>
+ <li>java</li>
+ <li>cs</li>
+ </ul>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-p <package name></td>
+ <td width="20%">--package</td>
+ <td width="60%">The target package name. If omitted, a default package
+ (formed using the target namespace of the WSDL) will be used.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-a</td>
+ <td width="20%">--async</td>
+ <td width="60%">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.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-s</td>
+ <td width="20%">--sync</td>
+ <td width="60%">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 used with the -a option, this
+ takes precedence.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-t</td>
+ <td width="20%">--test-case</td>
+ <td width="60%">Generates a test case. In the case of Java it would be
+ a junit test case.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-ss</td>
+ <td width="20%">--server-side</td>
+ <td width="60%">Generates server side code (i.e. skeletons). Default is
+ off</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-sd</td>
+ <td width="20%">--service-description</td>
+ <td width="60%">Generates the service descriptor (i.e. server.xml).
+ Default is off. only valid with -ss, the server side code generation
+ option</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-d</td>
+ <td width="20%">--databinding-method</td>
+ <td width="60%">Specifies the Databinding framework. valid values are
+ xmlbeans,adb and none. Default is adb.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-g</td>
+ <td width="20%">--generate-all</td>
+ <td width="60%">Genrates 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.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-u</td>
+ <td width="20%">--unpack-classes</td>
+ <td width="60%">Unpack classes. This option specifies whether to unpack
+ the classes and generate separate classes for the databinders.</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-sn</td>
+ <td width="20%">--service-name</td>
+ <td width="60%">Specifies the service name to be code generated. If the
+ service name is is not specified, then the first service will be
+ picked</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td width="20%">-pn</td>
+ <td width="20%">--port-name</td>
+ <td width="60%">Specifies the port name to be code generated. If the
+ port name is is not specified, then the first port (of the selected
+ service) will be picked</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<p>Apart from these mentioned options one can pass extra option 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)</p>
+<a name="ant"></a>
+
+<h2>Ant Task</h2>
+
+<p>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.</p>
+<a name="antref"></a>
+
+<h3>Ant Task Reference</h3>
+
+<table border="1" cellpadding="0" cellspacing="0"
+style="border-collapse: collapse" width="100%" id="AutoNumber2">
+ <tbody>
+ <tr>
+ <td width="50%" height="19">wsdlfilename</td>
+ <td width="50%" height="19">WSDL file location. Maps to the uri option
+ of the command line tool</td>
+ </tr>
+ <tr>
+ <td width="50%" height="76">output</td>
+ <td width="50%" height="76">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. . Maps to the -o option of the command line tool</td>
+ </tr>
+ <tr>
+ <td width="50%" height="171">language</td>
+ <td width="50%" height="171">Output language. Currently the code
+ generator can generate code in Java and CSharp. (CSharp support is
+ limited) When omitted defaults to Java.
+
+ <p>Allowed options are</p>
+ <ul>
+ <li>java</li>
+ <li>cs</li>
+ </ul>
+
+ <p>Maps to the -l option of the command line tool</p>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%" height="57">packagename</td>
+ <td width="50%" height="57">The 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.</td>
+ </tr>
+ <tr>
+ <td width="50%" height="75">asynconly</td>
+ <td width="50%" height="75">Generate 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.</td>
+ </tr>
+ <tr>
+ <td width="50%" height="16">testcase</td>
+ <td width="50%" height="16">Generates a test case</td>
+ </tr>
+ <tr>
+ <td width="50%" height="19">synconly</td>
+ <td width="50%" height="19">Generate 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.</td>
+ </tr>
+ <tr>
+ <td width="50%" height="19">serverside</td>
+ <td width="50%" height="19">Generates 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</td>
+ </tr>
+ <tr>
+ <td width="50%" height="18">generateserverxml</td>
+ <td width="50%" height="18">Generates 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.</td>
+ </tr>
+ <tr>
+ <td width="50%" height="18">unpackClasses</td>
+ <td width="50%" height="18">unpackes the generated classes. This forces
+ the databinding classes to be generated separately, which otherwise
+ would have been generated as inner classes.</td>
+ </tr>
+ <tr>
+ <td width="50%" height="18">serviceName</td>
+ <td width="50%" height="18">The name of the service</td>
+ </tr>
+ <tr>
+ <td width="50%" height="18">PortName</td>
+ <td width="50%" height="18">The name of the port</td>
+ </tr>
+ </tbody>
+</table>
+<a name="example"></a>
+
+<h3>Example build file using the custom Ant task</h3>
+
+<p>Following is an example ant build file that uses the custom Ant task.</p>
+<pre><?xml version="1.0"?>
+<project name="CodegenExample" default="main" basedir=".">
+<target name="declare" >
+<taskdef name="codegen"
+ classname="org.apache.axis2.tool.ant.AntCodegenTask"
+ classpath="classes"/>
+</target>
+<target name="main" depends="declare">
+<codegen
+ wsdlfilename="C:\test\wsdl\CombinedService.wsdl"
+ output="C:\"
+ serverside="true"
+ generateserverxml="true"/>
+</target>
+</project></pre>
+
+<p>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</p>
+
+<p>>ant or >ant main</p>
+
+<p>it will generate the server side code and services.xml for the given WSDL
+file(C:\test\wsdl\CombinedService.wsdl) and the generated code will be
+written to C:\ directory.</p>
+
+<p>For this Ant task to work the following jars need to be in the class
+path.</p>
+<ul>
+ <li>axis-*.jar (from the Axis2 distribution)</li>
+ <li>axis-wsdl4j-1.2.jar (The WSDL4J implementation jar. Bundled with the
+ Axis2 distribution)</li>
+ <li>stax-api-1.0.jar (The StAX API's that contain the
+ javax.xml.namespace.QName class. This jar may be replaced by any other
+ jar that contains the javax.xml.namespace.QName implementation. However
+ Axis2 uses this class from the stax-api-1.0.jar which comes bundled with
+ the Axis2 distribution)</li>
+</ul>
+<a name="invoking"></a>
+
+<h3>Invoking the Code Generator from Ant</h3>
+
+<p>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.</p>
+
+<p>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:</p>
+<pre class="code"><!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>
+
+ <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="-uri"/>
+
+ <arg file="wsdl/LoginEndpoint.wsdl"/>
+ <arg value="-ss"/>
+ <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">
+ <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/service_descriptors/LoginEndpoint" >
+ <!-- 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="compile_client" description="run webLogin client">
+
+ <echo message="running the webLogin client" />
+ <java classname="org.client.LoginClient" >
+ <classpath refid="axis.classpath"/>
+ </java>
+ </target>
+
+</project></pre>
+
+<p>The above build.xml depends on a build.properties file which defines
+'axis.home', such as:</p>
+
+<p>axis.home=/home/username/axis2-1.0-bin/</p>
+
+<p>The above build.xml example also assumes three empty directories exist,
+'dist', 'lib', and 'src'.</p>
+
+<p>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</p>
+<pre class="code"><?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/LoginEndpoint"/></port>
+ </service></definitions></pre>
+
+<p>Place the above file, named LoginEndpoint.wsdl, in the directory 'wsdl'
+below the build.xml file. Run the WSDL2Java command via the ant task defined
+above, 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.</p>
+
+<p>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.</p>
+
+<p>After the WSDL2Java command runs the file LoginEndpoint.wsdl, edit the
+following file:</p>
+
+<p>output/org/example/types/LoginEndpointSkeleton.java. You should see the
+following code:</p>
+<pre class="code">package org.example.types;
+ /**
+ * Auto generated java skeleton for the service by the Axis code generator
+ */
+ public class LoginEndpointSkeleton {
+
+
+ /**
+ * Auto generated method signature
+
+ * @param param0
+
+ */
+ public org.example.types.databinding.login.ReturnWebLoginElementDocument webLogin
+ (org.example.types.databinding.login.WebLoginElementDocument param0 ){
+ //Todo fill this with the necessary business logic
+ return null;
+ }
+
+ }</pre>
+
+<p>Replace the contents of this file with the following, which uses the
+complex types generated by WSDL2Java and the example wsdl file:</p>
+<pre class="code">package org.example.types;
+import org.example.types.databinding.login.ReturnWebLoginElementDocument;
+import org.example.types.databinding.login.WebLoginElementDocument.WebLoginElement;
+
+/**
+ * Auto generated java skeleton for the service by the Axis code generator
+ */
+public class LoginEndpointSkeleton {
+
+ /**
+ * Auto generated method signature
+
+ * @param webLoginElementDocument changed from param0
+
+ */
+ public org.example.types.databinding.login.ReturnWebLoginElementDocument webLogin
+ (org.example.types.databinding.login.WebLoginElementDocument webLoginElementDocument ){
+
+ //Todo fill this with the necessary business logic
+ System.out.println("LoginEndpointSkeleton.webLogin reached successfully!");
+
+ // Get parameters passed in
+ WebLoginElement webLoginElement = webLoginElementDocument.getWebLoginElement();
+ String userName = webLoginElement.getUserNameElement();
+ String password = webLoginElement.getUserPasswordElement();
+ System.out.println("LoginEndpointSkeleton.webLogin userName: " + userName);
+ System.out.println("LoginEndpointSkeleton.webLogin password: " + password);
+
+ // input paramaters would be used here
+
+ // prepare output
+ org.example.types.databinding.login.ReturnWebLoginElementDocument retDoc =
+ org.example.types.databinding.login.ReturnWebLoginElementDocument.Factory.newInstance();
+
+ org.example.types.databinding.login.ReturnWebLoginElementDocument.ReturnWebLoginElement
+ retElement =
+ org.example.types.databinding.login.ReturnWebLoginElementDocument.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("LoginEndpointSkeleton.webLogin returning...");
+
+ return retDoc;
+
+
+ }
+
+}</pre>
+
+<p>The next steps assume the axis2.war has been deployed and has expanded in
+a servlet container.</p>
+
+<p>Run the 'jar_wsdl' ant task from the example build.xml, which generates a
+jar file lib/axis2_example_wsdl.jar in the 'lib' directory under the
+build.xml . 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, 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.</p>
+
+<p>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:</p>
+<pre class="code">package org.client;
+
+import org.apache.axis2.AxisFault;
+
+import org.example.types.LoginEndpointStub;
+import org.example.types.databinding.login.WebLoginElementDocument;
+import org.example.types.databinding.login.WebLoginElementDocument.WebLoginElement;
+import org.example.types.databinding.login.ReturnWebLoginElementDocument;
+import org.example.types.databinding.login.WebLoginElementDocument;
+import org.example.types.databinding.login.WebLoginElementDocument.WebLoginElement;
+
+/**
+ * Login.
+ *
+ */
+public class LoginClient {
+
+ public static void main(String[] args) {
+ try {
+
+ System.out.println("webLogin, firing...");
+ LoginEndpointStub stub =
+ new LoginEndpointStub(null,
+ "http://localhost:8080/axis2/services/LoginEndpoint");
+
+ 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");
+
+ org.example.types.databinding.login.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();
+ }
+ }
+}</pre>
+
+<p>Now run the ant task 'ant runLogin' . The following output should
+appear:</p>
+<pre class="code">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!!!</pre>
+<a name="appendix"></a>
+
+<h2>Appendix</h2>
+<ul>
+ <li>Eclipse reference - <a href="http://www.eclipse.org/">
+ http://www.eclipse.org/</a></li>
+ <li>Custom Ant Tasks - <a href="http://ant.apache.org/manual/develop.html">
+ http://ant.apache.org/manual/develop.html</a></li>
+</ul>
+
+<p></p>
+
+<p></p>
+
+<p></p>
+
+<p></p>
+
+<p></p>
+</body>
+</html>
Modified: webservices/axis2/trunk/java/xdocs/latest/WS_policy.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/latest/WS_policy.html?rev=395583&r1=395582&r2=395583&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/latest/WS_policy.html (original)
+++ webservices/axis2/trunk/java/xdocs/latest/WS_policy.html Thu Apr 20 06:18:46 2006
@@ -1,155 +1,158 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
- <title>WS Policy Support in Axis2</title>
- <meta name="generator" content="amaya 9.2.1, see http://www.w3.org/Amaya/">
-</head>
-
-<body lang="en">
-<h1 align="center">Web Services Policy Support In Axis2</h1>
-
-<h2 align="center"><em>-Experimental Feature</em></h2>
-
-<p><em>Axis2 version 1.0</em></p>
-<i>E-mail comments/ suggestions to: <a
-href="mailto:axis-dev@ws.apache.org">axis-dev@ws.apache.org</a></i>
-
-<h2>What is Web Services (WS) Policy?</h2>
-
-<p>To consume non trivial web services one must fully understand its xml
-contract (WSDL) along with any other additional requirements, capabilities or
-preferences which translates to the configuration of the service, and
-essentially becomes the policies of the service.</p>
-
-<p>WS Policy framework provides a way to express the policies of a service in
-a machine-readable way. Web services infrastructure can be enhanced to
-understand and enforce policies at runtime. For instance, a service author
-might write a policy requiring digital signature and encryption, while
-service consumers could use the policy information to reason out whether they
-can adhere to this policy information to use the service or not.</p>
-
-<p>Further more, web service infrastructure could be enhanced to enforce
-those requirements without requiring the service author to write even single
-line of code.</p>
-
-<h2>Client Side WS-Policy Support</h2>
-
-<p>This release <strong>fully supports WS Policy at client-side</strong>. It
-means that when you codegen a stub against a WSLD which contains policies,
-the stub will contain the capability to engage the required modules with the
-appropriate configurations. For instance, if there is a security policy
-attached to an operation in the WSDL, the generated stub will engage the
-security module for that operation with the appropriate security
-configurations.</p>
-
-<h3>How it works:</h3>
-
-<h4>Phase 1: At PolicyEvaluator</h4>
-
-<p>Codegen engine runs few of its registered extensions before it generates
-the stub. When PolicyEvalutor (which is a registered Codegen extension) is
-initialized, it populates a registry of namespaces of supported policies to
-PolicyExtensions.</p>
-
-<p>For instance, module foo might have a mapping of namespace
-http://test.com/foo which means any primitive assertion which has this
-namespace will be processed by this module. Foo module might implement the
-ModulePolicyExtension interface through which PolicyExtension object can be
-obtained.</p>
-
-<p>A <strong>PolicyExtension</strong> is the access point for a module to add
-any other methods to the stub. For instance Reliable Messaging module can add
-createSequence() and endSequence() methods to the stub, that the user must
-call to start and end an RM sequence.</p>
-
-<p>Then at the engagement of PolicyEvaluator, effective policy of each
-operation is calculated based on policy information declared in the WSDL
-document. Here we assume that effective policy of an operation contains a
-single alternative (<strong>Multiple policy alternatives are not
-supported</strong>). Then we split that policy as follows into few other
-policies such that, each policy will contain primitive assertions belonging
-to only one namespace.</p>
-<pre> <wsp:Policy> <wsp:Policy> <wsp:Policy> <wsp:Policy>
- <a:Foo/> <a:Foo/> <b:Foo/> <c:Bar/>
- <a:Bar/> => <a:Bar/> </wsp:Policy> </wsp:Policy>
- <b:Foo/> </wsp:Policy>
- <c:Bar/>
- </wsp:Policy></pre>
-
-<p>Then each policy is given to the appropriate PolicyExtension with an
-org.w3c.Element type object to which the module can append any other
-elements/attributes it wishes. Those attributes/elements should resolve to
-meaningful stub functions via PolicyExtensionTemplate.xsl at latter point of
-time.</p>
-
-<p>For instance depending on the policy, Security module can append
-<username>, <passwd> elements to the given element as children,
-which are later resolved into setUsername(..), setPasswd(..), functions of
-the stub. This way a module can include additional methods to the stub which
-can be used to get specific parameters to the module. These methods store any
-user input in the ServiceClient properties
-(ServiceClient.getOptions().putProperty(...)) which can later be accessed by
-the module.</p>
-
-<h4>Phase 2: At MultiLanguageClientEmitter</h4>
-
-<p>Further, effective policies (based on the WSDL) at appropriate levels
-(service level, operation level) are stored as policy strings in the stub.
-Few more generic methods are also added to the stub which are used to
-evaluate/process policies at runtime.</p>
-
-<h4>Phase 3: Runtime</h4>
-
-<p>When a new stub object is created, the policy strings in the stub are
-converted into policy objects and merged together to get the effective
-policies of each operation. These effective policies are stored in
-appropriate AxisOperation objects which a module can access at later point of
-time.</p>
-
-<p>Then based on its policy each AxisOperation is engaged to a set of
-modules.</p>
-
-<p>When the stub method is invoked, those modules which are engaged to that
-AxisOperation, access the effective policy for that operation via
-AxisOperation object. It can get other information needed from the
-MessageContext which get stored by stub methods which the module has added to
-the stub earlier. The modules are required to loads their configurations
-according to the effective policy which is set in AxisOperation and
-properties they get via MessageContext.</p>
-
-<h2>Server Side WS-Policy Support</h2>
-
-<p>In this current release Axis2 framework uses ws-commons/policy as an
-object model to manipulate policy documents. All its description builders
-store any policy information included in description documents (services.xml,
-axis2.xml, .. etc) in the appropriate description classes. This information
-is available at both deployment and run time via these description
-classes.</p>
-
-<p>When generating WSDL dynamically for each service, policy information in
-the description classes is included. For instance, if you declare a policy in
-axis2.xml then that policy is reflected in service elements of WSDL of every
-service. If a policy is declared in a services.xml, it is shown in the
-service element of WSDL for that particular service.</p>
-
-<p>Next step is to use that information to engage and configure required
-modules and allow the module to make use of this policy information.</p>
-
-<p>It is evident that a great deal of work is required to make axis2 a fully
-fledged ws-policy supported web service infrastructure. But it is encouraging
-to note that we've taken the first steps towards this goal. We appreciate any
-suggestions, patches etc you send us in this regard. Keep on
-contributing...!</p>
-<h2>Resources</h2>
-<ul>
-<li>Apache WS-Commons Policy Implementaion official site- <a href="http://ws.apache.org/commons/policy/index.html" target="_blank">Home Page</a></li>
-<li>Sanka Samaranayake, March 2006. <a href="" target="_blank">Web services Policy - Why, What & How</a></li>
-<li><a href="http://svn.apache.org/viewcvs.cgi/webservices/commons/modules/policy/" target="_blank">WS-commons/policy SVN</a></li>
-<li><a href="http://specs.xmlsoap.org/ws/2004/09/policy/ws-policy.pdf" target="_blank">Web
- Services Policy Framework (WS-Policy)</a></li>
-
-</ul>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>WS Policy Support in Axis2</title>
+ <meta name="generator" content="amaya 9.2.1, see http://www.w3.org/Amaya/">
+</head>
+
+<body lang="en">
+<h1 align="center">Web Services Policy Support In Axis2</h1>
+
+<p><em>-Axis2 version 1.0</em></p>
+<i>E-mail comments/ suggestions to: <a
+href="mailto:axis-dev@ws.apache.org">axis-dev@ws.apache.org</a></i>
+
+<h2>What is Web Services (WS) Policy?</h2>
+
+<p>To consume non trivial web services one must fully understand its xml
+contract (WSDL) along with any other additional requirements, capabilities or
+preferences which translates to the configuration of the service, and
+essentially becomes the policies of the service.</p>
+
+<p>WS Policy framework provides a way to express the policies of a service in
+a machine-readable way. Web services infrastructure can be enhanced to
+understand and enforce policies at runtime. For instance, a service author
+might write a policy requiring digital signature and encryption, while
+service consumers could use the policy information to reason out whether they
+can adhere to this policy information to use the service or not.</p>
+
+<p>Further more, web service infrastructure could be enhanced to enforce
+those requirements without requiring the service author to write even single
+line of code.</p>
+
+<h2>Client Side WS-Policy Support</h2>
+
+<p>This release <strong>fully supports WS Policy at client-side</strong>. It
+means that when you codegen a stub against a WSLD which contains policies,
+the stub will contain the capability to engage the required modules with the
+appropriate configurations. For instance, if there is a security policy
+attached to an operation in the WSDL, the generated stub will engage the
+security module for that operation with the appropriate security
+configurations.</p>
+
+<h3>How it works:</h3>
+
+<h4>Phase 1: At PolicyEvaluator</h4>
+
+<p>Codegen engine runs few of its registered extensions before it generates
+the stub. When PolicyEvalutor (which is a registered Codegen extension) is
+initialized, it populates a registry of namespaces of supported policies to
+PolicyExtensions.</p>
+
+<p>For instance, module foo might have a mapping of namespace
+http://test.com/foo which means any primitive assertion which has this
+namespace will be processed by this module. Foo module might implement the
+ModulePolicyExtension interface through which PolicyExtension object can be
+obtained.</p>
+
+<p>A <strong>PolicyExtension</strong> is the access point for a module to add
+any other methods to the stub. For instance Reliable Messaging module can add
+createSequence() and endSequence() methods to the stub, that the user must
+call to start and end an RM sequence.</p>
+
+<p>Then at the engagement of PolicyEvaluator, effective policy of each
+operation is calculated based on policy information declared in the WSDL
+document. Here we assume that effective policy of an operation contains a
+single alternative (<strong>Multiple policy alternatives are not
+supported</strong>). Then we split that policy as follows into few other
+policies such that, each policy will contain primitive assertions belonging
+to only one namespace.</p>
+<pre> <wsp:Policy> <wsp:Policy> <wsp:Policy> <wsp:Policy>
+ <a:Foo/> <a:Foo/> <b:Foo/> <c:Bar/>
+ <a:Bar/> => <a:Bar/> </wsp:Policy> </wsp:Policy>
+ <b:Foo/> </wsp:Policy>
+ <c:Bar/>
+ </wsp:Policy></pre>
+
+<p>Then each policy is given to the appropriate PolicyExtension with an
+org.w3c.Element type object to which the module can append any other
+elements/attributes it wishes. Those attributes/elements should resolve to
+meaningful stub functions via PolicyExtensionTemplate.xsl at latter point of
+time.</p>
+
+<p>For instance depending on the policy, Security module can append
+<username>, <passwd> elements to the given element as children,
+which are later resolved into setUsername(..), setPasswd(..), functions of
+the stub. This way a module can include additional methods to the stub which
+can be used to get specific parameters to the module. These methods store any
+user input in the ServiceClient properties
+(ServiceClient.getOptions().putProperty(...)) which can later be accessed by
+the module.</p>
+
+<h4>Phase 2: At MultiLanguageClientEmitter</h4>
+
+<p>Further, effective policies (based on the WSDL) at appropriate levels
+(service level, operation level) are stored as policy strings in the stub.
+Few more generic methods are also added to the stub which are used to
+evaluate/process policies at runtime.</p>
+
+<h4>Phase 3: Runtime</h4>
+
+<p>When a new stub object is created, the policy strings in the stub are
+converted into policy objects and merged together to get the effective
+policies of each operation. These effective policies are stored in
+appropriate AxisOperation objects which a module can access at later point of
+time.</p>
+
+<p>Then based on its policy each AxisOperation is engaged to a set of
+modules.</p>
+
+<p>When the stub method is invoked, those modules which are engaged to that
+AxisOperation, access the effective policy for that operation via
+AxisOperation object. It can get other information needed from the
+MessageContext which get stored by stub methods which the module has added to
+the stub earlier. The modules are required to loads their configurations
+according to the effective policy which is set in AxisOperation and
+properties they get via MessageContext.</p>
+
+<h2>Server Side WS-Policy Support</h2>
+
+<p>In this current release Axis2 framework uses ws-commons/policy as an
+object model to manipulate policy documents. All its description builders
+store any policy information included in description documents (services.xml,
+axis2.xml, .. etc) in the appropriate description classes. This information
+is available at both deployment and run time via these description
+classes.</p>
+
+<p>When generating WSDL dynamically for each service, policy information in
+the description classes is included. For instance, if you declare a policy in
+axis2.xml then that policy is reflected in service elements of WSDL of every
+service. If a policy is declared in a services.xml, it is shown in the
+service element of WSDL for that particular service.</p>
+
+<p>Next step is to use that information to engage and configure required
+modules and allow the module to make use of this policy information.</p>
+
+<p>It is evident that a great deal of work is required to make axis2 a fully
+fledged ws-policy supported web service infrastructure. But it is encouraging
+to note that we've taken the first steps towards this goal. We appreciate any
+suggestions, patches etc you send us in this regard. Keep on
+contributing...!</p>
+
+<h2>Resources</h2>
+<ul>
+ <li>Apache WS-Commons Policy Implementaion official site- <a
+ href="http://ws.apache.org/commons/policy/index.html"
+ target="_blank">Home Page</a></li>
+ <li>Sanka Samaranayake, March 2006. <a href="" target="_blank">Web services
+ Policy - Why, What & How</a></li>
+ <li><a
+ href="http://svn.apache.org/viewcvs.cgi/webservices/commons/modules/policy/"
+ target="_blank">WS-commons/policy SVN</a></li>
+ <li><a href="http://specs.xmlsoap.org/ws/2004/09/policy/ws-policy.pdf"
+ target="_blank">Web Services Policy Framework (WS-Policy)</a></li>
+</ul>
+</body>
+</html>
Modified: webservices/axis2/trunk/java/xdocs/latest/index.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/latest/index.html?rev=395583&r1=395582&r2=395583&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/latest/index.html (original)
+++ webservices/axis2/trunk/java/xdocs/latest/index.html Thu Apr 20 06:18:46 2006
@@ -14,14 +14,18 @@
<li><a href="installationguide.html">Installation Guide</a> -Detailed
instructions on installation methods, information on system prerequisites
& distribution packages.</li>
- <li><a href="userguide.html">User's Guide</a> -</li>
- <li><a href="webadminguide.html">Web Administration Guide</a></li>
+ <li><a href="userguide.html">User's Guide</a> -Describing how to write
+ & deploy Web services, writing Web services clients, details on
+ module & samples</li>
+ <li><a href="webadminguide.html">Web Administrator's Guide</a> -Detailed
+ intructions on administration console of Axis2 Web application, with the
+ know ho to configure Axis2 at run time. </li>
</ul>
<h2>Tools References</h2>
<ul>
- <li><a href="CodegenToolReference.html">Code Generator Wizard - Command
- Line Tool</a></li>
+ <li><a href="CodegenToolReference.html">Code Generator Tool- Command Line
+ & Ant Task</a></li>
<!--<li><a href="CodegenTools-EclipsePlugin.html">Code Generator Wizard - eclipse Plug-in</a></li>-->
<li><a href="ServiceArchiveToolReference.html">Service Archive Wizard -
eclipse Plug-in</a></li>
@@ -54,23 +58,40 @@
<ul>
<li><a
href="http://www.jaxmag.com/itr/online_artikel/psecom,id,747,nodeid,147.html">Axis2
- - The Future of Web Services</a></li>
+ - The Future of Web Services</a> by Srinath Perera, Ajith Ranabahu</li>
<li><a
href="http://www.developer.com/services/article.php/3525481">Introducing
- Axis2</a></li>
+ Axis2, the Next Generation of the Apache Web Service Stack</a> by Srinath
+ Perera</li>
<li><a href="http://www.onjava.com/pub/a/onjava/2005/07/27/axis2.html">Web
- Services Messaging with Apache Axis2: Concepts and Techniques</a></li>
+ Services Messaging with Apache Axis2: Concepts and Techniques</a> by
+ Srinath Perera, Ajith Ranabahu</li>
<li><a href="http://developer.com/java/web/article.php/3529321">Axis2
- Execution Framework</a></li>
+ Execution Framework</a> by Deepal Jayasinghe</li>
<li><a
href="http://jaxmag.com/itr/online_artikel/psecom,id,757,nodeid,147.html">Axis2
- Deployment Model</a></li>
- <li><a>Undertanding Axis2 Deployment Architecture</a></li>
+ Deployment Model</a> by Deepal Jayasinghe</li>
+ <li><a
+ href="http://www.developer.com/open/article.php/3557741">Understanding
+ Axis2 Deployment Architecture</a> by Deepal Jayasinghe</li>
+ <li><a
+ href="http://www.wso2.net/2006/02/inside_the_axis2_code_generator">Inside
+ the Axis2 Code generator</a> by Ajith Ranabahu</li>
<li><a
href="http://www.developer.com/java/other/article.php/3570031">Utilizing
- a Non-Java Web Servive with Axis2</a></li>
+ a Non-Java Web Servive with Axis2</a> by Deepal Jayasinghe</li>
<li><a href="http://www.developer.com/open/article.php/3589126">Avoiding
- Mistakes Made Using Axis2</a></li>
+ Mistakes Made Using Axis2</a> by Deepal Jayasinghe</li>
+ <li><a
+ href="http://www.wso2.net/2006/04/setting_up_apache_axis2_in_eclipse">Setting
+ up Apache Axis2 in eclipse IDE</a> by Ruchith Fernando</li>
+ <li><a
+ href="http://www.wso2.net/files/tutorials/Axis2%20tutorial.pdf">Introducing
+ Axis2</a> by Eran Chinthaka, Chathura Herath</li>
+ <li><a
+ href="http://www.wso2.net/files/tutorials/Accelerating%20Web%20Services%20Development%20with%20Axis2.pdf">Accelerating
+ Web Services Development with Axis2</a> by Deepal Jayasinghe, Ajith
+ Ranabahu</li>
</ul>
<h3>AXIOM</h3>
Modified: webservices/axis2/trunk/java/xdocs/latest/userguide.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/latest/userguide.html?rev=395583&r1=395582&r2=395583&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/latest/userguide.html (original)
+++ webservices/axis2/trunk/java/xdocs/latest/userguide.html Thu Apr 20 06:18:46 2006
@@ -14,7 +14,7 @@
<p>This document mainly contains data on how to write Web services & Web
service clients using Axis2, also creating a custom module and deploying it
to a Web service. Samples shipped with the binary distribution of Axis2 is
-also described here. </p>
+also described here.</p>
<p align="right">Pages: <b>Content</b>, <a href="userguide1.html">1</a>, <a
href="userguide2.html">2</a>, <a href="userguide3.html">3</a>, <a
@@ -169,7 +169,7 @@
<li><p>Advanced Topics</p>
<ul>
<li><a href="rest-ws.html" target="_blank">RESTful Web Services</a></li>
- <li><a href="tcp-transport.html" target="_blank">TCP transport</a></li>
+ <li><a href="tcp-transport.html" target="_blank">TCP Transport</a></li>
<li><a href="mail-transport.html" target="_blank">Mail
Transport</a></li>
<li><a href="http-transport.html" target="_blank">HTTP