我正在尝试使用 WSE 3.0 作为 Visual Studio 2005 中的客户端调用第三方 Web 服务。
调用工作正常,我可以看到我得到了很好的响应(我启用了跟踪),但显然 xml 解析器阻塞了它。我总是得到一个InvalidOperationException
:
XML 文档中存在错误。
有一个InnerException
:
无法识别指定的类型:name='Map',namespace=' http ://xml.apache.org/xml-soap',位于 <bevoegdheid xmlns=''>。
这是响应的相关部分:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="https://acceptatie.cartalk.nl/Soap/Apk" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:opvragenKeurmeesterGegevensResponse>
<opvragenKeurmeesterGegevensReturn xsi:type="ns2:Backend_Apk_Result_OpvragenKeurmeesterGegevens">
<naam xsi:type="xsd:string">A name</naam>
...
<bevoegdheid SOAP-ENC:arrayType="ns1:Map[2]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns1:Map">
<item>
<key xsi:type="xsd:string">soortBevoegdheid</key>
<value xsi:type="xsd:string">AL</value>
</item>
...
</item>
<item>
...
</item>
</bevoegdheid>
<meldingSoort xsi:nil="true" />
<meldingNummer xsi:nil="true" />
<melding xsi:nil="true" />
</opvragenKeurmeesterGegevensReturn>
</SOAP-ENV:opvragenKeurmeesterGegevensResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
这就是在 wsdl 中定义“bevoegdheid”的方式:
<xsd:element name="bevoegdheid" type="soap-enc:Array" />
wsdl 中的任何地方都没有提到“地图”类型。
我一直在谷歌搜索,但我发现的唯一答案是类似的
该服务使用较难实现互操作性的 rpc/编码格式。如果您可以将服务器更改为文档/文字,那就更好了。
但由于这是第三方服务(已被其他客户使用),这对我们来说是没有选择的。
还有其他建议吗?如何让 xml 解析器识别“地图”类型?