You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Patrick van Kann <pa...@fortune-cookie.com> on 2005/03/30 14:26:44 UTC

Is there a bug with Axis webservice methods returning arrays?

I posted a question yesterday about a problem I had with a webmethod returning an array i.e:
public TestData[] getTestsAsArray()

I thought it was to do with the fact that I was using Castor serializers/deserializers.

However, I have re-tested it with the standard Axis Bean serializers and generated data classes and get exactly the same error - which I believe is because the soap message returned is not valid xml (see below).
[java] Exception caught org.xml.sax.SAXParseException: Element type "ns1:te
stData" must be followed by either attribute specifications, ">" or "/>".
[java] AxisFault

So is there a general Axis problem with returning typed arrays in a document/wrapped webservice? I noticed on this wiki page that such a problem has existed before:
http://wiki.apache.org/ws/DotNetInteropArrays

Unfortunately no bugzilla id is mentioned so I can't be sure. I'd really appreciate some insight as at the moment I am compelled to wrap my arrays in another complex type (i.e. TestDataArrayWrapper) and return this from the webservice instead. This seems to work but it does seem a little clunky.

The SOAP message returned is below.

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"    
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getTestsAsArrayResponse 
      xmlns="http://www.fortune-cookie.com/schemas/services/timesheet/wsdl">
      <ns1:testData[,unbounded] 	
        xmlns:ns1="http://www.fortune-cookie.com/schemas/services/timesheet/data">
	    <name xmlns="">test1</name>
      </ns1:testData[,unbounded]>
    </getTestsAsArrayResponse>
  </soapenv:Body>
</soapenv:Envelope>

It is the [,unbounded] part that seems to be causing the problem.

Thanks in advance,

Patrick