Python-Zeep错误-无法处理该消息

Python-Zeep错误-无法处理该消息,python,zeep,Python,Zeep,我正在尝试使用来自外部SOAP API的操作。这个API没有文档,所以我大部分时间都不知道。我收到一个在soapapi中工作的请求,所以我想尝试在Python中进行集成 我的zeep: wsdl = 'https://asp.external.se/apps/api/service.svc?wsdl' token = UsernameToken('username', 'password') client = Client(wsdl=wsdl, wsse=token) client.servic

我正在尝试使用来自外部SOAP API的操作。这个API没有文档,所以我大部分时间都不知道。我收到一个在soapapi中工作的请求,所以我想尝试在Python中进行集成

我的zeep:

wsdl = 'https://asp.external.se/apps/api/service.svc?wsdl'
token = UsernameToken('username', 'password')
client = Client(wsdl=wsdl, wsse=token)
client.service.GetCompanies()
我可以通过
client.services
选项卡查看所有操作,因此我知道WSDL设置正确。 但无论我尝试调用什么操作,都会出现此错误:

错误:无法处理该消息。这很可能是因为操作“www.external.com/services/apiservice/getcompanys”不正确,或者是因为消息包含无效或过期的安全上下文令牌,或者是因为绑定之间不匹配。如果服务因不活动而中止通道,则安全上下文令牌将无效。为了防止服务过早中止空闲会话,请增加服务端点绑定上的接收超时

我能想到的一件事是,在SOAP UI中工作的端点不是WSDL的默认端点,我必须手动在SOAP UI中添加“/endpoint2”。我不确定我是否能在zeep中做同样的事情

以下是在SOAP UI中工作的原始信封:

POST www.external.com/services/apiservice/endpoint2
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ".../GetCompanies"
Authorization: Basic Zm9hLWFwaTpGXFGUw==
Content-Length: 1030
Host: asp.external.se
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bril="www.external.com/services/apiservice">
   <soapenv:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="1">
         <wsse:UsernameToken wsu:Id="UsernameToken-DE48543B99D24B1D1597402523">
            <wsse:Username></wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"></wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">arhKkjhdKuO9yGGw==</wsse:Nonce>
            <wsu:Created>2020-08-19T09:59:34.025Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <a:GetCompanies />
   </soapenv:Body>
</soapenv:Envelope>
POST www.external.com/services/apiservice/endpoint2
接受编码:gzip,deflate
内容类型:text/xml;字符集=UTF-8
SOAPAction:“…/GetCompanys”
授权:基本ZM9HLWFWATPGFGUW==
内容长度:1030
主机:asp.external.se
连接:保持活力
用户代理:Apache HttpClient/4.1.1(java 1.5)
arhKkjhdKuO9yGGw==
2020-08-19T09:59:34.025Z