SOAPpy如何传递安全标头?

2024-05-14 22:59:16 发布

您现在位置:Python中文网/ 问答频道 /正文

Im目前正在为使用axis2ws-Security的应用程序开发pythonwebservice

简化的相关代码为

from SOAPpy import SOAPProxy
from SOAPpy import WSDL

file = 'path/to/my/file?wsdl'
server = WSDL.Proxy(file)

server.foo(bar)

这样做的时候我得到:

^{pr2}$

阅读Axis2WS-security和提供Web服务的应用程序的文档,我猜它在要求我进行用户令牌身份验证,比如

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-12468716">
<wsu:Created>
2008-06-23T13:17:13.841Z
</wsu:Created>
<wsu:Expires>
2008-06-23T13:22:13.841Z
</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-31571602">
<wsse:Username>
alice
</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
bobPW
</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>

当执行一个请求时,那么问:如何将此附加到SOAPpy请求?在


Tags: orghttpdocsopentimestampfilexsdsecurity
1条回答
网友
1楼 · 发布于 2024-05-14 22:59:16

查看有关向soapy请求添加头的文档(https://svn.origo.ethz.ch/playmobil/trunk/contrib/pywebsvcs/SOAPpy/docs/UsingHeaders.txt). 通过这种方式,您可以向任何请求添加您自己的自定义标头。在

希望这有帮助

相关问题 更多 >

    热门问题