当我使用python使用wsdl时,我得到一个xml.parsers.expat.ExpatError

时间:2013-03-21 12:47:14

标签: python wcf python-2.7 wsdl soappy

我跟着these instructions创建了一个本地wsdl。 我本地WSDL中的一些行:

< wsdl:definitions 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"        
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:tns="http://tempuri.org/" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
xmlns:i0="http://Microsoft.ServiceModel.Samples" 
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
name="CalculatorService" 
targetNamespace="http://tempuri.org/"> 

当我像这样使用python时:

    from SOAPpy import WSDL
    server = WSDL.Proxy('http://114.212.190.58:8000/ServiceModelSamples/service?wsdl')
    server.ADD(a=3,b=4)

我收到错误:

xml.parsers.expat.ExpatError: not well-formed(invalid token): line 1, column5.

1 个答案:

答案 0 :(得分:1)

当我谷歌 basichttpbinding和wshttpbinding 时,我得到Difference between BasicHttpBinding and WsHttpBinding

当我读完这篇文章后,我找到了解决方案。

How to: Host a WCF Service in a Managed Windows Service,第十三 step.you可以用XMLlang文件中的basicHttpBinding 替换wshttpBinding。

最后一切顺利

抱歉我的英语不好。