python - 当我使用python消耗wsdl时,得到了xml.parsers.expat.ExpatError

标签 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.

最佳答案

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

当我阅读完本文后,便找到了解决方案。

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

终于一切顺利

对不起,我的英语不好。

关于python - 当我使用python消耗wsdl时,得到了xml.parsers.expat.ExpatError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15548002/

相关文章:

Python:在对象上传递和执行类方法

python - 用 Python 编写的 Nautilus 扩展在调用 gtk.main() 时不会运行

c# - 如何计算上传大文件的最佳 block 大小

c# - 横向扩展WCF,如何处理回调?

python - 更改光标在条目小部件中的位置

Python2.7 日志级别的日志记录不起作用

python - 在 Linux 上使用 gcc-4.7.2 安装 numpy-1.7.1 和 MKL-10.3

python - 为什么 os.system() 不是执行 shell 命令的推荐方式?

wcf - 在 IIS 6 上启用 WCF REST Api 上的 PUT(没有 .svc 文件)

python - 为什么 Python 生成器在执行脚本中将其范围与全局混淆?