Return a value from a function result


O

Ombongi Moraa Fe

Hello Team,

My perl script "a.pl" calls python script "b.py" and passes arguments to
it; expecting a return value;

"b.py" uses suds to facilitate soap-based communication with another server
which then returns some value (deliveryStatus)

basically, my b.py script has these 3 major parts;

#part 1 of code to receive arguments from perl script and process them
accordingly
...........
..........
#part 2 of code - function to get delivery status
def deliveryStatus():
.....
return parameters # or return client.last_received()

#part 3- print output of the function
print deliveryStatus()



running b.py script with the "return parameters" prints this output:

[(DeliveryInformation){
address = "phone_number"
deliveryStatus = "DeliveredToNetwork"
}]


running the same script with "return client.last_received() " instead
prints the soap output

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope>
<soapenv:Body>
<ns1:deliveryStatusResp>
<ns1:result>
<address>phone_number</address>
<deliveryStatus>DeliveredToNetwork</deliveryStatus>
</ns1:result>
</ns1:deliveryStatusResp>
</soapenv:Body>
</soapenv:Envelope>


With either kind of output returned to my perl script, my table entry is
updated as "failed" since the returned value is basically an undefined
value; what I need therefore is a way to return only the value
"DeliveredToNetwork" so that the database update on my perl script could be
correct; A solution using either the soap output or the array output will
be appreciated.

Someone help me. Thanks in advance.


Saludos

Ombongi Moraa Faith
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top