Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Send an array in XML-RPC?

rdietz

2008-08-27


Author LoginPost Reply
Hi all,

I'm using the Groovy xml-rpc library (v0.4) and trying to invoke an rpc
method that takes an array of data elements. Here is an example of the
code I'm using:

  def testArray = []
  3.times { i ->
   def entry = [:]
   entry.param1 = 'one'
   entry.param2 = 2 + i
   testArray << entry
  }
  def results = proxy.theMethod(testArray)

But the xml that is being sent is apparently incorrect (according to the
provider). I extracted some of the code from the xml-rpc source to try
and recreate the XML being sent and came up with this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<methodCall>
<methodName>method</methodName>
<params>
<param><value><struct><member><name>param1</name><value><string>one</string></value></member><member><name>param2</name><value><i4>2</i4></value></member></struct></value></param>
<param><value><struct><member><name>param1</name><value><string>one</string></value></member><member><name>param2</name><value><i4>3</i4></value></member></struct></value></param>
<param><value><struct><member><name>param1</name><value><string>one</string></value></member><member><name>param2</name><value><i4>4</i4></value></member></struct></value></param>
</params>
</methodCall>

According to the xml-rpc spec I shoulkd have an <array> element
somewhere in there. So I'm either using the package incorrectly or this
is a bug... I suspect the former.

Can anyone help?

cheers -- randall

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.