簡體   English   中英

誰能告訴我為什么我在SOAPpy中遇到此錯誤?

[英]Can anyone tell me why I'm getting this error in SOAPpy?

server = SOAPpy.WSDL.Proxy(wdf)

Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    server = SOAPpy.WSDL.Proxy(wdf)
  File "C:\Python27\lib\soapy\SOAPpy\WSDL.py", line 62, in __init__
    self.wsdl = reader.loadFromStream(stream, wsdlsource)
  File "C:\Python27\lib\soapy\SOAPpy\wstools\WSDLTools.py", line 28, in loadFromStream
    document = DOM.loadDocument(stream)
  File "C:\Python27\lib\soapy\SOAPpy\wstools\Utility.py", line 572, in loadDocument
    return xml.dom.minidom.parse(data)
  File "C:\Python27\lib\xml\dom\minidom.py", line 1911, in parse
    return expatbuilder.parse(file)
  File "C:\Python27\lib\xml\dom\expatbuilder.py", line 928, in parse
    result = builder.parseFile(file)
  File "C:\Python27\lib\xml\dom\expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
ExpatError: syntax error: line 1, column 0

使用這個

>>> import SOAPpy
>>> url = "your wsdl url"
>>> nameSpc= "your name space"
>>> client = SOAPpy.SOAPProxy(url,namespace = nameSpc)
>>> client.config.buildWithNamespacePrefix = 0  //  only for callin .net service
>>> client.config.dumpSOAPIn = 1  // in case to debug
>>> client.config.dumpSOAPOut = 1   // in case to debug
>>> result = client.TestPython(name = "ss")   //  name is the name of the parameter used in   
                                                  in the service method
>>> print result

您嘗試加載的文件可能無效。 它具有無效的語法。 以下代碼應適用於保存為wsdl.xml的有效wsdl文件。

from SOAPpy import WSDL
wsdlFile = open('wsdl.xml')
server = WSDL.Proxy(wsdlFile)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM