When I consume wsdl using python, I get an xml.parsers.expat.ExpatError

血红的双手。 提交于 2019-12-08 04:46:52

问题


I followed these instructions to make a local wsdl. Some lines in my local 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/"> 

When I use python like this:

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

I get the error:

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

回答1:


when I google basichttpbinding and wshttpbinding,I got Difference between BasicHttpBinding and WsHttpBinding

when I finished reading this article then I found a solution.

In How to: Host a WCF Service in a Managed Windows Service,the thirteenth step.you can replace wshttpBinding with basicHttpBinding in XMLlang file.

Finally everything goes well

Sorry for my poor English.



来源:https://stackoverflow.com/questions/15548002/when-i-consume-wsdl-using-python-i-get-an-xml-parsers-expat-expaterror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!