[wsf-c-dev] svn commit r702 - wsf/php/src/xdocs
svn at wso2.com
svn at wso2.com
Sun Feb 4 21:06:29 PST 2007
Author: buddhika
Date: Sun Feb 4 21:06:24 2007
New Revision: 702
Added:
wsf/php/src/xdocs/wsdl_generation_api.html
Log:
api documentation for wsdl generation
Added: wsf/php/src/xdocs/wsdl_generation_api.html
==============================================================================
--- (empty file)
+++ wsf/php/src/xdocs/wsdl_generation_api.html Sun Feb 4 21:06:24 2007
@@ -0,0 +1,480 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+ <title>WS02 WSF WSDL generation API</title>
+ <meta name="generator" content="amaya 9.52, see http://www.w3.org/Amaya/" />
+</head>
+
+<body>
+<h1>PHP WSDL Generation</h1>
+
+<p></p>
+
+<p>WSDL Generation in WSF for PHP is done using PHP reflection and an
+annotation parser. In order to generate a WSDL from a given WSF for PHP
+service, a ?wsdl request should be sent to the server. For example, if you
+want to generate the WSDL for the service echoService.php, a request should
+be sent as,</p>
+
+<p></p>
+
+<p>http://localhost/services/echoService.php?wsdl </p>
+
+<p></p>
+
+<p>Upon receiving the request, the relevant WSDL is generated. If the PHP
+script that implements the service contains annotations provided by the
+programmer, they will be used for WSDL generation. If the annotations are
+missing or if there is a syntax error, the WSDL will be generated using
+reflection and XSD:Any as the type for the parameters.</p>
+
+<h2>1.Annotation Syntax</h2>
+
+<p></p>
+
+<p>Parameter types and return types should be annotated for a PHP function
+using the following syntax.</p>
+
+<p></p>
+
+<h3>1.1 Parameters</h3>
+
+<p></p>
+
+<p>@param PHP_parameter_type $parameterName</p>
+
+<p>( xs:XSDType )</p>
+
+<p></p>
+
+<p>Users can add their own comments only after the $parameter Name</p>
+
+<p></p>
+
+<h3>1.2 Return Type</h3>
+
+<p></p>
+
+<p>@return PHP_return_type $returnValueName</p>
+
+<p>( xs:XSDType )</p>
+
+<p></p>
+
+<p>Users can add their own comments only after the $parameter Name</p>
+
+<p></p>
+
+<h3>1.3 Example</h3>
+
+<p></p>
+
+<p>/** The purchaseOrder function</p>
+
+<p>* @param int $itemNo ID of the purchase Item</p>
+
+<p>* (maps to the xs:int XML schema type )</p>
+
+<p>* @param string $date Date that the purchase order was done</p>
+
+<p>* (maps to the xs:gDate XML schema type)</p>
+
+<p>* @return int $price your lucky number</p>
+
+<p>*(maps to the xs:nonNegativeInteger schema type )</p>
+
+<p>*/</p>
+
+<p></p>
+
+<p>function purchaseOrder($itemNo,$date)</p>
+
+<p>{</p>
+
+<p>// some logic</p>
+
+<p>return $Price;</p>
+
+<p>}</p>
+
+<h2>2.PHP to Schema Type Mapping</h2>
+
+<p></p>
+
+<p>Since PHP is a weakly-typed language in nature, the following type mapping
+is needed to map the PHP types to the XML Schema types.</p>
+
+<table border="2">
+ <caption></caption>
+ <tbody>
+ <tr>
+ <td>Schema Type</td>
+ <td>PHP Type</td>
+ </tr>
+ <tr>
+ <td>string</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>boolean</td>
+ <td>boolean</td>
+ </tr>
+ <tr>
+ <td>double</td>
+ <td>float</td>
+ </tr>
+ <tr>
+ <td>float</td>
+ <td>float</td>
+ </tr>
+ <tr>
+ <td>int </td>
+ <td>int </td>
+ </tr>
+ <tr>
+ <td>integer</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>byte</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>decimal</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>base64Binary</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>hexBinary</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>anyType </td>
+ <td>soap var object</td>
+ </tr>
+ <tr>
+ <td>any</td>
+ <td>soap var object</td>
+ </tr>
+ <tr>
+ <td>QName</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>dateTime</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>date</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>time</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>unsignedLong </td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>unsignedInt </td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>unsignedShort</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>unsignedByte</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>positiveInteger</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>negativeInteger</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>nonNegativeInteger</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>nonPositiveInteger</td>
+ <td>int</td>
+ </tr>
+ <tr>
+ <td>gYearMonth</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>gMonthDay</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>gYear</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>gMonth</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>gDay</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>duration</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>Name</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>NCName</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>NMTOKEN</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>NOTATION</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>NMTOKENS</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>ENTITY</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>ENTITIES</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>IDREF</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>IDREFS</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>anyURI</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>language</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>ID</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>normalizedString</td>
+ <td>string</td>
+ </tr>
+ <tr>
+ <td>token </td>
+ <td>string</td>
+ </tr>
+
+ </tbody>
+</table>
+
+<p></p>
+
+<h2>3.WSDL Versions</h2>
+
+<p></p>
+
+<p>To get WSDL 1.1 use ?wsdl .To get WSDL 2.0 use ?wsdl2</p>
+
+<p></p>
+
+<p>e.g.</p>
+
+<p></p>
+
+<p>For WSDL 1.1 - http://localhost/services/echoService.php?wsdl </p>
+
+<p>For WSDL 2.0 - http://localhost/services/echoService.php?wsdl2 </p>
+
+<h2>4.Binding Style</h2>
+
+<p></p>
+
+<p>The SOAP binding style should be set in a PHP service option array. If the
+SOAP style is not set, then the document style is treated as default.</p>
+
+<p></p>
+
+<p>e.g.</p>
+
+<p></p>
+
+<p>$service = new WSService(array("operations"=>$operations,
+"bindingstyle"=>"rpc"))</p>
+
+<p>Binding Style</p>
+
+<p>Parameter</p>
+
+<p>Document/literal wrapped</p>
+
+<p>doc-lit</p>
+
+<p>RPC/encoded rpc</p>
+
+<p> </p>
+
+<p></p>
+
+<p>e.g. Generating Message elements and a schema for the document/literal
+wrapped style .</p>
+
+<p></p>
+
+<p>/** The LuckyNo function</p>
+
+<p>* @param string $yr year of your birthday</p>
+
+<p>* (maps to the xs:gYear XML schema type )</p>
+
+<p>* @param string $name your first name</p>
+
+<p>* (maps to the xs:string XML schema type)</p>
+
+<p>* @return int $t your lucky number</p>
+
+<p>*(maps to the xs:int XML schema type )</p>
+
+<p>*/</p>
+
+<p></p>
+
+<p>function luckyNoFunction($yr,$name)</p>
+
+<p>{</p>
+
+<p>// some logic</p>
+
+<p>return $t;</p>
+
+<p>}</p>
+
+<p></p>
+
+<p>In the generated WSDL, the operation named "luckyfunction" has two
+messages</p>
+
+<p><operation name="luckyNoFunction"></p>
+
+<p><input message="s0:luckyNoFunctionInput"/></p>
+
+<p><output message="s0:luckyNoFunctionOutput"/></p>
+
+<p></operation></p>
+
+<p></p>
+
+<p>In message elements,</p>
+
+<p><message name="luckyNoFunctionInput"></p>
+
+<p><part name="parameters" element="luckyNoFunction"/></p>
+
+<p></message></p>
+
+<p></p>
+
+<p><message name="luckyNoFunctionOutput"></p>
+
+<p><part name="parameters" element="luckyNoFunctionResponse"/></p>
+
+<p></message></p>
+
+<p></p>
+
+<p>Therefore, the generated schema that can be accessible on the server side
+is,</p>
+
+<p></p>
+
+<p><element name="luckyNoFunction"></p>
+
+<p><complexType></p>
+
+<p><sequence></p>
+
+<p><element name="yr" type="xsd:gYear"/></p>
+
+<p><element name="name" type="xsd:string"/></p>
+
+<p></sequence></p>
+
+<p></complexType></p>
+
+<p></element></p>
+
+<p></p>
+
+<p>element name="luckyNoFunctionResponse"></p>
+
+<p><complexType></p>
+
+<p><sequence></p>
+
+<p><element name="t" type="xsd:int"/></p>
+
+<p></sequence></p>
+
+<p></complexType></p>
+
+<p></element></p>
+
+<p></p>
+
+<p>e.g. for RPC style:</p>
+
+<p></p>
+
+<p>The Message elements are,</p>
+
+<p></p>
+
+<p><message name="luckyNoFunction"></p>
+
+<p><part name="yr" type="xsd:gYear"/></p>
+
+<p><part name="name" type="xsd:string"/></p>
+
+<p></message></p>
+
+<p></p>
+
+<p><message name="luckyNoFunctionResponse"></p>
+
+<p><part name="t" type="xsd:int"/></p>
+
+<p></message></p>
+
+<p></p>
+
+<p></p>
+
+<p> </p>
+</body>
+</html>
More information about the Wsf-c-dev
mailing list