473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SOAPpy and ArrayOfString

Hello all,

I am trying to use a web services API with Python and SOAPpy as a
client. Some of the method paramters in this web service's WSDL are
asking for an "ArrayOfString" type. Here is my code so far:

#!/usr/bin/python

from SOAPpy import WSDL

wsdlFile =
'http://localhost:8080/axis/services/USD_R11_WebService?WSDL'

server = WSDL.Proxy(wsdlFile)

server.soapproxy.config.dumpSOAPOut = 1
server.soapproxy.config.dumpSOAPIn = 1

SID = server.login('srvcdesk', 'xxxxxxxx')

contacts = server.doSelect(SID, 'cnt', "userid = 'abeju01'", 1,
['last_name', 'first_name', 'userid'])
I tried using a simple Python list for the argument that wants
"ArrayOfString". Python generates the following XML for the last
argument of the "doSelect" command above:

<v5 SOAP-ENC:arrayType="xsd:string[3]" xsi:type="SOAP-ENC:Array">
<item>last_name</item>
<item>first_name</item>
<item>userid</item>
</v5>
The web service does not like this at all and returns the following
error:

SOAPpy.Types.faultType: <Fault soapenv:Server.userException:
org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -class
usdjws65.ArrayOfString): >
I know in Perl I had to do some special gyrations to pass the right
structue for ArrayOfString to this same web service. Is there any way
to force a type in Python or any other ideas on how to do this?

Jan 21 '07 #1
1 7668
Figured it out. This works:
#!/usr/bin/python

import SOAPpy

wsdlFile =
'http://localhost:8080/axis/services/USD_R11_WebService?WSDL'

server = SOAPpy.WSDL.Proxy(wsdlFile)

server.soapproxy.config.dumpSOAPOut = 1
server.soapproxy.config.dumpSOAPIn = 1

SID = server.login('srvcdesk', 'xxxxxxxxx')

attr = SOAPpy.structType()
attr._addItem('string', 'userid')
attr._addItem('string', 'last_name')
attr._addItem('string', 'first_name')

contacts = server.doSelect(SID, 'cnt', "userid = 'srvcdesk'", 1, attr)

print contacts

server.logout(SID)
The XML generated is very similar, but my web service seems to like
this for some reason...weird.

icius wrote:
Hello all,

I am trying to use a web services API with Python and SOAPpy as a
client. Some of the method paramters in this web service's WSDL are
asking for an "ArrayOfString" type. Here is my code so far:

#!/usr/bin/python

from SOAPpy import WSDL

wsdlFile =
'http://localhost:8080/axis/services/USD_R11_WebService?WSDL'

server = WSDL.Proxy(wsdlFile)

server.soapproxy.config.dumpSOAPOut = 1
server.soapproxy.config.dumpSOAPIn = 1

SID = server.login('srvcdesk', 'xxxxxxxx')

contacts = server.doSelect(SID, 'cnt', "userid = 'abeju01'", 1,
['last_name', 'first_name', 'userid'])
I tried using a simple Python list for the argument that wants
"ArrayOfString". Python generates the following XML for the last
argument of the "doSelect" command above:

<v5 SOAP-ENC:arrayType="xsd:string[3]" xsi:type="SOAP-ENC:Array">
<item>last_name</item>
<item>first_name</item>
<item>userid</item>
</v5>
The web service does not like this at all and returns the following
error:

SOAPpy.Types.faultType: <Fault soapenv:Server.userException:
org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -class
usdjws65.ArrayOfString): >
I know in Perl I had to do some special gyrations to pass the right
structue for ArrayOfString to this same web service. Is there any way
to force a type in Python or any other ideas on how to do this?
Jan 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vivek | last post by:
Hi, Can anyone provide me with sample code that will allow me to use SOAPpy with a WSDL file using HTTP basic authentication? The only thing I've been able to find on the net is...
0
by: Harry George | last post by:
I'm trying to setup a SOAPpy service under xinetd. Has someone done this sort of thing? Didn't find it from google searches or documentation. This is probably a sockets-level issue, but I was...
0
by: elsarfhem | last post by:
I have a problem with soappy when i try to send a python dictionary... i send something like this {'1':2,'3':4} and it returns something like this {'1':, '3':4} function on the server is simply an...
0
by: Bartas | last post by:
Hi, I'am writting a simple SOAP client in python (2.4) using SOAPpy lib. I've met with this problem: when I want to send a list of complex type using some method from WebService(java,WAS), ...
0
by: Sameer Deshpande | last post by:
Hi, I am using python SOAPpy module to call a web service. Call to web service gets executed successfully. I am facing a problem if the call to WS results into redirect. I get "HTTPError:...
0
by: benboals | last post by:
Note: this is in reply to a message from August 2 which i found searching for help on my own problem. I couldn't seem to reply to it, but a friend suggested that simply using the same subject...
0
by: linuxprog | last post by:
hi all i'm building a webservice client with soappy when i send some informations it's returns an error here is the informations that generates the error var = SOAPpy.structType()...
0
by: pion | last post by:
Hello I'm trying to make a web service client in python, and so to start out, I found this simple example that are supposed to parse an wsdl file using SOAPPy. I'm using Windows and got SOAPPy...
1
by: Christof Winter | last post by:
I am trying to use a webservice with SOAPpy: import SOAPpy intact_wsdl = "http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl" intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.