向php SOAP复杂数据类型添加XML包装器
我当前正在我的nusoap服务器文件中使用以下内容:向php SOAP复杂数据类型添加XML包装器,php,web-services,soap,nusoap,Php,Web Services,Soap,Nusoap,我当前正在我的nusoap服务器文件中使用以下内容: $server->wsdl->addComplexType( 'member', 'complexType', 'struct', 'all', '', array( 'ID' => array('MemberInfo' => 'ID', 'type' => 'xsd:int'), 'FIRST_NAME' => array('
$server->wsdl->addComplexType(
'member',
'complexType',
'struct',
'all',
'',
array(
'ID' => array('MemberInfo' => 'ID', 'type' => 'xsd:int'),
'FIRST_NAME' => array('MemberInfo' => 'FIRST_NAME', 'type' => 'xsd:string'),
'LAST_NAME' => array('MemberInfo' => 'LAST_NAME', 'type' => 'xsd:string')
)
返回:
<ID xsi:type="xsd:int">1</ID>
<FIRST_NAME xsi:type="xsd:string">John</FIRST_NAME>
<LAST_NAME xsi:type="xsd:string">Doe</LAST_NAME>
1
约翰
雌鹿
如何修改此项以接收以下输出:
<ID xsi:type="xsd:int">1</ID>
<NAME>
<FIRST_NAME xsi:type="xsd:string">John</FIRST_NAME>
<LAST_NAME xsi:type="xsd:string">Doe</LAST_NAME>
</NAME>
1
约翰
雌鹿
实现这一点的方法是在我的响应数据类型中包含一个条目和包装器的数组:
'ID' => array('MemberInfo' => 'ID', 'type' => 'xsd:int'),
'NAME' => array('NAME' => array('NAME', 'type' => 'xsd:string'))
当然,然后将该名称信息存储在子数组中
return array (
'ID' => $user_info->ID,
'NAME' => array(
'FIRST_NAME' => $user_info->first_name,
'LAST_NAME' => $user_info->last_name,
)
)
您是否尝试过数组('FIRST_NAME'=>…,'LAST_NAME'=>…)?我尝试过,结果是既不返回FIRST也不返回LAST NAME。从哪里获得(1,John,Doe)?这些值来自由我的web服务方法调用的php函数中构建的数组。e、 g.$my_array=array('ID'=>$row['ID'],FIRST_NAME'=>$row['NAME'])等