Solved

SOAPpy namespace problem

Posted on 2007-11-15
7
1,582 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with my python script 6 154
How Do You Use MacPorts & Python To Create A Program? 22 70
CSS HELP 6 83
Turning python script into an applet 12 99
Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

948 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

21 Experts available now in Live!

Get 1:1 Help Now