【发布时间】:2011-07-26 17:07:18
【问题描述】:
我正在尝试将字符串列表(或数组、集合)从 python 传递到 WCF 服务端点
WCF 界面:
[OperationContract]
string[] TestList(IEnumerable<string> vals);
Web.config 中的绑定:
<endpoint address="http://localhost:13952/Service/Endpoint.svc" binding="basicHttpBinding" contract="Service.IEndpoint">
调用服务的 Python 代码:
from suds.client import Client
url = 'http://localhost:13952/Service/Endpoint.svc?wsdl'
client = Client(url)
result = client.service.TestList(('a', 'b', 'c'))
产生的错误:
suds.WebFault: Server raised fault: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:vals. The InnerException message was 'Error in line 1 position 310. Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. '. Please see InnerException for more details.'
我将尝试使用 WireShark 捕获数据包并尝试从那里进行调试。希望有人知道一个简单的解决方案。
谢谢。
【问题讨论】:
-
我不熟悉 suds 或 python,但从错误消息看来,您已将命名空间信息作为肥皂消息的一部分发送,tempuri 是自 asmx 以来的默认命名空间服务微软堆栈上的日子
标签: python wcf serialization wcf-binding