セットアップで泡が機能しないようです。API の関数を使用する前に、リモート ユーザーを設定してコンテキストを渡す必要があります。私がやろうとしたことはこれでした:
client = Client(url, username=userid, password=password)
apiContext = client.factory.create("apiCallContext") # This is listed in the types
apiContext.remoteUser = "serviceAccount" # when I print the client
client.set_options(soapheaders=apiContext)
client.service.getActiveIPs()
プロセス全体を通して、すべてが正しく作成されているように見えます (クライアントを印刷すると、すべての関数と型が表示され、apiContext を印刷すると、すべてが正しく設定されていることがわかります)、ヘッダーは実際には設定されていないようです。 :
...
DEBUG:suds.client:sending to ($URL) message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0=$NS
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:getActiveIPs/>
</ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction': u'""',
'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.transport.http:sending:
URL:$URL
HEADERS: {'SOAPAction': u'""', 'Content-Type': 'text/xml; charset=utf-8',
'Content-type': 'text/xml; charset=utf-8', 'Soapaction': u'""'}
...
ヘッダーのどこにもコンテキストが表示されず、サーバーはリモート ユーザー セットがないというエラーを出しています。
私は何を間違っていますか?