The PHP Web services framework, WSO2 WSF/PHP, has support for one of the most sought after features in PHP Web services arena, the WSDL generation capability.
You can generate either WSDL 1.1 or WSDL 2.0, for any Web service, written using WSService class. One can use documentation comments to specify the operation characteristics, and those would be picked by the WSDL generator.
Here is an example of such a doc comment:
/**
* The purchaseOrder function
* @param int $itemNo ID of the item to be purchased
* (maps to the xs:int XML schema type )
* @param string $date Date that the purchase order was done
* (maps to the xs:gDate XML schema type)
* @return int $price tolal price
* (maps to the xs:nonNegativeInteger schema type )
*/
function purchaseOrder ($itemNo, $date)
{
// some logic
return $Price;
}
If you do not provide any doc comments for the operations, still a WSDL would be generated, assuming XSD:Any as the default type.
You can generate the WSDL by suffixing the service endpoint address with '?wsdl' for WSDL 1.1 and '?wsdl2' for WSDL 2.0.
If you are interested, have a look at the WSDL generation API documentation.
Comments