Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42808

Re: Passing soap response to python script

Date 2013-04-05 15:06 +0300
From Burak Arslan <burak.arslan@arskom.com.tr>
Subject Re: Passing soap response to python script
References <CAM6w3npP07XpQkDOYOZqiK4eQkn57V5kHvhSc5Q0fa82CJnYBg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.134.1365163586.3114.python-list@python.org> (permalink)

Show all headers | View raw


Hello,

On 04/05/13 12:52, Ombongi Moraa Fe wrote:
> Hello Group,
>
> I am newbie to python and getting my way around. However, my first project
> that introduced me to the language deals with SOAP requests.

Before going any further, there's a project called "suds" which 
implements a soap client. If the service you're consuming exposes a WSDL 
document, it's very easy to get started with suds. Here's its home page: 
https://fedorahosted.org/suds/


> The server I communicate with basically sends me 2 soap responses; One with
> a requestIdentifier which I should use to query the delivery status of the
> message originally sent. Therefore, my main.py script already calls the
> client.last_received() which contains 1 value for requestIdentifier.
>
> I have another script getDelivery.py; In this script I need to pass 6
> parameters which we used in the main.py script and add the
> requestIdentifier parameter - total 7 paramters.
>
> I want to call the getDelivery.py script at the end of main.py script after
> the client.last_received().
>
> q1) How do I get the requestIdentifier parameter that is received through
> the client.last_received() method call?
>
> q2)  How do I pass these 7 parameters to the method call from the main.py
> script?
>
> q3) And how do I receive these passed parameters in the getDelivery.py
> script?

It's a bit difficult to answer as you didn't provide any source code, 
but let me try.

First, please modify the code inside getDelivery.py to be inside a 
function. for argument's sake, let's say it's called 'some_function'. 
Then, in the main.py, you can import the function and call it. Assuming 
getDelivery.py and main.py are in the same directory, this should work:

from getDelivery import some_function

def main():
     # some code that defines the 6 other parameters somehow
     # (...)

     last = client.last_received

     some_function(param1, param2, param3, param4, param5, param6, last)

> I am conversant with the php post/get but still having trouble doing the
> same in python. I've checked on urllib2 and request modules but still
> having trouble understanding their implementation.

First, just to confirm: urllib2 is a http client library. It's not a 
http server.

The most fashionable http client library in the python world nowadays is 
requests: http://www.python-requests.org/

It's pretty easy to use and actually, it wraps urllib2. You can give it 
a try.

I hope that helps.

Best regards,
Burak

PS: If you're not sure about how to install Python packages, I'm sure a 
quick google would turn return a lot of resources.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Passing soap response to python script Burak Arslan <burak.arslan@arskom.com.tr> - 2013-04-05 15:06 +0300

csiph-web