[Soap-Python] php script to python script

Chris Beck cbeck at railkey.net
Thu May 26 13:46:17 EDT 2016


Hi Khalil,

Can you provide an example of what you are doing?

On Thu, May 5, 2016 at 2:09 PM, Khalil Khamlichi <khamlichi.khalil at gmail.com
> wrote:

> Hi everyone,
>
> 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>
>
> Can anyone help me with similar script in functionality in the python
> language, I basically am stuck on the auth headers, I am always getting :
> wrong credential error message.
>
> Thanks in advance.
>
>
> Khalil Khamlichi
>
>
>
>
> _______________________________________________
> Soap mailing list
> Soap at python.org
> https://mail.python.org/mailman/listinfo/soap
>
>


-- 
Christopher Beck
cbeck at railkey.net
+1.514.431.7759
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20160526/27abd5a4/attachment.html>


More information about the Soap mailing list