Python SUDS不包括参数

2024-10-04 05:28:43 发布

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

我不熟悉Python和suds。使用SOAP UI,对我的服务的调用如下所示:

<soapenv:Envelope 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns="<URL to service>" 
    xmlns:ns1="<URL to second namespace>">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:AuthenticateCaller>
         <!--Optional:-->
         <ns:request>
            <ns1:LoanAccountNumber>292206816</ns1:LoanAccountNumber>
         </ns:request>
      </ns:AuthenticateCaller>
   </soapenv:Body>
</soapenv:Envelope>

我用肥皂水尝试了以下几种方法:

^{pr2}$

生成的XML如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
    xmlns:ns0="<URL to service>" 
    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:AuthenticateCaller/>
   </ns1:Body>
</SOAP-ENV:Envelope>

调用中缺少LoanAccountNumber参数,该参数是API的键。它还缺少第二个命名空间,我认为ImportDoctor应该修复它。在

我的问题是,我遗漏了什么,LoanAccountNumber没有包含在对API的调用中。在


Tags: orgenvhttpbodyschemassoapenvelopens
1条回答
网友
1楼 · 发布于 2024-10-04 05:28:43

以下说明似乎对您有帮助:

首先,您必须在代码中打印Client瞬间,即client,因此您可以看到如下内容:

Suds ( https://fedorahosted.org/suds/ )  version: 0.4 GA  build: R699-20100913

Service ( YourService_cmV6YW9ubGluZS5uZXQ= )  tns="http://www.yourservice.com/soap/YourService_cmV6YW9ubGluZS5uZXQ="
   Prefixes (1)
  ns0 = "http://schemas.xmlsoap.org/soap/encoding/"
   Ports (1):
  (YourService_cmV6YW9ubGluZS5uZXQ=Port)
     Methods (2):
        your_method(xs:string _your_param)
     Types (48):
        ns0:Array
        ns0:ENTITIES
        ns0:ENTITY
        ns0:ID
        ns0:NOTATION
        ns0:Name
        ns0:QName
        ns0:Struct
        ns0:anyURI
        ns0:arrayCoordinate
        ns0:base64
        ns0:base64Binary
        ns0:boolean
        ns0:byte
        ns0:date
        ns0:dateTime
        ns0:decimal
        ns0:double
        ns0:duration
        ns0:float
        ns0:hexBinary
        ns0:int
        ns0:integer
        ns0:language
        ns0:long
        ns0:negativeInteger
        ns0:positiveInteger
        ns0:short
        ns0:string
        ns0:time
        ns0:token

然后找到合适的参数类型,并按以下方式创建参数:

^{pr2}$

(复杂类型遵循复杂方式!)在

现在,可以按如下方式调用方法:

client.service.your_method(your_param)

好好享受吧!在

相关问题 更多 >