Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SOAPpy namespace problem

Posted on 2007-11-15
7
Medium Priority
?
1,610 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 

Author Comment

by:aranginw
ID: 20290134
Increase points to 500.  
0
 
LVL 14

Accepted Solution

by:
RichieHindle earned 2000 total points
ID: 20297420
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
ID: 20298866
I am using SOAPpy.  I have tried similar things, but I will try what you're saying and get back to you.  Thanks.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:aranginw
ID: 20320353
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
ID: 20320681
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
ID: 20321341
No, I haven't tried that.  I'll use that link.  Thanks Richie.
0
 

Author Closing Comment

by:aranginw
ID: 31409338
Richie,
You know what... that DID work!  Thanks!
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

604 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