<?php
/** splitMe function
* @param string $string_to_split string to split
* (maps to the xs:string XML schema type )
* @return array of string $result split to array
*(maps to the xs:double XML schema type )
*/
function splitMe($string_to_split)
{
return array("result" => split(":", $string_to_split));
}
$operations = array("splitMe"=>"splitMe");
$opParams = array("splitMe"=>"MIXED");
$svr = new WSService(array("operations"=>$operations,
"bindingStyle"=>"doclit",
"opParams"=>$opParams));
$svr->reply();
?>
Note that the annotation corresponding to the return value.
* @return array of spring $result split to array
This will generate an schema with an element of maxOccurs='unbounded'. Note that you can get the wsdl from the 'serviceurl?wsdl'.
<xsd:element name="splitMeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="result" maxOccurs="unbounded" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Now just generate a client for this service using wsdl2php and try invoke it. You will get an array of string as the response.
$input = new splitMe();
$input->string_to_split = "a:b:c:d";
// call the operation
$response = $proxy->splitMe($input);
print_r($response);
2 comments:
Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: Invalid expression in /usr/lib/php5/20060613+lfs/wsf_c/scripts/dynamic_invocation/wsf_wsdl_util.php on line 166
...............
NO idea why get lots of error like XSLTProcessor::importStylesheet()....
Any idea?
Just checking, Does this happen for the samples shipped with the wsf/php?. In that case can you check whether the php xsl extension is uptodate?
Post a Comment