Michael,
If you control both server and client, I recommend using java's built-in RMI
instead of SOAP web services.  The whole point of SOAP is so disparate
entities that you don't control may still interact.  JRMP - Java Remote
Messaging Protocol is the java-to-java protocol.
-Rob Cole.

-----Original Message-----
From: Michael Mattox [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 5:22 AM
To: [EMAIL PROTECTED]
Subject: Invalid element error with a Collection of Strings


I'm working on a project in which a client needs to send a request to a
server, the server will execute the request, and then the server returns the
result.  I'm writing both the client and the server (in Java of course) so
if there's any shortcuts I can take here because it's "Java only" that would
be great.  I've read through the Axis user guide and samples, but the
samples are very simple and I'm running into problems because I want to
return an array of objects, and each object has Collection of strings.  I
read that Axis supports serializing java collections (I'm using LinkedList)
but I can't get it to work.  On the server side things look fine.  In the
SOAP body I see (trimmed down a bit):

<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>
   <errors href="#id1"/>
  <multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xsi:type="soapenc:Array" soapenc:arrayType="xsd:anyType[2]"
xmlns:ns5="http://www.w3.org/2002/12/soap-encoding";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>
   <item xsi:type="xsd:string">TEST ERROR</item>
   <item xsi:type="xsd:string">TEST_ERROR2</item>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>


I see the same thing on the client side, so I know the errors got sent back.
But then I get an exception while deserializing the errors (I don't have a
custom serializer, I'm using whatever Axis provides):

12:24:13,858 DEBUG DeserializationContextImpl - Enter:
DeserializationContextImpl::startElement(, errors)
12:24:13,858 DEBUG ProjectResourceBundle -
org.apache.axis.i18n.resource::handleGetObject(badElem00)
12:24:13,858 DEBUG ProjectResourceBundle -
org.apache.axis.i18n.resource::handleGetObject(exception00)
12:24:13,868 ERROR Call - Exception:
org.xml.sax.SAXException: Invalid element in
com.verideon.siteguard.domain.MonitorStatus - errors
        at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
java:260)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:921)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
699)
        at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java
:404)
        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:934)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
699)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:331)
        at org.apache.axis.client.Call.invoke(Call.java:2200)
        at org.apache.axis.client.Call.invoke(Call.java:2099)
        at org.apache.axis.client.Call.invoke(Call.java:1622)

I'm not sure if this is a bug or if I'm doing something wrong.  If anyone
has any advice please let me know.  And if it looks like a bug I can file a
bug report.

Thanks,
Michael



Reply via email to