Solved

SOAPpy namespace problem

Posted on 2007-11-15
7
1,595 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 500 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

749 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