我有一个带有 NuSoap 的 Web 服务 WSDL。我将它与 CodeIgniter 一起使用。我遇到了 contexttype-array 返回的问题。这是我的 PHP 代码:
$this->nusoap_server->wsdl->addComplexType(
"getJobStatusByIdsResponse",
"complexType",
"array",
"all",
"SOAP-ENC:Array",
array(),
array(
'Job' => array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:jobStatusResponse[]', 'minOccurs'=>'1', 'maxOccurs'=>'unbounded')
),
'tns:jobStatusResponse'
);
$this->nusoap_server->wsdl->addComplexType(
"getJobStatusByIdsResponse",
"complexType",
"array",
"all",
"SOAP-ENC:Array",
array(),
array(
'Job' => array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:jobStatusResponse[]', 'minOccurs'=>'1', 'maxOccurs'=>'unbounded')
),
'tns:jobStatusResponse'
);
$this->nusoap_server->register(
"getJobStatusByIds",
array('getJobStatusByIdsRequest' => 'tns:getJobStatusByIdsRequest'),
array('getJobStatusByIdsResponse' => 'tns:getJobStatusByIdsResponse'),
false,
false,
"rpc",
"literal",
"get JobStatus By Ids"
);
function getJobStatusByIds($data) {
return array(array('orderId' => '1000', 'jobStatus' => '5'),array('orderId' => '1001', 'jobStatus' => '3'),array('orderId' => '1002', 'jobStatus' => '7'))
}
我得到这个作为回报:
<ns1:getJobStatusByIdsResponse xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
<getJobStatusByIdsResponse>
<item>
<orderId>1001</orderId>
<jobStatus>5</jobStatus>
</item>
<item>
<orderId>1002</orderId>
<jobStatus>3</jobStatus>
</item>
<item>
<orderId>1003</orderId>
<jobStatus>7</jobStatus>
</item>
</getJobStatusByIdsResponse>
</ns1:getJobStatusByIdsResponse>
那不对,不是吗?
我怎样才能得到它(“工作”而不是“项目”):
<ns1:getJobStatusByIdsResponse xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
<getJobStatusByIdsResponse>
<Job>
<orderId>1001</orderId>
<jobStatus>5</jobStatus>
</Job>
<Job>
<orderId>1002</orderId>
<jobStatus>3</jobStatus>
</Job>
<Job>
<orderId>1003</orderId>
<jobStatus>7</jobStatus>
</Job>
</getJobStatusByIdsResponse>
</ns1:getJobStatusByIdsResponse>
我可以帮助谁?在哪里可以找到更多关于 NuSoap 的示例?