谁能告诉我为什么我在 SOAPpy 中收到此错误?

发布于 2024-09-28 00:22:44 字数 910 浏览 3 评论 0原文

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
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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哎呦我呸! 2024-10-05 00:22:44

用这个

>>> 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

Use this one

>>> 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
清风挽心 2024-10-05 00:22:44

您尝试加载的文件可能无效。它的语法无效。
以下代码适用于保存为 wsdl.xml 的有效 wsdl 文件。

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

Probably file you are trying to load is invalid. It has invalid syntax.
Following code should work for valid wsdl file saved as wsdl.xml.

from SOAPpy import WSDL
wsdlFile = open('wsdl.xml')
server = WSDL.Proxy(wsdlFile)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文