0
sudsクライアントを使用してapiにリクエストを送信しようとしています。sudsクライアントのヘッダを正しく設定する方法
要求は、このように形成されています
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://API">
<soapenv:Header>
<v20:apiHeader>
<v20:username>username</v20:username>
<v20:password>password</v20:password>
<!--Optional:-->
<v20:name>?</v20:name>
</v20:apiHeader>
</soapenv:Header>
<soapenv:Body>
<v20:getLoginDetails/>
</soapenv:Body>
</soapenv:Envelope>
私はこのような要求を送信しています:
client = Client('https://wsdl', faults=False)
client.set_options(headers={'username': username 'authToken': auth_token, 'name': ''})
client.service.getLoginDetails()
私は受け付けており、エラーがある:
(<HTTPStatus.INTERNAL_SERVER_ERROR: 500>, (Fault){
faultcode = "soap:Server"
faultstring = "apiHeader should not be null"
detail = ""
})
はこれですどのように私は要求を送信する必要がありますか?それは間違いなく私が思うapiHeaderと関係があります。わからないが、私はこの使用して同じエラーが何を得る:
username = Element('username').setText(name)
password= Element('password').setText(pass)
header_list = [username, pass]
self.client.set_options(soapheaders=header_list)
return self.client.service.getLoginDetails()