如何在python中使用soapzeep登录到网站。检查pos的xml

2024-03-29 05:31:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我的wsdl登录方法xml:

Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Login"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <EhelplineWebAPISecurityContext xmlns="http://tempuri.org/">
      <SessionId>string</SessionId>
      <EHLWebServiceAPIKey>string</EHLWebServiceAPIKey>
    </EhelplineWebAPISecurityContext>
  </soap:Header>
  <soap:Body>
    <Login xmlns="http://tempuri.org/">
      <LoginId>string</LoginId>
      <password>string</password>
    </Login>
  </soap:Body>
</soap:Envelope>

登录方法在wsdl中。在

^{pr2}$

但是我得到了这个错误。在

File "C:/Python27/zeeplogin.py", line 7, in <module>
    client = client.service.Login(LoginId="id",password="password")
  File "C:\Python27\lib\site-packages\zeep\client.py", line 41, in __call__
    self._op_name, args, kwargs)
  File "C:\Python27\lib\site-packages\zeep\wsdl\bindings\soap.py", line 121, in send
    return self.process_reply(client, operation_obj, response)
  File "C:\Python27\lib\site-packages\zeep\wsdl\bindings\soap.py", line 178, in process_reply
    return self.process_error(doc, operation)
  File "C:\Python27\lib\site-packages\zeep\wsdl\bindings\soap.py", line 280, in process_error
    detail=fault_node.find('detail'))
Fault: Object reference not set to an instance of an object.

我的登录名和密码是正确的。在


Tags: inpyorgclienthttpstringlibline
1条回答
网友
1楼 · 发布于 2024-03-29 05:31:02

你试过这个吗?在

from zeep import Client
URL="wsdl url"
from zeep import Client
from zeep.transports import Transport
from requests import Session
client= Client(URL)
client = client.service.Login("id","password")

相关问题 更多 >