NuSOAP 和数组响应
我有 NuSOAP 网络服务器: ...
$server->register('getMembersEvents',
array('date' => 'xsd:string'),
array('Events' => 'tns:Events'),
'urn:my',
false,
'rpc',
false,
'Description'
);
$server->wsdl->addComplexType(
'Events',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array('Event' =>array ('name' => 'Event', 'type' => 'tns:Event')),
array(
'Event' => array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Event[]')
),
'tns:Event'
);
$server->wsdl->addComplexType(
'Event',
'complexType',
'struct',
'all',
'',
array(
'field1' => array('name' => 'MemberNumber', 'type' => 'xsd:int'),
// ...
'fieldN' => array('name' => 'WebMemberID', 'type' => 'xsd:int')
)
);
一切正常,但响应似乎是:
<SOAP-ENV:Body>
<ns1:getMembersEventsResponse xmlns:ns1="urn:eliza">
<Events xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Event[2]">
<item xsi:type="tns:Event">
<field1 xsi:type="xsd:int">123</field1>
...
<fieldN xsi:type="xsd:int">123</fieldN>
</item>
<item xsi:type="tns:Event">
<field1 xsi:type="xsd:int">123</field1>
...
<fieldN xsi:type="xsd:int">123</fieldN>
</item>
</Events>
</ns1:getMembersEventsResponse>
</SOAP-ENV:Body>
我如何重命名“项目”? 我必须有活动 -> 事件节点结构。
I've NuSOAP web-server:
...
$server->register('getMembersEvents',
array('date' => 'xsd:string'),
array('Events' => 'tns:Events'),
'urn:my',
false,
'rpc',
false,
'Description'
);
$server->wsdl->addComplexType(
'Events',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array('Event' =>array ('name' => 'Event', 'type' => 'tns:Event')),
array(
'Event' => array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Event[]')
),
'tns:Event'
);
$server->wsdl->addComplexType(
'Event',
'complexType',
'struct',
'all',
'',
array(
'field1' => array('name' => 'MemberNumber', 'type' => 'xsd:int'),
// ...
'fieldN' => array('name' => 'WebMemberID', 'type' => 'xsd:int')
)
);
Everyting works fine, but the response seems like:
<SOAP-ENV:Body>
<ns1:getMembersEventsResponse xmlns:ns1="urn:eliza">
<Events xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Event[2]">
<item xsi:type="tns:Event">
<field1 xsi:type="xsd:int">123</field1>
...
<fieldN xsi:type="xsd:int">123</fieldN>
</item>
<item xsi:type="tns:Event">
<field1 xsi:type="xsd:int">123</field1>
...
<fieldN xsi:type="xsd:int">123</fieldN>
</item>
</Events>
</ns1:getMembersEventsResponse>
</SOAP-ENV:Body>
How cab I rename "item"? I have to have Events -> Event node structure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用这个解决了这个问题,
我使用“element”而不是“complexType”作为 typeClass 参数。
I solved this problem using this
I use "element" instead of "complexType" for the typeClass parameter.
我在 v1.123 2010/04/26 20:15:08 nusoap lib 中解决了这个问题。
评论第 6136 行:
并添加以下代码:
对我有用!
希望有帮助!
I solve the problem doing this in the v1.123 2010/04/26 20:15:08 nusoap lib.
Comment the Line 6136:
And add this code:
Works for me !
Hope helps !