Barry Hathaway

You write " the list does get created but it's elements are OMElements and are 
not deserialized. " 

My questions: 
What do you expect from the deserialization process?
Into what larger complex object-type shall your OMElements be deserialized? 


To understand and agree:
"  serialization" of an object of some type means "I take the obejct and I make 
it an (xml-)String"!
"deserialization" of a (xml-)String should return the object from which the 
serialized (xml-)String has made! 
No more no less: Can we agree on that?

Now you write:
the list does get created but its elements are OMElements!

My question is:
What are you expecting has to be stored in the list?

Josef











-----Ursprüngliche Nachricht-----
Von: Barry Hathaway [mailto:bhath...@nycap.rr.com] 
Gesendet: Donnerstag, 4. August 2011 18:02
An: java-user@axis.apache.org
Betreff: Re: POJO return types

Sagara,

Perhaps I am doing something wrong; ;however, whenever I try to use a List
(either as an attribute of a bean or separately) the list does get 
created but its
elements are OMElements and are not deserialized.  This happens even if I
declare the list as List<String>.  Also, while I can easily declare a 
list as List<String>
inside a POJO bean how do I declare a simple return type of type 
List<String>?
Java seems to only allow "Class[] queryReturnTypes = new Class[] { 
List.class };"
Thanks.

Barry

On 8/4/2011 11:17 AM, Sagara Gunathunga wrote:
> On Thu, Aug 4, 2011 at 8:07 PM, Barry Hathaway<bhath...@nycap.rr.com>  wrote:
>> This is good news! I am actually using the snapshot.
>> Do you have any pointers to documentation that describes how to use these
>> new features?
> At the moment there is no such proper documentation exists  but I'm
> planning to write a tutorial little later. BTW these improvements are
> much easy to use.
>
> For Lists Schema generation and payload is identical to Arrays only
> run time processing is different. If you have a List as a method
> parameter or as a field of a POJO Axis2 run time can construct a List
> object from incoming payload , if the expected parameter or field is
> an Array  it will construct an array object and use it for invoke the
> service method.
>
> But in client side it is not possible to generate separate codes for
> both Arrays and Lists using a tool like a WSDL2JAVA, it always
> generate either Array or List because there is no way to distinguish
> Arrays and List in Schema. As an example in JAXB by default generate
> Lists while Axis2 generate Arrays. IMO converting List to a Array or
> Array to a list is not a big deal.
>
>
> Axis2 Map processing is identical to JAXB Map processing , you can
> find more information here [1]. Note that Map is specific to Java
> hence schema generation use custom complex type to represent Maps that
> results into generate custom Java beans in client side. You can't
> expect send and receive Java a Maps as it is but need small effort.
>
> The best way to explore this is deploy a sample class something
> similar to below and use SoapUI or WSDL2JAVA in client side. HTH
>
> public Map<Integer,String>  simpleMapTest(Map<Integer,String>  map){
>   SOP(map)
>   return map;
> }
>
> [1] - http://jaxb.java.net/guide/Mapping_your_favorite_class.html
>
> Thanks !
>
>
>> Thanks.
>>
>> Barry
>>
>> On 8/4/2011 10:14 AM, Sagara Gunathunga wrote:
>>> On Thu, Aug 4, 2011 at 7:15 AM, Narendra Kadali
>>> <narendra_kad...@hotmail.com>    wrote:
>>>> Hi Barry Hathaway,
>>>>
>>>> As far as I know Axis2 aximo data model does not support java collection
>>>> framework. However one webservice input argument can be declared as List.
>>> Java Collection and Map support has been implemented on Axis2 trunk
>>> and will be available with 1.7.0 release until that it's possible to
>>> use  SNAPSHOT versions if someone really want to utilize these
>>> features .
>>>
>>> Thanks !
>>>
>>>> I think the reason behind this is to achieve platform independence.
>>>>
>>>> Regards,
>>>> Narendra
>>>>
>>>>> Date: Wed, 3 Aug 2011 17:00:52 -0400
>>>>> From: bhath...@nycap.rr.com
>>>>> To: java-user@axis.apache.org
>>>>> Subject: POJO return types
>>>>>
>>>>> Since I really didn't have any luck returning Lists or arrays, I decided
>>>>> to return
>>>>> a simple POJO class in my POJO web service. The class that I am trying
>>>>> to return
>>>>> is defined on both the service and client side as:
>>>>>
>>>>> public class QueryResultSet {
>>>>> private List<Object>    columnNames;
>>>>> private List<Object>    resultSet;
>>>>> public QueryResultSet() {
>>>>> }
>>>>> public List<Object>    getColumnNames() {
>>>>> return columnNames;
>>>>> }
>>>>> public void setColumnNames(List<Object>    columnNames) {
>>>>> this.columnNames = columnNames;
>>>>> }
>>>>> public List<Object>    getResultSet() {
>>>>> return resultSet;
>>>>> }
>>>>> public void setResultSet(List<Object>    results) {
>>>>> this.resultSet = results;
>>>>> }
>>>>> }
>>>>>
>>>>> On the client side, I call the service as:
>>>>>
>>>>> Class[] queryReturnTypes = new Class[] { QueryResultSet.class };
>>>>> try {
>>>>> Object[] queryResponse =
>>>>> serviceClient.invokeBlocking(queryQName,
>>>>> queryArgs, queryReturnTypes);
>>>>> QueryResultSet rs = (QueryResultSet) queryResponse[0];
>>>>> List<Object>    colNames = rs.getColumnNames();
>>>>> List<Object>    queryRows = rs.getResultSet();
>>>>> for (int i=0; i<colNames.size(); i++) {
>>>>> log.info("Response from 'query' operation: column name
>>>>> "+colNames.get(i).toString());
>>>>> }
>>>>>
>>>>> The log statement produces:
>>>>>
>>>>> 2011-08-03 16:47:53,059 [main ] INFO
>>>>> SadlMain - Response from 'query' operation: column
>>>>> name<ax25:columnNames
>>>>> xmlns:ax25="http://provider.axis.sadlserver.sadl.research.ge.com/xsd";
>>>>> xmlns:xs="http://www.w3.org/2001/XMLSchema";
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>>> xsi:type="xs:string">cw</ax25:columnNames>
>>>>>
>>>>> I was expecting that by specifying the correct return type that the
>>>>> invokeBlocking call would "unwrap" the
>>>>> QueryResultSet class in queryResponse[0] and just get cw. Obviously,
>>>>> being a newbie, this isn't quite right.
>>>>> Any ideas?
>>>>>
>>>>> Thanks
>>>>> Barry Hathaway
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
>>>>> For additional commands, e-mail: java-user-h...@axis.apache.org
>>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
>> For additional commands, e-mail: java-user-h...@axis.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to