axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chinmoy Chakraborty" <cch...@gmail.com>
Subject Re: How to return Object[] from axis2
Date Mon, 24 Mar 2008 08:53:30 GMT
Hi Nadeem,

Thanks for your reply. I understand the interop problem you are talking
about and the problem related to Axis2 with Axis 1.x client.

In our existing web services we are using Axis1.x in both ends and Object[]
worked fine for us. Now we want to upgrade to Axis2 keeping our
Axis1.xclients unaffecteted. In our application we have a service and
it's return
type is *Object[String, String, Object[String, String, Object[]]]*, inside
which we send 'String'.

As you told and Deepal also pointed to test it with Axis2 to Axis2 and it
might work but as you explained 'any' type is probably creating the problem.
I am looking for some kind of solution that works with Axis1.x client
without any modification. Is there any way to make Axis2 work with
Axis1.xclient without writing any custom deserializer in (
Axis1.x) client side? (My wild guess is Axis2 and Axis1.x do not deal with
Array in the same manner)
WSDL in axis2 for the service that return Object[]
-----------------------------------------------------------------------
<xs:schema xmlns:ns="*return_object_array*" attributeFormDefault="*qualified
*" elementFormDefault="*qualified*" targetNamespace="*return_object_array*">
 <xs:element name="*returnObjectArray*">
  <xs:complexType>
  <xs:sequence>
 * * <xs:element minOccurs="*0*" name="*authToken*" nillable="*true*" type="
*xs:string*" />
* * </xs:sequence>
* * </xs:complexType>
* * </xs:element>
  <xs:element name="*returnObjectArrayResponse*">
  <xs:complexType>
  <xs:sequence>
 * * <xs:element maxOccurs="*unbounded*" minOccurs="*0*" name="*return*"nillable
="*true*" type="*xs:anyType*" />
* * </xs:sequence>
* * </xs:complexType>
* * </xs:element>
* * </xs:schema>


WSDL in axis1.4 for the service that return Object[]
--------------------------------------------------------------------------
<schema targetNamespace="
http://localhost:8080/webservices/services/return_object_array"

xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ArrayOf_xsd_anyType">
  <complexContent>
  <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]" />
  </restriction>
  </complexContent>
  </complexType>
  </schema>
  </wsdl:types>
 <wsdl:message name="returnObjectArrayResponse">
  <wsdl:part name="returnObjectArrayReturn" type="impl:ArrayOf_xsd_anyType"
/>
  </wsdl:message>

Chinmoy

On Sun, Mar 23, 2008 at 12:34 PM, Hoda, Nadeem [USA] <hoda_nadeem@bah.com>
wrote:

>
> Hello Chinmoy,
>
> Though Axis2 might support Object[] in its services, this is far from a
> best practice.
>
> The WSDL should always be strongly-typed with respect to all data
> constructs contained within it. All data types should have a schema within
> the WSDL (this is automatic for strongly-typed POJO services).
>
> As you can see, Axis2 to Axis2 communication will probably work for your
> web services, but when you move to Axis1.X or .NET clients, you will
> probably have to custom deserialize the "any" type (thus defeating the
> purpose of web service standards, interop expectations, etc...)
>
> Instead of Object[], you should try custom classes that define what you
> need. Object arrays might be convenient, but they will greatly affect
> interop as you are already seeing.
>
> Thanks,
>
> Nadeem
>
>
>
>
>
>  ------------------------------
>  *From:* Chinmoy Chakraborty [mailto:cchinu@gmail.com]
> *Sent:* Thursday, March 20, 2008 10:01 PM
> *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 <deepalk@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
> > > <mailto:deepalk@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
> > >     <mailto:axis-user-unsubscribe@ws.apache.org>
> > >     For additional commands, e-mail: axis-user-help@ws.apache.org
> > >     <mailto: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
> >
> >
>

Mime
View raw message