- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想使用一个需要身份验证的 PHP SOAP 网络服务。然而,用户名和密码不需要在 HTTP header 中传递,而是作为 SOAP 参数传递。我只有一个运行查询的 PHP(工作)示例:
$soap_client->getCurrentOrderCustomers(array("user" => 'root', "password" => 'toor'));
这工作正常并创建以下请求:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="https://example.com/webservice/interface_bi.php" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getCurrentOrderCustomers>
<param0 xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">user</key>
<value xsi:type="xsd:string">root</value>
</item>
<item>
<key xsi:type="xsd:string">password</key>
<value xsi:type="xsd:string">toor</value>
</item>
</param0>
</ns1:getCurrentOrderCustomers>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
假设客户端已正确创建(确实如此),我尝试在 Python 中执行以下操作:
result = ws_client.service.getCurrentOrderCustomers({'user':'root','password':'toor'})
还有这个:
result = ws_client.service.getCurrentOrderCustomers(user='root',password='toor')
但是它们都导致以下请求,没有参数:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="https://example.com/webservice/interface_bi.php" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns2:getCurrentOrderCustomers/>
</ns1:Body>
</SOAP-ENV:Envelope>
如果有人建议如何将参数传递给 webservice 函数以获得所需的请求,我将不胜感激。提前致谢。
最佳答案
我认为 - SOAP 服务 WSDL 告诉我们如何将参数传递给 SOAP 方法。我尝试使用 suds 遵循以下代码 Python 和 SOAP 调用对我来说效果很好。
第 4 行 - 打印客户端显示所有带参数的 soap 方法
from suds.client import Client
url="http://www.dneonline.com/calculator.asmx?wsdl"
client = Client(url)
print client ## shows the details of this service
result = client.service.Multiply(10, 5)
print result
下面是上面脚本的输出
@ Pawel Sopel - 如果您分享您的 WSDL,我可以进一步调查。
关于python - 使用 SUDS 将多个参数传递给 SOAP web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42366008/
我正在使用 python suds基于本地 wsdl 文件制作 SOAP 客户端的库。我的目标是使用 Twisted 作为后端,因此我以异步方式查询 SOAP 服务器。 我知道这个话题已经被讨论过不同
我正在使用 Suds 从 Python 访问 SOAP Web 服务。如果我有多个 threading.Thread 执行线程,它们中的每一个都可以安全地同时访问同一个 suds.client.Cli
我有一个 django 应用程序...我正在使用 SOAP suds 客户端访问 Web 服务...我需要从在 GUI 中输入的条目创建一个用户对象...这个用户对象将被传递给一个方法。 ..但我收到
Python 新手。尝试使用 Python 构建一个简单的 soap 客户端。相同的程序在不涉及代理的环境中工作。 ***********Version 1 import suds import ur
我很确定suds不会缓存我的WSDL和XSD的like I expect it to。这是我知道不使用缓存对象的方式: 创建客户端大约需要30秒:client = Client(url) 记录器条目显
我在 wsdl 中的复杂类型方面遇到了一些麻烦。这是 wsdl 的一部分:
我正在尝试使用 suds 连接到本地网络上的 KnowledgeTree 网络服务。我可以创建客户端并检索服务信息,但是调用那里列出的 login 方法会产生 suds.WebFault: Serve
尝试使用 echosign SOAP API。 wsdl 在这里:https://secure.echosign.com/services/EchoSignDocumentService14?wsdl
我正在尝试让泡沫连接到任何东西。这是我第一次使用它。我输入的每个网址都会返回一个错误。这是我的代码;几乎完全从不同的线程复制。 from suds.client import Client url =
Trying below code to check suds working Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.
首先我要说的是,我对 SOAP 以及事情应该如何工作还很陌生。我正在使用 Vertical Response API。 我无法让 suds 为请求正确构建 xml。这是一些代码: from suds.
环境:Python 2.7.4(部分在 Windows 上,部分在 Linux 上,见下文),suds(SVN HEAD 稍作修改) 我需要调用一个采用单个参数的 Web 服务,该参数是一个 XML
我是 Python 和 suds 新手。使用 SOAP UI,对我的服务的调用如下所示: " xmlns:ns1="">
代码: security = Security() token = UsernameToken('b77a5c561934e089', 'kmfHkNZyn1U/pGAiY3+h0BoHdKI=')
我正在尝试将 PHP 脚本转换为 python,但终究无法弄清楚为什么以下代码不起作用。 从 SOAP 服务查询返回的结果: Suds ( https://fedorahosted.org/suds/
我很难让基于 suds 的 python SOAP 客户端来解析响应:客户端构造正确并且可以很好地解析 WSDL。据我所知,WSDL 中没有任何导入,因此这看起来不像是典型的 ImportDoctor
我正在尝试使用 salesforce-python-toolkit 对 Salesforce API 进行 Web 服务调用,但是我无法让客户端通过代理。由于该工具包基于 suds,我尝试继续使用 s
我正在研究 SUDS 作为 python 的 SOAP 客户端。我想检查指定服务中可用的方法,以及指定方法所需的类型。 目的是生成用户界面,允许用户选择方法,然后在动态生成的表单中填写值。 我可以获得
我正在努力解决一个非常简单的问题。我无法在 SUDS jurko 连接上设置 session 超时。我的 WSDL 很好。提取较小的数据集时一切正常。我尝试了几种设置超时的方法。虽然以下内容没有提示/
几年前,我使用 Python SUDS 连接到 Web 服务以进行冒烟测试。 Python 脚本将使用 SUDS 连接到 WSDL 文件并将 SOAP 消息发送到 Web 服务。然后 SUDS 将解析
我是一名优秀的程序员,十分优秀!