简体   繁体   English

SOAP客户端,wsdl,python

[英]SOAP client, wsdl, python

I have SOAP service with WSDL and php-client for it. 我有WSDL和php-client的SOAP服务。

Php-client: PHP客户端:

<?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);
?>

But I need to rewrite the python. 但是我需要重写python。 I tried to do using suds and pysimplesoap. 我试图用肥皂水和pysimplesoap做。

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

I don't understand how make similar program in particular these strings 我不明白如何制作类似的程序,特别是这些字符串

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

I have not found in suds doc. 我在suds doc中找不到。 I need your help. 我需要你的帮助。

Thanks in advance. 提前致谢。

ps Sorry for my bad English ps对不起,我的英语不好

PSS PSS

I need to rewrite the php client in the python client. 我需要在python客户端中重写php客户端。

Forgive the formatting in advance.. the proper way to setup and connect using the suds client is as follows. 事先请避免格式化。使用suds客户端进行设置和连接的正确方法如下。 In the case that you want the server part, I can't tell 100% from your question.. I might be able to help but it's not something I've ever done before in python. 在您需要服务器部分的情况下,我不能从您的问题中说出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.")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM