[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&thinsp;</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&thinsp;</p>
+
+<p>For WSDL 2.0 - http://localhost/services/echoService.php?wsdl2&thinsp;</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"=&gt;$operations,
+"bindingstyle"=&gt;"rpc"))</p>
+
+<p>Binding Style</p>
+
+<p>Parameter</p>
+
+<p>Document/literal wrapped</p>
+
+<p>doc-lit</p>
+
+<p>RPC/encoded rpc</p>
+
+<p>&thinsp;</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>&lt;operation name="luckyNoFunction"&gt;</p>
+
+<p>&lt;input message="s0:luckyNoFunctionInput"/&gt;</p>
+
+<p>&lt;output message="s0:luckyNoFunctionOutput"/&gt;</p>
+
+<p>&lt;/operation&gt;</p>
+
+<p></p>
+
+<p>In message elements,</p>
+
+<p>&lt;message name="luckyNoFunctionInput"&gt;</p>
+
+<p>&lt;part name="parameters" element="luckyNoFunction"/&gt;</p>
+
+<p>&lt;/message&gt;</p>
+
+<p></p>
+
+<p>&lt;message name="luckyNoFunctionOutput"&gt;</p>
+
+<p>&lt;part name="parameters" element="luckyNoFunctionResponse"/&gt;</p>
+
+<p>&lt;/message&gt;</p>
+
+<p></p>
+
+<p>Therefore, the generated schema that can be accessible on the server side
+is,</p>
+
+<p></p>
+
+<p>&lt;element name="luckyNoFunction"&gt;</p>
+
+<p>&lt;complexType&gt;</p>
+
+<p>&lt;sequence&gt;</p>
+
+<p>&lt;element name="yr" type="xsd:gYear"/&gt;</p>
+
+<p>&lt;element name="name" type="xsd:string"/&gt;</p>
+
+<p>&lt;/sequence&gt;</p>
+
+<p>&lt;/complexType&gt;</p>
+
+<p>&lt;/element&gt;</p>
+
+<p></p>
+
+<p>element name="luckyNoFunctionResponse"&gt;</p>
+
+<p>&lt;complexType&gt;</p>
+
+<p>&lt;sequence&gt;</p>
+
+<p>&lt;element name="t" type="xsd:int"/&gt;</p>
+
+<p>&lt;/sequence&gt;</p>
+
+<p>&lt;/complexType&gt;</p>
+
+<p>&lt;/element&gt;</p>
+
+<p></p>
+
+<p>e.g. for RPC style:</p>
+
+<p></p>
+
+<p>The Message elements are,</p>
+
+<p></p>
+
+<p>&lt;message name="luckyNoFunction"&gt;</p>
+
+<p>&lt;part name="yr" type="xsd:gYear"/&gt;</p>
+
+<p>&lt;part name="name" type="xsd:string"/&gt;</p>
+
+<p>&lt;/message&gt;</p>
+
+<p></p>
+
+<p>&lt;message name="luckyNoFunctionResponse"&gt;</p>
+
+<p>&lt;part name="t" type="xsd:int"/&gt;</p>
+
+<p>&lt;/message&gt;</p>
+
+<p></p>
+
+<p></p>
+
+<p>&thinsp;</p>
+</body>
+</html>




More information about the Wsf-c-dev mailing list