我正在尝试使用Jerko SUDS生成对Vormetric密钥服务器的WSDL客户端调用,以显示平台上的密钥。我正在使用SUDS元素来构造SOAP消息。
from suds.client import Client
from suds.sax.element import Element
import ssl
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
ssl._create_default_https_context = ssl._create_unverified_context
url = 'https://<dkm>/communication-server/SSControllerCli?wsdl'
client = Client(url)
login = Element('loginInfo')
user = Element('userName').setText('xxx')
auth = Element('password').setText('xxx')
domain = Element('domainName').setText('xxx')
keyType = Element('switchKey').setText('All')
login.append(user)
login.append(auth)
login.append(domain)
result = client.service.ShowAllKeys(login, keyType)
print result
当我执行它时,它似乎工作,并生成一个好的SOAP消息,但是在尝试执行时遇到服务器错误。
DEBUG:suds.client:sending to (https://<dkm>/communication-server/SSControllerCli)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.vormetric.com/securityserver/clicommon/2010/02/26" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="htt
p://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:ShowAllKeys>
<loginInfo>
<userName>xxx</userName>
<password>xxx</password>
<domainName>xxx</domainName>
</loginInfo>
<switchKey>All</switchKey>
</ns0:ShowAllKeys>
</ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.client:HTTP failed - 500 - Internal Server Error:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>An internal error oc
curred on the Security Server. Refer to cgss.log and server.log for details. Call support if necessary.</faultstring><detail><CgssServerFaultDetail xmlns="http:
//www.vormetric.com/securityserver/clicommon/2010/02/26"><servername>***REMOVED***</servername><errorcode>DAO0038E</errorcode><errormessage>A
n internal error occurred on the Security Server. Refer to cgss.log and server.log for details. Call support if necessary.</errormessage></CgssServerFaultDetail
></detail></soap:Fault></soap:Body></soap:Envelope>
ERROR:suds.client:<suds.sax.document.Document instance at 0x0000000003E0BA48>
Traceback (most recent call last):
File "vorm-soap-suds.py", line 29, in <module>
result = client.service.ShowAllKeys(login, keyType)
File "build\bdist.win-amd64\egg\suds\client.py", line 521, in __call__
File "build\bdist.win-amd64\egg\suds\client.py", line 581, in invoke
File "build\bdist.win-amd64\egg\suds\client.py", line 619, in send
File "build\bdist.win-amd64\egg\suds\client.py", line 670, in process_reply
suds.WebFault: Server raised fault: 'An internal error occurred on the Security Server. Refer to cgss.log and server.log for details. Call support if necessary.
'
有趣的是,我知道消息结构本身很好,因为我可以将它放入Chrome Wizdler应用程序并且它完美运行,因此它似乎是SUDS特有的问题。
感谢任何帮助。
答案 0 :(得分:0)
自己遇到了这个问题。这可能与正在使用的信封/命名空间有关,这不再是当前的。 谈到这个: 的xmlns:SOAP-ENV = “http://schemas.xmlsoap.org/soap/envelope/” 在验证XML时,我得到了这个:
元素信封@ http://schemas.xmlsoap.org/soap/envelope/不是有效的信封@ http://www.w3.org/2003/05/soap-envelope文档或有效替代。