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 "matthew.hawthorne" <ma...@apache.org> on 2004/05/21 20:22:07 UTC

is it possible to use Collections with client proxies?

I've recently attempted to switch the way that I create my web service
clients, from manually configuring Call objects, to
obtaining a reference to an instance of the service interface as a
stub/proxy.  However, I am unable to get this working
when a method has a Collection as a return type or parameter.

Before, I believe that the call to:
Call.setReturnType(Collection.class)
was instructing Axis to handle these types correctly.

However now, since I'm invoking service methods directly on an
interface, I get a ClassCastException on the client side, after the data
has been returned.  If I call a method that returns an array, it works fine.

When attempting to invoke a method which includes a Collection as a
parameter, I get the following error:

Caused by: org.xml.sax.SAXException: No deserializer defined for array
type {http://localhost:8080/axis/services/Iava}ArrayOf_tns3_anyType
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:223)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:130)
	at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1053)
	at com.bluecast.xml.Piccolo.reportEndTag(Piccolo.java:1059)
	at com.bluecast.xml.PiccoloLexer.parseCloseTagNS(PiccoloLexer.java:2154)
	at com.bluecast.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1338)
	at com.bluecast.xml.PiccoloLexer.parseXMLNS(PiccoloLexer.java:1272)
	at com.bluecast.xml.PiccoloLexer.parseXML(PiccoloLexer.java:1240)
	at com.bluecast.xml.PiccoloLexer.yylex(PiccoloLexer.java:4754)
	at com.bluecast.xml.Piccolo.yylex(Piccolo.java:1253)
	at com.bluecast.xml.Piccolo.yyparse(Piccolo.java:1363)
	at com.bluecast.xml.Piccolo.parse(Piccolo.java:702)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:218)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:568)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:427)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2708)
	at org.apache.axis.client.Call.invoke(Call.java:2671)
	at org.apache.axis.client.Call.invoke(Call.java:2357)
	at org.apache.axis.client.Call.invoke(Call.java:2280)
	at org.apache.axis.client.Call.invoke(Call.java:1741)
	at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:156)


Thanks in advance for any help or information that anyone can provide.
I've started to read that Collections aren't directly supported
by JAX-RPC, or SOAP.  Is this true?  It looks like I should start
switching my methods to return arrays instead of collections, but I'd
prefer to find a workaround for now.


RE: is it possible to use Collections with client proxies?

Posted by Anne Thomas Manes <an...@manes.net>.
You should switch to arrays.

Anne

-----Original Message-----
From: matthew.hawthorne [mailto:matth@apache.org] 
Sent: Friday, May 21, 2004 2:22 PM
To: axis-user@ws.apache.org
Subject: is it possible to use Collections with client proxies?

I've recently attempted to switch the way that I create my web service
clients, from manually configuring Call objects, to
obtaining a reference to an instance of the service interface as a
stub/proxy.  However, I am unable to get this working
when a method has a Collection as a return type or parameter.

Before, I believe that the call to:
Call.setReturnType(Collection.class)
was instructing Axis to handle these types correctly.

However now, since I'm invoking service methods directly on an
interface, I get a ClassCastException on the client side, after the data
has been returned.  If I call a method that returns an array, it works fine.

When attempting to invoke a method which includes a Collection as a
parameter, I get the following error:

Caused by: org.xml.sax.SAXException: No deserializer defined for array
type {http://localhost:8080/axis/services/Iava}ArrayOf_tns3_anyType
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:2
23)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:13
0)
	at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Deserializati
onContextImpl.java:1053)
	at com.bluecast.xml.Piccolo.reportEndTag(Piccolo.java:1059)
	at
com.bluecast.xml.PiccoloLexer.parseCloseTagNS(PiccoloLexer.java:2154)
	at com.bluecast.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1338)
	at com.bluecast.xml.PiccoloLexer.parseXMLNS(PiccoloLexer.java:1272)
	at com.bluecast.xml.PiccoloLexer.parseXML(PiccoloLexer.java:1240)
	at com.bluecast.xml.PiccoloLexer.yylex(PiccoloLexer.java:4754)
	at com.bluecast.xml.Piccolo.yylex(Piccolo.java:1253)
	at com.bluecast.xml.Piccolo.yyparse(Piccolo.java:1363)
	at com.bluecast.xml.Piccolo.parse(Piccolo.java:702)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationCon
textImpl.java:218)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:568)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:427)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2708)
	at org.apache.axis.client.Call.invoke(Call.java:2671)
	at org.apache.axis.client.Call.invoke(Call.java:2357)
	at org.apache.axis.client.Call.invoke(Call.java:2280)
	at org.apache.axis.client.Call.invoke(Call.java:1741)
	at
org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:156)


Thanks in advance for any help or information that anyone can provide.
I've started to read that Collections aren't directly supported
by JAX-RPC, or SOAP.  Is this true?  It looks like I should start
switching my methods to return arrays instead of collections, but I'd
prefer to find a workaround for now.