我正在使用zend-Soap为我们的一位客户创建Web服务。
我希望我的服务返回:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="X">
<SOAP-ENV:Body>
<ns1:getPersonRolesResponse>
<rolelist>
<role>subscriber</role>
</rolelist>
</ns1:getPersonRolesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
但这就是它的实际反应
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="X">
<SOAP-ENV:Body>
<ns1:getPersonRolesResponse>
<getPersonRolesResult>
<rolelist>
<role>subscriber</role>
</rolelist>
</getPersonRolesResult>
</ns1:getPersonRolesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
如您所见,每次我们不感兴趣时都会有一个Result节点。
//code simplified
public function getPersonRoles($netid){
$role ="subscriber";
return (object)[
"rolelist" => (object)[
"role" => $role
]
];
}