Php 如何将自定义类型传入NuSoap服务

Php 如何将自定义类型传入NuSoap服务,php,soap,nusoap,Php,Soap,Nusoap,我有一个php nusoap服务,定义如下: $server->wsdl->addComplexType( 'OrderType', 'complexType', 'struct', 'all', '', array( 'OrderId' => array('name' => 'OrderId', 'type' => 'xsd:string'), 'CustomerNum

我有一个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>
如果我按如下方式进入信封:

$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>
请尝试以下代码:

function testService($OrderData) {                    
    $result['OrderId'] = $OrderData['OrderId']; // OrderId instead of OrderData
    $result['CustomerNumber'] = $OrderData['CustomerNumber'];
    return $result;        
}