Hi Khalil,
What did you try yourself?
It should be something simple like:
import zeep
from zeep.wsse.username import UsernameToken
client = zeep.Client('wsdl-url', wsse=UserNameToken('Login', 'Password'))
result = client.service.getObjectId('System users',
'Carriers;Administration;System users
print (result)
See http://docs.python-zeep.org for more info
Cheers, Michael
On Thu, May 26, 2016 at 7:09 PM, Khalil Khamlichi <
[email protected]> wrote:
> Hi Michael,
>
> can you help me out convert this piece of php code into your library's
> code ? I have been mainly struggling with the :
>
> <soapenv:Header>
> <auth:Login>Login</auth:Login>
> <auth:Password>Password</auth:Password>
> </soapenv:Header>
>
> part
>
> I have received this script from our software provider as an example on
> how to use their soap API from php.
>
> #!/usr/bin/env php
> <?php
> // Creating a new SOAP client
> $client = new SoapClient(
> 'https://192.168.1.2/service/?wsdl_v2'
> );
> // Setting authentication headers
> $headers = array();
> // Write your password unencrypted as all the information goes through
> the secure SSL connection
> $headers[] = new SoapHeader('auth','Login','admin');
> $headers[] = new SoapHeader('auth','Password','admin');
> $client->__setSoapHeaders($headers);
> // ------- The main block begins here -------
> $obj_id = $client->getObjectId('System users',
> 'Carriers;Administration;System users');
> echo $obj_id;
> // ------- The main block ends here -------
> ?>
>
> The example also provides the XML request that this script generates :
>
> <!-- Creating a new SOAP client -->
> <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"
> <!-- DO NOT change http://provider_website.com/soap -->
> xmlns:soap="http://provider_website.com/soap" xmlns:auth="auth">
> <!-- Setting the authentication header -->
> <!-- Write your password unencrypted as all the information goes through
> the secure SSL connection -->
> <soapenv:Header>
> <auth:Login>Login</auth:Login>
> <auth:Password>Password</auth:Password>
> </soapenv:Header>
> <soapenv:Body>
> <!-- The main block begins here -->
> <soap:getObjectId soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/
> encoding/">
> <p_title xsi:type="xsd:string">System users</p_title>
> <p_path xsi:type="xsd:string">Carriers;Administration;System users</p_path>
> </soap:getObjectId>
> <!-- The main block ends here -->
> </soapenv:Body>
> </soapenv:Envelope>
>
> Thanks in advance,
>
> On Sun, Apr 17, 2016 at 7:02 PM, Michael van Tellingen <
> [email protected]> wrote:
>
>> Hi all,
>>
>> Although this list seems fairly inactive, i'll give it a shot anyhow.
>> I've just released a new version of python zeep (0.4.0) and would love to
>> get feedback on it. A small roundup of the features are:
>>
>> - Based on Requests / LXML and defusedxml
>> - Supports recursive wsdl and xsd documents (one of the usp's of this
>> lib)
>> - Supports the xsd:any and xsd:choice elements
>> - Works on py2, py3 and pypy
>>
>> The repository can be found at
>> https://github.com/mvantellingen/python-zeep and the documentation on
>> http://docs.python-zeep.org/
>>
>> PyPi url is https://pypi.python.org/pypi/zeep/
>>
>> Thanks,
>> Michael
>>
>>
>> _______________________________________________
>> Soap mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/soap
>>
>>
>
_______________________________________________
Soap mailing list
[email protected]
https://mail.python.org/mailman/listinfo/soap