Forum OpenACS Development: Problem while sending an array to an axis2 web service

Request notifications

Hi,

I am trying to consume an axis2 web service which receives an array of strings as argument and returns a string. I am doing it using the xosoap package.

There are no problems in the service itself, it works when I construct the array using the ArrayBuilder: This is the code:

###########################################################################
set s4 [SoapGlueObject new \
  -endpoint "http://192.168.1.102:8080/WWS-Server/services/ArrayWS" \
  -callNamespace "http://server.com" \
]

ProxyObject ArrayWS -glueobject $s4

ArrayWS ad_proc -returns xsString setArray {
  -sarr:soapArray(xsString)<2>
} {} {}

set stringArray [ArrayBuilder new -type xsString -size 2]
set i [$stringArray new]
$i 0 hello
$i 1 world

set res [ArrayWS setArray -sarr $i]
###########################################################################

The problem is in the xml request generated. It is like this:
<setArray>
  <sarr>
      <member>hello</member>
      <member>world</member>
  </sarr>
</setArray>

While the server needs a xml request like this other:
<setArray>
  <sarr>hello</sarr>
  <sarr>world</sarr>
</setArray>

I would like to know if there are any different way to configure the GlueObject or construct the array to solve this problem.

Thanks in advance.

Javi.

Hi Javi!

Try the following (beware, this is untested!):

1) Set the marshalling style to document/literal:

set s4 [SoapGlueObject new \
-endpoint "http://192.168.1.102:8080/WWS-Server/services/ArrayWS" \
-callNamespace "http://server.com" \
-messageStyle "DocumentLiteral"
]

2) Change your Axis2 web service to run in RPC/literal mode (which is the default of xosoap).

Note that xosoap has never been fully tested regarding Document/Literal style marshalling.

//stefan

Hi Stefan

Thanks for your help.

Unfortunately I have to use Doc/literal style due to interoperability reasons, and when I pass the messageStyle parameter it produces this error even if I send a string:

-can't read "message": no such variable-

Are there any other way to consume this kind of service or should I to develop my own one?

Thanks again.

Javi