Solved

SOAPpy namespace problem

Posted on 2007-11-15
7
1,578 Views
Last Modified: 2013-11-18
Experts,
I am attempting to use SOAPpy to send SOAP messages.  Here is a sample of what I'm executing:
from SOAPpy import SOAPProxy

url = 'http://192.168.10.128:8080/ws/SessionLogin?wsdl'

# define the namespace
namespace = 'http://whatever.org'
server = SOAPProxy(url)

print server._ns(namespace).login(String_1 = "<TSSLogin Username='username' Password='password' \>")


Which results in the following string being sent:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Body>
<ns1:login xmlns:ns1="http://www.tamalesoftware.com/ws/SessionLogin" SOAP-ENC:ro
ot="1">
<String_1 xsi:type="xsd:string">&lt;TSSLogin Username="admin" Password="admin" /
&gt;</String_1>
</ns1:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


I need the String_1 element to read <ns1:String_1
meaning with the namespace...
How do I accomplish that?

Thanks.
Asim
0
Comment
Question by:aranginw
  • 5
  • 2
7 Comments
 

Author Comment

by:aranginw
Comment Utility
Increase points to 500.  
0
 
LVL 14

Accepted Solution

by:
RichieHindle earned 500 total points
Comment Utility
I don't know anything about the SOAP library you're using so I can't help with a "proper" solution, but here's a hack that might work.    It might fool the library into sending the request in the form you need it.

# Rather than this:

print server._ns(namespace).login(String_1 = "...")
 

# Try this:

arguments = {'ns1:String_1': "..."}

print server._ns(namespace).login(**arguments)

Open in new window

0
 

Author Comment

by:aranginw
Comment Utility
I am using SOAPpy.  I have tried similar things, but I will try what you're saying and get back to you.  Thanks.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:aranginw
Comment Utility
It doesn't give me what I need.  I need the parameter to be String_1 with the namespace set to ns1

I have still not found anything else, still looking.  Any other suggestions?

Asim
0
 
LVL 14

Expert Comment

by:RichieHindle
Comment Utility
I don't have any more suggestions, I'm afraid.  Have you tried the pywebsvcs mailing list at https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk ?
0
 

Author Comment

by:aranginw
Comment Utility
No, I haven't tried that.  I'll use that link.  Thanks Richie.
0
 

Author Closing Comment

by:aranginw
Comment Utility
Richie,
You know what... that DID work!  Thanks!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to run file 9 90
AngularJS directive issue 6 53
site launch date and last modified date 3 49
Problem to Popup 2 48
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now