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 Chinmoy Chakraborty <cc...@gmail.com> on 2008/04/03 10:23:50 UTC

Does Axis2 support 2D/2D object array as return type?

Hello,

Does Axis2 support 2D/2D object array as return type?

Chinmoy

Re: Does Axis2 support 2D/2D object array as return type?

Posted by Chinmoy Chakraborty <cc...@gmail.com>.
Hi Vinh,

How I can define XSD schema that mentioned here? and how to reference that
from my services.xml? should i put these is a xml file and put the file in
classpath?

<xs:complexType name="StringArrayType">
        <xs:sequence>
            <xs:element name="Item" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="StringArray" type="tns:StringArrayType"/>
    <xs:complexType name="2DStringArrayType">
        <xs:sequence>
            <xs:element ref="StringArray" minOccurs="0"
maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="2DStringArray" type="tns:2DStringArrayType"/>
Please tell me the real file format of XSD Schema.

Chinmoy

On Fri, Apr 4, 2008 at 8:59 AM, Vinh Nguyen (vinguye2) <vi...@cisco.com>
wrote:

>  Hi,
> Please see the attached email where I tried to address your question:)
>
> The idea with web services is that you can pass/return any type of object
> as long as you define an XML schema for it.  The schema definition tells
> the data binding tooling (i.e. ADB, XmlBeans, etc) how to convert your type
> to/from XML.
>
> So if you want to return a multi-dimension array, you need to define an
> object schema that has such a data structure.  For example, the following
> might work for you if you want to pass a 2D string[].
>
>     <xs:complexType name="StringArrayType">
>         <xs:sequence>
>             <xs:element name="Item" type="xs:string" minOccurs="0"
> maxOccurs="unbounded"/>
>         </xs:sequence>
>     </xs:complexType>
>     <xs:element name="StringArray" type="tns:StringArrayType"/>
>
>     <xs:complexType name="2DStringArrayType">
>         <xs:sequence>
>             <xs:element ref="StringArray" minOccurs="0"
> maxOccurs="unbounded"/>
>         </xs:sequence>
>     </xs:complexType>
>     <xs:element name="2DStringArray" type="tns:2DStringArrayType"/>
>
>
>
>  ------------------------------
> *From:* Chinmoy Chakraborty [mailto:cchinu@gmail.com]
> *Sent:* Thursday, April 03, 2008 1:24 AM
> *To:* axis-user@ws.apache.org
> *Subject:* Does Axis2 support 2D/2D object array as return type?
>
>  Hello,
>
> Does Axis2 support 2D/2D object array as return type?
>
> Chinmoy
>
>
> ---------- Forwarded message ----------
> From: "Vinh Nguyen (vinguye2)" <vi...@cisco.com>
> To: <ax...@ws.apache.org>
> Date: Thu, 20 Mar 2008 15:05:02 -0700
> Subject: RE: How to return Object[] from axis2
>  Hi,
> What kind of value are you getting back?
>
> I don't think xs:any was designed for this.  It should be to generically
> represent an object that actually has an XSD schema.  In what you're trying
> to do below, what is the schema of the xml you expect to be returned?
> -Vinh
>
>  ------------------------------
> *From:* Chinmoy Chakraborty [mailto:cchinu@gmail.com]
> *Sent:* Thursday, March 20, 2008 11:01 AM
> *To:* axis-user@ws.apache.org
> *Subject:* Re: How to return Object[] from axis2
>
>  Hi Deepal,
>
> Thnaks a lot for your response. I can use Axis2 in our client side but we
> need to make it work with Axis 1.4 to support backward
> compatibility. I checked axis2 and found that it supports Object array as
> return type however, it does not work with following return type (Object
> array of Objejectarray of Object array):
>
> public Object[] returnObjectArray(String authToken) {
>         Object[] retVal = new Object[3];
>         Object[] args = new Object[3];
>         args[0] = new Object[] {"Arg1", "Arg2", "Arg3"};
>         args[1] = new Object[] {"Arg1", "Arg2", "Arg3"};
>         args[2] = new Object[] {"Arg1", "Arg2", "Arg3"};
>         retVal[0] = new Object[] {"RetVal1", "Retval2", authToken, args};
>         retVal[1] = new Object[] {"RetVal3", "Retval4", authToken, args};
>         retVal[2] = new Object[] {"RetVal5", "Retval6", authToken, args};
>         return retVal;
>     }
>
> Please let me know how I can make axis2 work with axis 1.4 for the above
> mentioned return type!!
>
> Chinmoy
>
>
>
>
> On Thu, Mar 20, 2008 at 10:30 PM, Deepal jayasinghe <de...@gmail.com>
> wrote:
>
>> Hi Chinmoy ,
>> If you do not mind , try to use Axis2 in the client side . If it is
>> working then the problem should be there in either Axis1 or the way
>> Axis2 serialize that message .
>>
>> Thank you!
>> Deepal
>> > Thanks a lot Deepal for your reply. I have a made a test service that
>> > returns an object array. I can see the correct SOAP through the
>> > SOAPMonitor (that Axis2 is returning) but in axis 1.4 client I am
>> > getting following exception:
>> >
>> > 23938 ERROR [http8080-Processor23]
>> > org.apache.axis.client.Call     - Exception:
>> > org.xml.sax.SAXException: Found character data inside an array element
>> > while deserializing
>> >  at
>> >
>> org.apache.axis.encoding.ser.ArrayDeserializer.characters(ArrayDeserializer.java:502)
>> >  at
>> >
>> org.apache.axis.encoding.DeserializationContext.characters(DeserializationContext.java:966)
>> >  at
>> >
>> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:177)
>> >  at
>> >
>> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
>> >  at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
>> >  at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
>> >  at org.apache.axis.client.Call.invoke(Call.java:2467)
>> >  at org.apache.axis.client.Call.invoke(Call.java:2366)
>> > .........................
>> >
>> > How can resolve above issue?
>> >
>> > Chinmoy
>> >
>> > On Wed, Mar 19, 2008 at 7:43 PM, Deepal jayasinghe <deepalk@gmail.com
>> > <ma...@gmail.com>> wrote:
>> >
>> >     Yes Axis2 support Object arrays. The error may be due to some issue
>> in
>> >     your code , however we can help you to fix that if you can send us
>> the
>> >     code or create a JIRA attaching test code.
>> >
>> >     Thank you!
>> >     Deepal
>> >     > Hi All,
>> >     >
>> >     > I am using hitting Axis2 with axis 1.4 client. I have a service
>> >     which
>> >     > returns Object[].
>> >     >
>> >     > With axis 1.4 in both ends it worked well. But in axis2 it gives
>> >     > Nullpointer exception when the service tried to return Object[]
>> >     > (object array).
>> >     >
>> >     > Does axis2 support object array as return type? If yes then how
>> >     can I
>> >     > make it work with old axis1.4 client? its necessary to support old
>> >     > axis1.4 because lots of our customers are using axis1.4 client
>> >     and we
>> >     > need to make it backward compatible.
>> >     >
>> >     > Chinmoy
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >     <ma...@ws.apache.org>
>> >     For additional commands, e-mail: axis-user-help@ws.apache.org
>> >     <ma...@ws.apache.org>
>>  >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>

RE: Does Axis2 support 2D/2D object array as return type?

Posted by "Vinh Nguyen (vinguye2)" <vi...@cisco.com>.
Hi,
Please see the attached email where I tried to address your question:)
 
The idea with web services is that you can pass/return any type of
object as long as you define an XML schema for it.  The schema
definition tells the data binding tooling (i.e. ADB, XmlBeans, etc) how
to convert your type to/from XML.
 
So if you want to return a multi-dimension array, you need to define an
object schema that has such a data structure.  For example, the
following might work for you if you want to pass a 2D string[].
 
    <xs:complexType name="StringArrayType">
        <xs:sequence>
            <xs:element name="Item" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="StringArray" type="tns:StringArrayType"/>
 
    <xs:complexType name="2DStringArrayType">
        <xs:sequence>
            <xs:element ref="StringArray" minOccurs="0"
maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="2DStringArray" type="tns:2DStringArrayType"/>

 
 

________________________________

From: Chinmoy Chakraborty [mailto:cchinu@gmail.com] 
Sent: Thursday, April 03, 2008 1:24 AM
To: axis-user@ws.apache.org
Subject: Does Axis2 support 2D/2D object array as return type?


Hello,
 
Does Axis2 support 2D/2D object array as return type?
 
Chinmoy