我有一个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用户界面内进行此调用时,我没有遇到任何错误。 任何想法我做错了什么?