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


Groups > comp.lang.python > #42808

Re: Passing soap response to python script

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <burak.arslan@arskom.com.tr>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'parameters': 0.04; 'newbie': 0.05; 'modify': 0.07; 'soap': 0.07; 'urllib2': 0.07; 'assuming': 0.09; 'defines': 0.09; 'http': 0.09; 'implements': 0.09; 'parameter': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'burak': 0.16; 'call?': 0.16; 'confirm:': 0.16; 'from:addr:arskom.com.tr': 0.16; 'from:addr:burak.arslan': 0.16; 'from:name:burak arslan': 0.16; 'helps.': 0.16; 'last)': 0.16; 'main():': 0.16; 'message- id:@arskom.com.tr': 0.16; 'nowadays': 0.16; 'received:arskomhosting.com': 0.16; 'sake,': 0.16; 'script?': 0.16; 'wraps': 0.16; 'subject:python': 0.16; 'language': 0.16; 'wrote:': 0.18; 'library': 0.18; 'bit': 0.19; 'basically': 0.19; 'received:10.0.1': 0.19; 'code,': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'install': 0.23; 'header:User- Agent:1': 0.23; 'sends': 0.24; 'server.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'source': 0.25; 'script': 0.25; 'first,': 0.26; 'query': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'originally': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; "skip:' 10": 0.31; 'directory,': 0.31; 'work:': 0.31; 'checked': 0.32; 'another': 0.32; 'trouble': 0.34; 'but': 0.35; 'google': 0.35; 'add': 0.35; 'library.': 0.36; 'doing': 0.36; "didn't": 0.36; 'method': 0.36; 'received:10.0': 0.36; 'url:org': 0.36; 'should': 0.36; 'turn': 0.37; 'project': 0.37; 'received:10': 0.37; 'server': 0.38; 'sure': 0.39; 'called': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'around.': 0.60; 'then,': 0.60; 'most': 0.60; 'hope': 0.61; 'introduced': 0.61; "you're": 0.61; 'first': 0.61; 'group,': 0.63; 'therefore,': 0.64; 'provide': 0.64; 'total': 0.65; 'deals': 0.65; 'to:addr:gmail.com': 0.65; 'world': 0.66; 'home': 0.69; 'receive': 0.70; 'further,': 0.74; 'actually,': 0.84; 'subject:response': 0.91; 'try.': 0.91
Date Fri, 05 Apr 2013 15:06:07 +0300
From Burak Arslan <burak.arslan@arskom.com.tr>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130327 Thunderbird/17.0.4
MIME-Version 1.0
To Ombongi Moraa Fe <moraa.lovetakes2@gmail.com>
Subject Re: Passing soap response to python script
References <CAM6w3npP07XpQkDOYOZqiK4eQkn57V5kHvhSc5Q0fa82CJnYBg@mail.gmail.com>
In-Reply-To <CAM6w3npP07XpQkDOYOZqiK4eQkn57V5kHvhSc5Q0fa82CJnYBg@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.134.1365163586.3114.python-list@python.org> (permalink)
Lines 74
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365163586 news.xs4all.nl 6868 [2001:888:2000:d::a6]:52236
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42808

Show key headers only | 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