SOAPpy的复杂类型问题

2024-09-29 17:21:46 发布

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

我试图从HP Server Automation访问WSDL中定义的函数,我可以获取服务器/etc,但无法通过SOAPpy获取任何需要服务器引用的内容。在

import SOAPpy
from SOAPpy import WSDL
from SOAPpy import structType

SOAPpy.Config.debug=1
server = WSDL.Proxy('ServerService.wsdl')

serverRef = structType(name='self', typed=0)
serverRef._addItem('id',SOAPpy.longType(19250001))

print server.getCustAttr(serverRef,key='HPSW_ED_win32_diskspace',useScope=False)

The SOAP envelope generated from this code looks like this:
*** Outgoing SOAP ******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsd2="http://www.w3.org/2000/10/XMLSchema"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Body>
<ns1:getCustAttr xmlns:ns1="http://server.opsware.com" SOAP-ENC:root="1">
<xsd:self>
<id xsi:type="xsd2:long">19250001</id>
</xsd:self>
<useScope xsi:type="xsd:boolean">False</useScope>
<key xsi:type="xsd:string">HPSW_ED_win32_diskspace</key>
</ns1:getCustAttr>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

它应该是这样的(通过SOAPUI成功运行):

^{pr2}$

我相信问题是xsi:类型="服务器参考号“没有设置,也不确定如何使用SOAPpy。。。在


Tags: fromorgimportself服务器envhttpserver
1条回答
网友
1楼 · 发布于 2024-09-29 17:21:46

有两种不同类型的soap样式(RPC literal and Document literal),看起来上面提到的soap服务器只支持RPC

我看到了肥皂水和肥皂水的问题。经过一些测试和基准测试,我发现了问题所在。 ASP.NET还有索比。您需要使用python而不是document-literal信封样式生成rpc信封。在

只要ZSI(The Zolera Soap Infrastructure)与asp.net以及复杂的类型。在

此命令为您生成客户端代理:

wsdl2py http://terraservice.net/TerraService.asmx?WSDL

您可以在代码中导入生成的模块并使用web方法。在

相关问题 更多 >

    热门问题