blob: 3582d581bcfbb4d9c368df4bcbdb884b9cdd49ef [file] [log] [blame]
<!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=UTF-8">
<link rel="stylesheet" href="../../skin/tigris.css" type="text/css">
<link rel="stylesheet" href="../../skin/mysite.css" type="text/css">
<link rel="stylesheet" href="../../skin/site.css" type="text/css">
<link media="print" rel="stylesheet" href="../../skin/print.css" type="text/css">
<title>WSDL2Ws Tool</title>
</head>
<body bgcolor="white" class="composite">
<div id="banner">
<table width="100%" cellpadding="8" cellspacing="0" summary="banner" border="0">
<tbody>
<tr>
<td align="left">
<div class="groupLogo">
<a href="http://ws.apache.org/"><img border="0" class="logoImage" alt="The Apache WebServices Project" src="../../images/project-logo.jpg"></a>
</div>
</td><td align="right">
<div class="projectLogo">
<a href="http://ws.apache.org/axis/"><img border="0" class="logoImage" alt="The Apache Axis Project" src="../../images/axis.jpg"></a>
</div>
</td><td valign="top" rowspan="2" align="right" class="search">
<form target="_blank" action="http://www.google.com/search" method="get">
<table summary="search" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#a5b6c6" colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td colspan="3"><img height="8" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="ws.apache.org" name="sitesearch" type="hidden"><input size="10" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="GO" type="submit">
<br>
Search WS</td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td colspan="3"><img height="7" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
</tr>
<tr>
<td class="bottom-left-thick"></td><td bgcolor="#a5b6c6"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td class="bottom-right-thick"></td>
</tr>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" summary="nav" id="breadcrumbs">
<tbody>
<tr class="status">
<td><a href="http://www.apache.org/">Apache</a> | <a href="http://ws.apache.org/">WS</a><a href=""></a></td><td id="tabs">
<div class="tab">
<span class="selectedTab"><a class="base-selected" href="../../index.html">WebServices-Axis</a></span>
</div>
</td>
</tr>
</tbody>
</table>
<table id="main" width="100%" cellpadding="8" cellspacing="0" summary="" border="0">
<tbody>
<tr valign="top">
<td id="leftcol">
<div id="navcolumn">
<div class="menuBar">
<div class="menu">
<span class="menuLabel">Axis</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/index.html">Introduction</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/news.html">News</a>
</div>
<div class="menuItem">
<a href="http://wiki.apache.org/ws/FrontPage/Axis">FAQ/Wiki</a>
</div>
<div class="menu">
<span class="menuLabel">Get Involved</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/overview.html">Overview</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/cvs.html">CVS Repository</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/mail.html">Mailing Lists</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/ref.html">Reference Library</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/bugs.html">Bugs</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/howtobuild.html">HowToBuildSite</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Axis (Java)</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/index.html">Documentation</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/install.html">Installation</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/user-guide.html">User's Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/developers-guide.html">Developer's Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/integration-guide.html">Integration Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/architecture-guide.html">Architecture Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/reference.html">Reference Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/reading.html">Reading Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/requirements.html">Requirements</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Axis (C++)</span>
<div class="menuItem">
<a href="../../cpp/index.html">Home</a>
</div>
<div class="menuItem">
<a href="../../cpp/documentation.html">Documentation</a>
</div>
<div class="menuItem">
<a href="../../cpp/download.html">Download</a>
</div>
<div class="menuItem">
<a href="http://wiki.apache.org/ws/FrontPage/AxisCPP">Wiki Pages</a>
</div>
<div class="menuItem">
<a href="../../cpp/who.html">Who we are</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Downloads</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/releases.html">Releases</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/interim.html">Interim Drops</a>
</div>
<div class="menuItem">
<a href="http://cvs.apache.org/viewcvs/ws-axis/">Source Code</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Translation</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/ja/index.html">Japanese</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Related Projects</span>
<div class="menuItem">
<a href="http://ws.apache.org/wsif/">WSIF</a>
</div>
<div class="menuItem">
<a href="http://cvs.apache.org/viewcvs/*checkout*/ws-wsil/java/README.htm">WSIL</a>
</div>
<div class="menuItem">
<a href="http://www-124.ibm.com/developerworks/projects/wsdl4j/">WSDL4J</a>
</div>
<div class="menuItem">
<a href="http://www.uddi4j.org/">UDDI4J</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Misc</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/who.html">Who We Are</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/contact.html">Contact</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/legal.html">Legal</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/docs.html">Notes/Docs</a>
</div>
</div>
</div>
</div>
</div>
</td><td>
<div id="bodycol">
<div class="app">
<div align="center">
<h1>WSDL2Ws Tool</h1>
</div>
<div class="h3">
<div class="h3">
<h3>Axis C++ WSDL2Ws Tool</h3>
</div>
<hr noshade="noshade" size="1">
<p>
<strong>Contents</strong>
</p>
<ul>
<li>
<a href="#intro">1 Introduction</a>
</li>
<li style="list-style: none">
<ul>
<li>
<a href="#codegen">1.1 Source Code Generation</a>
</li>
<li>
<a href="#proglang">1.2 Programming Languages</a>
</li>
<li>
<a href="#encode">1.3 Encoding Styles</a>
</li>
<li>
<a href="#svcstyle">1.4 Styles of Services</a>
</li>
<li>
<a href="#complext">1.5 Support for Complex Types</a>
</li>
</ul>
</li>
<li>
<a href="#usage">2 Using the Tool</a>
</li>
<li style="list-style: none">
<ul>
<li>
<a href="#dependencies">2.1 Dependencies on Axis Java tool</a>
</li>
<li>
<a href="#building">2.2 Building the Tool</a>
</li>
<li>
<a href="#synopsis">2.3 Synopsis</a>
</li>
<li>
<a href="#classpath">2.4 Setting up CLASSPATH</a>
</li>
<li>
<a href="#runtool">2.5 Running the Tool</a>
</li>
</ul>
</li>
<li>
<a href="#test">3 Architecture</a>
</li>
<li style="list-style: none">
<ul>
<li>
<a href="#test1">3.1 Outline</a>
</li>
<li>
<a href="#test2">3.2 Mediator WebServiceContext</a>
</li>
<li>
<a href="#test3">3.3 Generator</a>
</li>
<li>
<a href="#test4">3.4 Flow of Execution</a>
</li>
<li>
<a href="#test5">3.5 Sequence Diagram</a>
</li>
</ul>
</li>
</ul>
<p>
<a name="intro"></a>
</p>
<div class="h3">
<h3>1 Introduction</h3>
</div>
<p>The WSDL2Ws tool that comes with Axis C++ can be used to generate different types of wrapper classes / skeletons for the server side and wrapper classes / stubs for the client side for a given WSDL file. WSDL2Ws tool is written in Java and is based on the WSDL tools by Axis Java project.</p>
<p>
<a name="codegen"></a>
</p>
<div class="h4">
<h4>1.1 Source Code Generation</h4>
</div>
<p>WSDL2WS tool can be used for generating the following C/C++ source files for a given WSDL file :</p>
<ul>
<li>Server side skeletons and wrappers</li>
<li>Client side stubs and wrappers</li>
</ul>
<p>The generated Wrappers support the following functions :</p>
<ul>
<li>Method invocation</li>
<li>Serialization</li>
<li>Deserialization</li>
</ul>
<p>
<a name="proglang"></a>
</p>
<div class="h4">
<h4>1.2 Programming Languages</h4>
</div>
<p>The tool is capable of generating source code for both C++ and C</p>
<p>
<a name="encode"></a>
</p>
<div class="h4">
<h4>1.3 Encoding Styles</h4>
</div>
<p>The tool should be able to support SOAP 1.2 encoding style and extensible to support other encoding styles as well. However verifying the compliance with SOAP 1.1 / SOAP 1.2 and WS-I Basic Profile remains a TODO.</p>
<p>
<a name="svcstyle"></a>
</p>
<div class="h4">
<h4>1.4 Styles of Services</h4>
</div>
<p>The tool is able to generate code for RPC (encoded) and Document Literal style WSDLs</p>
<p>
<a name="complext"></a>
</p>
<div class="h4">
<h4>1.5 Support for Complex Types</h4>
</div>
<p>The tool generates wrapper classes / structs / functions for complex types. The generated source include:</p>
<ul>
<li>Wrapper classes for complex types with data members and constructors/destructors</li>
<li>Helper functions for serializing/deserializing complex types</li>
<li>Wrapper classes to handle arrays of complex types</li>
</ul>
<p>
<a name="usage"></a>
</p>
<div class="h3">
<h3>2 Using the Tool</h3>
</div>
<p>
<a name="dependencies"></a>
</p>
<div class="h4">
<h4>2.1 Dependencies on Axis Java tool</h4>
</div>
<p>Apache Axis C++ uses WSDL processing tools from Axis Java project and extends those for C/C++ code generation.</p>
<p>The following jar files that come with (or used by) Axis Java are required to run Axis C++ WSDL2Ws tool:</p>
<ul>
<li>axis.jar</li>
<li>wsdl4j.jar</li>
<li>commons-discovery.jar</li>
<li>commons-logging.jar</li>
<li>log4j-1.2.8.jar</li>
<li>jaxrpc.jar</li>
<li>saaj.jar</li>
</ul>
<p>"SchemaUtils" and "ElementDecl" classes of Axis Java tools have been extended by Axis C++ WSDL2Ws implementation.</p>
<p>Other than the two classes mentioned above, no other class from Axis Java WSDL tool implementation has been overridden or extended at present by Axis C++ WSDL2Ws tool; hence all other classes in Axis Java tool are used as they are.</p>
<p>
<a name="building"></a>
</p>
<div class="h4">
<h4>2.2 Building the Tool</h4>
</div>
<p>If you want to build the WSDL2Ws tool from source, there is an Apache Ant build script to help you. Assuming that you have <a href="http://ant.apache.org/manual/install.html">installed Ant</a> properly, what you have to do is to set the CLASSPATH to include <a href="http://www.apache.org/dyn/closer.cgi/ws/axis/1_2beta/">Axis Java jar files</a> mentioned in the previous section and run ant command in $AXISCPP_HOME/src/wsdl folder. Once you build the tool the generated wsdl2ws.jar file would be placed in $AXISCPP_HOME/lib/axis/ folder.</p>
<p>
<a name="synopsis"></a>
</p>
<div class="h4">
<h4>2.3 Synopsis</h4>
</div>
<p>
<strong>java WSDL2Ws [options] wsdl-file</strong>
</p>
<p>
<strong>Options</strong>
</p>
<pre>-help, -h print a short help message<br>-o(folder) target output folder - default is current folder<br>-l(c++|c) target language (c++|c) - default is c++<br>-s(server|client) generate server skeletons or client stubs? (server|client) - default is server<br>-w(wrapped|nonwrapped) wrapping style of the WSDL (wrapped|nonwrapped) - default is wrapped<br>-verbose, -v be verbose<br>
</pre>
<p>
<a name="classpath"></a>
</p>
<div class="h4">
<h4>2.4 Setting up CLASSPATH</h4>
</div>
<p>Make sure that your CLASSPATH environment variable has all the jar files mentioned in section 2.1 above. Then modify your CLASSPATH to include the wsdl2ws.jar file from Axis C++:</p>
<p>On Linux:</p>
<pre>CLASSPATH=$AXISCPP_HOME/lib/axis/wsdl2ws.jar:$CLASSPATH
export CLASSPATH
</pre>
<p>On Windows:</p>
<pre>set CLASSPATH=%AXISCPP_HOME%\lib\axis\wsdl2ws.jar;%CLASSPATH%
</pre>
<p>Alternatively, you can use the -classpath option of java command to specify the CLASSPATH.</p>
<p>
<a name="runtool"></a>
</p>
<div class="h4">
<h4>2.5 Running the Tool</h4>
</div>
<p>You could run the tool as shown in the following example. Assuming you have not included wsdl2ws.jar in your class path:</p>
<pre>java -classpath $AXISCPP_HOME/lib/axis/wsdl2ws.jar:$CLASSPATH org.apache.axis.wsdl.wsdl2ws.WSDL2Ws \
-obaseServerOut $AXISCPP_DEPLOY/wsdls/base.wsdl
</pre>
<p>The above command will generate C++ server side skeleton and wrapper classes and place the generated source files in a folder named baseServerOut. You could have also used -sserver and -lc++ options to generate the same. To generate client side C++ code for the same WSDL file and place the generated code in baseClientOut folder, you could run:</p>
<pre>java -classpath $AXISCPP_HOME/lib/axis/wsdl2ws.jar:$CLASSPATH org.apache.axis.wsdl.wsdl2ws.WSDL2Ws \
-obaseClientOut -sclient -lc++ $AXISCPP_DEPLOY/wsdls/base.wsdl
</pre>
<p>
<a name="test"></a>
</p>
<div class="h3">
<h3>3 Architecture</h3>
</div>
<p>
<a name="test1"></a>
</p>
<div class="h4">
<h4>3.1 Outline</h4>
</div>
<p>The tool takes a top down approach. It starts with a WSDL document and generates all the classes (skeletons, wrapper classes for complex types and stubs) necessary to deploy (server side) and consume (client side) the web service. For more information about the generated classes please refer to the architecture documentation.</p>
<p>The following figure shows the high level architecture of the WSDL2Ws tool</p>
<align>
<img alt="" src="../images/c/ag/wsdl2ws.jpg"></align>
<br>
<br>
<p>
<a name="test2"></a>
</p>
<div class="h4">
<h4>3.2 Mediator WebServiceContext</h4>
</div>
<p>The WSDL file and the user options are processed by the WSDL2Ws class. Then WSDL2Ws creates an instance of WebServiceContext class (wscontext), which is the runtime representation of the processed data. This WebServiceContext instance selects the Generator to be used. The Generators extract the information from the WebServiceContext instance and creates the files. The WebServiceContext instance acts as a mediator and creates a loosely coupled system.</p>
<p>
<strong>WebServiceContext has the following components</strong>
</p>
<ol>
<li>ServiceInfo - information about service</li>
<li>WrapperInfo - information about wrapper options</li>
<li>TypeMap - information about custom types</li>
</ol>
<p>
<a name="test3"></a>
</p>
<div class="h4">
<h4>3.2 Generator</h4>
</div>
<p>Generator generates a class based on the options passed by user. It contains a class called SourceWriter and the concrete implementation of the SourceWriter decides what the Generator generates.</p>
<p>
<a name="test4"></a>
</p>
<div class="h4">
<h4>3.4 flow of Execution</h4>
</div>
<ol>
<li>WSDL file and user options are processed by the WSDL2Ws and WebServiceContext object is created</li>
<li>WebServiceGenaratorFactory will create WebServiceGenerator based on the service style</li>
<li>Then the WebServiceGenarator will create the right set of Generators that will take care of generating C/C++ source files</li>
<li>Each Generator will invoke SourceWriter which is capable of writing the given type of file</li>
</ol>
<br>
<br>
<p>
<a name="test5"></a>
</p>
<div class="h4">
<h4>3.5 Sequence Diagram</h4>
</div>
<p>
<img alt="" src="../images/c/ag/sequence.jpg"></p>
<br>
<br>
<hr noshade="noshade" size="1">
<div id="pdf" align="right">
<a href="WSDL2Ws.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
PDF</a>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div id="footer">
<table summary="footer" cellspacing="0" cellpadding="4" width="100%" border="0">
<tbody>
<tr>
<td colspan="2">
<div align="center">
<div class="copyright">
Copyright &copy; 2000-2005&nbsp;The Apache Software Foundation. All rights reserved.
</div>
</div>
</td>
</tr>
<tr>
<td align="left"></td><td align="right">
<div align="right">
<div class="credit"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>