Java .Net 互操作。轴 java.util.Map
我有 wsdl 需要由 wsdl.exe (.net sdk 2.0) 解释 该 wsdl 是由 axis 引擎在运行时生成的,它正在读取 wsdd 文件来生成它。
我的返回类型之一内部有 java.util.Map,这里是 wsdl 中映射的架构(只是 wsdl 的一部分)
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="Map">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item">
<complexType>
<all>
<element name="key" type="xsd:anyType" />
<element name="value" type="xsd:anyType" />
</all>
</complexType>
</element>
</sequence>
</complexType>
</schema>
但是当我运行 wsdl.exe 来读取此 wsdl 时,我收到以下错误;
- 无法导入操作“getXXX”。
- 类型必须在架构的顶层声明。请查看 命名空间中的模式类型“Map” 'http://xml.apache.org/xml-soap': 元素“item”正在使用匿名类型 声明,匿名类型不是 通过编码的 SOAP 支持。
这是否意味着我不能使用地图作为网络服务?我对谷歌的结果不满意......
I have wsdl that needs to be interpreted by wsdl.exe (.net sdk 2.0)
This wsdl is generated on runtime by axis engine, and it is reading a wsdd file to generate this.
One of my return types have java.util.Map inside and here is the schema for a map in wsdl (just one part of wsdl)
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="Map">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item">
<complexType>
<all>
<element name="key" type="xsd:anyType" />
<element name="value" type="xsd:anyType" />
</all>
</complexType>
</element>
</sequence>
</complexType>
</schema>
But when I run the wsdl.exe to read this wsdl I am getting following error;
- Unable to import operation 'getXXX'.
- Types must be declared at the top level in the schema. Please review
schema type 'Map' from namespace
'http://xml.apache.org/xml-soap':
element 'item' is using anonymous type
declaration, anonymous types are not
supported with encoded SOAP.
Does this mean that I am not allowed to use Map when it comes a web service? I couldn't be satisfied with google results...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我回答我自己的问题;
如果您想让 .NET 使用您的 Web 服务,则不应使用 java.util.Map 作为返回类型
http://wiki.apache.org/ws/FrontPage/Axis/DotNetInteropMapInfo
Let me answer my own question;
You should not use java.util.Map as a return type if you want to make your web services consumable by .NET
http://wiki.apache.org/ws/FrontPage/Axis/DotNetInteropMapInfo