|
Igor Vrdoljak
|
Saturday 08 December 2007 2:51:28 pm
Comment48831
First define complex types that you need, then you can register web methods that use these types. Following code works for me:
$server->wsdl->addComplexType(
'Product',
'complexType',
'struct',
'all',
'',
array(
'Name' => array('name'=>'name','type'=>'xsd:string'),
'Code' => array('name'=>'product_number','type'=>'xsd:string'),
'Price' => array('name'=>'price','type'=>'xsd:decimal'),
'Ammount' => array('name'=>'quantity','type'=>'xsd:int')
)
);
$server->wsdl->addComplexType(
'ProductArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Product[]')
),
'tns:Product'
);
$server->register(
'GetProductsByCode',
array('user'=>'xsd:string','password'=>'xsd:string','product_code'=>'xsd:string'),
array('return'=>'tns:ProductArray'),
$NAMESPACE);
Cheers
http://www.netgen.hr/eng
http://twitter.com/ivrdoljak
|