472,958 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 7641
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.