我有一个php nusoap服务定义如下:
$server->wsdl->addComplexType(
'OrderType',
'complexType',
'struct',
'all',
'',
array(
'OrderId' => array('name' => 'OrderId', 'type' => 'xsd:string'),
'CustomerNumber' => array('name' => 'CustomerNumber', 'type' => 'xsd:string'),
)
);
$server->register("testService",
array("OrderData" => "tns:OrderType"),
array("return" => "tns:OrderType"), //array("return" => "xsd:string"),
"urn:aaa",
"urn:aaa#testService",
"rpc",
"encoded",
"");
如果我传递信封如下:
<soapenv:Body>
<sch:Request xmlns:sch="http://aaa.com//Schema.xsd">
<sch:OrderId>OA1236</sch:OrderId>
<sch:CustomerNumber>PIN555</sch:CustomerNumber>
</sch:Request>
</soapenv:Body>
如何处理参数$ OrderData?我希望它能够如下工作,但这不起作用
function testService($OrderData) {
$result['OrderId'] = $OrderData['OrderData'];
$result['CusomterNumber'] = $OrderData['CustomerNumber'];
return $result;
}
答案 0 :(得分:0)
试试这段代码:
function testService($OrderData) {
$result['OrderId'] = $OrderData['OrderId']; // OrderId instead of OrderData
$result['CustomerNumber'] = $OrderData['CustomerNumber'];
return $result;
}