SOAP client, wsdl, python



我有带有WSDL和php-client的SOAP服务。

Php-client:

<?php
$client = new SoapClient('https://xx.xx.xx.xx/service/?wsdl');
$headers = array();
$headers[] = new SoapHeader('http://mfisoft.ru/auth','Login','admin');
$headers[] = new SoapHeader('http://mfisoft.ru/auth','Password','admin');
$client->__setSoapHeaders($headers);
$table_hi = $client->getTableByTitle('Blocked numbers');
$row_data = array(
    array(
                      array(
                              'name' => 'prfx',
                              'value' => '55555555'
                       ),
                      array(
                              'name' => 'blocking_time',
                              'value' => '20140306185014'
                       )
)
);
$rowset=$client->insertRowset($table_hi, $row_data);
?>

但是我需要重写python。我试着用泡沫和简单的肥皂来做。

from suds.client import Client
url = 'http://localhost/service/?wsdl'
client = Client(url)

我不明白如何制作类似的程序,特别是这些字符串

$headers[] = new SoapHeader('http://mfisoft.ru/auth','Login','admin');
$headers[] = new SoapHeader('http://mfisoft.ru/auth','Password','admin');
$client->__setSoapHeaders($headers);

我没有在泡沫文档中找到。我需要你的帮助。

提前谢谢。

附言对不起,我的英语不好

附言

我需要在 python 客户端中重写 php 客户端。

提前原谅格式.. 使用 SUDS 客户端设置和连接的正确方法如下。在您想要服务器部分的情况下,我无法从您的问题中分辨出 100%。.我也许能帮忙,但这不是我以前在 python 中做过的事情。

client = suds.client.Client.(self,url=wsdl_url,
                             doctor=schema_doctor,
                             username=username)
try:
    # This will throw an Exception if the wsdl_url is bad
    # and will return False if the authentication fails
    if not client.service.Connection_Authenticate(username,
                                                  password):
        raise Exception("Failed to authenticate.")

最新更新