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 "Besecker, Kyle" <Ky...@Teradata.com> on 2009/06/23 21:34:19 UTC

Problem serializing array of complex types

I created a web-service and it works great for low level complexity
stuff. However, when I attempt to send arrays from the service, I begin
to run into trouble.

Initially I attempted to send an array of custom objects. I was able to
send a single object, but when I attempted to use an array, I got a JAXB
error of
javax.xml.bind.JAXBException: [Lcustom.class.Name; is not known to this
context.

So I attempted to scale it back and just send an array of Strings, but
when the array was returned on the client side I only received the first
object in the array.

I double checked the wsdl and xsd files generated, and the response call
does indeed have array types of the specified objects specifed. My
google-fu has failed me on this one.

Does anybody have any suggestions as to why I am getting these two
issues?

Thanks

RE: Problem serializing array of complex types

Posted by "Besecker, Kyle" <Ky...@Teradata.com>.
Thanks Chinmoy,
 
However, what you described is what I am doing. I set the return type of
my service to be custom.class.Name[] and I still get the JAXBException. 
 
Do I need to put some annotation on the class in order to send an array
of that object across? I tried getting around this by returning a
List<custom.class.Name>, but the same error was thrown, replace the
Lcustom.class.Name with java.util.List. But then I saw
https://issues.apache.org/jira/browse/AXIS2-3736;jsessionid=123DEEA984B0
7738A4B2A24AC78112D7 
 
Anyone else run into an issue like this? Is there any configuration
required to send an array of custom objects from a web service using
Axis2?
 
Thanks
 

________________________________

From: Chinmoy Chakraborty [mailto:cchinu@gmail.com] 
Sent: Tuesday, June 23, 2009 10:20 PM
To: axis-user@ws.apache.org
Subject: Re: Problem serializing array of complex types


Are you using Object array and putting your custom objects there? I
tried with custom object array and it worked.
 
e.g Suppose you have objects of class A. Just use A[] and it will work.
 
Chinmoy


On Wed, Jun 24, 2009 at 1:04 AM, Besecker, Kyle
<Ky...@teradata.com> wrote:


	I created a web-service and it works great for low level
complexity stuff. However, when I attempt to send arrays from the
service, I begin to run into trouble.

	Initially I attempted to send an array of custom objects. I was
able to send a single object, but when I attempted to use an array, I
got a JAXB error of

	javax.xml.bind.JAXBException: [Lcustom.class.Name
<http://custom.class.name/> ; is not known to this context. 

	So I attempted to scale it back and just send an array of
Strings, but when the array was returned on the client side I only
received the first object in the array.

	I double checked the wsdl and xsd files generated, and the
response call does indeed have array types of the specified objects
specifed. My google-fu has failed me on this one.

	Does anybody have any suggestions as to why I am getting these
two issues? 

	Thanks 



Re: Problem serializing array of complex types

Posted by Chinmoy Chakraborty <cc...@gmail.com>.
Are you using Object array and putting your custom objects there? I tried
with custom object array and it worked.

e.g Suppose you have objects of class A. Just use A[] and it will work.

Chinmoy

On Wed, Jun 24, 2009 at 1:04 AM, Besecker, Kyle
<Ky...@teradata.com>wrote:

>  I created a web-service and it works great for low level complexity
> stuff. However, when I attempt to send arrays from the service, I begin to
> run into trouble.
>
> Initially I attempted to send an array of custom objects. I was able to
> send a single object, but when I attempted to use an array, I got a JAXB
> error of
>
> javax.xml.bind.JAXBException: [L*custom.class.Name<http://custom.class.name/>
> *; is not known to this context.
>
> So I attempted to scale it back and just send an array of Strings, but when
> the array was returned on the client side I only received the first object
> in the array.
>
> I double checked the wsdl and xsd files generated, and the response call
> does indeed have array types of the specified objects specifed. My google-fu
> has failed me on this one.
>
> Does anybody have any suggestions as to why I am getting these two issues?
>
> Thanks**
>