WCF 和 Python SUDS 之间的 XML 继承差异?
我有一个关于 WCF 和 SUDS (Python) 之间继承表示的不同方式的问题。我有一个 C++/CLI WCF 服务器 (.NET 3.5 SP1),我正在尝试与其通信。我使用过 C#(也有 WCF)客户端并且工作正常,但是使用 SUDS 客户端(Python 2.6.4、SUDS 0.3.8)时出现问题。这基本上没问题,但对于继承类型来说,区别似乎在于两者在 SOAP XML 中表示继承的方式。当我查看服务器记录的消息时,得到类似于以下内容的结果:
C# 客户端:
<ns:DerivedType>
...
</ns:DerivedType>
Python 客户端:
<ns:BaseType xsi:type="ns:DerivedType">
...
</ns:BaseType>
是否可以更改 WCF 服务器以接受 Python 样式?或者更改Python SUDS客户端以发送WCF样式?哪一个是正确的?
I have a question regarding the different ways inheritance are represented between WCF and SUDS (Python). I have a C++/CLI WCF server (.NET 3.5 SP1) and I'm trying to communicate with it. I've used a C# (WCF also) client and it work fine, but there are problems when using a SUDS client (Python 2.6.4, SUDS 0.3.8). It's mostly fine, but for inherited types, and the difference seems to be in the way the two represent inheritance in the SOAP XML. When I look at the messages that the server logs, I get results similar to the following:
C# Client:
<ns:DerivedType>
...
</ns:DerivedType>
Python Client:
<ns:BaseType xsi:type="ns:DerivedType">
...
</ns:BaseType>
Is it possible to change the WCF server to accept the Python style? Or to change the Python SUDS client to send the WCF style? Which one is correct?
不了解 python 方面,但 WCF 方面有几个选项。更直接的选项是创建一个消息检查器来检测和转换python 生成的soap 变得更适合WCF 服务。
更困难但“更纯粹”的选项是确定如何塑造 WCF 服务生成的 WSDL,以便它允许 python 客户端生成上述美味的肥皂。找到所需的调整后,您可以使用 MessageContract 类的 DataContract 以使服务生成调整后的 WSDL。 .NET 客户端应该毫无怨言地处理这个经过调整的 WSDL。
Don't know about the python side but there are couple of options on the WCF side. The more straight foward option is to create a message inspector to detect and convert the python generated soap to something more palatable to the WCF service.
The more difficult but "purer" option is to determine how to shape the WSDL generated by the WCF service so it allows the python client to produce the aforementioned palatable soap. Once you find the required tweaks, you would use the MessageContract classes in place of the DataContract to make the service produce the tweaked WSDL. The .NET clients should handle this tweaked WSDL without complaint.