我有一個WSDL文件無法通過認證paramethers
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:TestWebService">
<soapenv:Header>
<urn:AuthenticationInfo>
<urn:userName>test</urn:userName>
<urn:password>test</urn:password>
<!--Optional:-->
<urn:authentication></urn:authentication>
<!--Optional:-->
<urn:locale></urn:locale>
<!--Optional:-->
<urn:timeZone></urn:timeZone>
</urn:AuthenticationInfo>
</soapenv:Header>
<soapenv:Body>
<urn:Pokupi>
<urn:Request_ID__c>000000000000141</urn:Request_ID__c>
</urn:Pokupi>
</soapenv:Body>
</soapenv:Envelope>
我在Python代碼如下:
#import zeep
from suds.client import Client
from suds import WebFault
from suds.sax.element import Element
url = 'http://bmc2012.comtrade.co.yu:8080/arsys/WSDL/public/BMC2012/TestWebService'
user = "test"
password = "test"
ssnp = Element("xsi:AuthenticationInfo").append(Element('xsi:userName').setText(user))
ssnp = Element("xsi:AuthenticationInfo").append(Element('xsi:password').setText(password))
client = Client(url)
client.set_options(soapheaders=ssnp)
record = client.factory.create('Pokupi')
result = client.service.Pokupi(record)
print result
#client = zeep.Client(url)
#print (client.service.Pokupi('000000000000141'))
而不是在響應中獲取數據,我不斷收到錯誤信息: 控制記錄中必須提供用戶名
我試過zeep和suds庫,但我無法傳遞此消息。當我在SOPA用戶界面內進行此調用時,我沒有遇到任何錯誤。 任何想法我做錯了什麼?