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 Bárbara Minitti <bm...@gmail.com> on 2012/12/25 20:05:38 UTC

Re: client pojo composition/pojo inheritance - URGENT

 Hi,

> >
> >>
> >>  I am developing my graduate work with Axis2.
> >>
> >>  I have a service. The method of my service has POJO like parameter
> >> input and return string message,
> >>
> >>  This POJO has others POJO in your structure, like composition and
> >> inheritance.
> >>
> >>  To invoke  my service I'm using RPCServiceClient, but when my pojo is
> >> read in the service method  the attributes of my pojo composition and pojo
> >> inheritance is null.
> >>
> >>  How to create a client that support composition pojo and  pojo
> >> inheritance?
> >>
> >>  Please, help. I don't know how to resolve this problem and I don't
> >>  where to search. My graduate work is delayed because only this.
> >>
> >>  Thanks,
> >> Bárbara
>
>

RE: client pojo composition/pojo inheritance - URGENT

Posted by Martin Gainty <mg...@hotmail.com>.
Decompose your Pessoa Class attributes and elements into smaller XSD attributes and elements representing finer functional units
to quote object composition from Wikipedia
object composition (not to be confused with function composition) is a way to combine simple objects or data types into more complex ones. Compositions are a critical building block of many basic data structures, including the tagged union, the linked list, and the binary tree
so Pessoa class could be composed of 'finer-grain' simple-type elements for example assume this namespace space assignment
<schema targetNamespace="http://soapinterop.org/xsd"
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsd1="http://soapinterop.org Pessoa_Intthis would be represented in the XSD as a simple-type e.g.  <xs:simpleType name="Pessoa_Int">
        <xs:restriction base="xs:int"/>
    </xs:simpleType>
Pessoa_Charthis would be represented in the XSD as a simple-type e.g.  <xs:simpleType name="Pessola_Char">
        <xs:restriction base="xs:char"/>
    </xs:simpleType> Now compose Pessoa class to be composed of the previously created finer grain elements of Pessoa_Ints and Pessoa_Chars<element name="Pessoa">
        <complexType>
            <sequence><!-- this could be the index -->
                <element name="abstract" type="Pessoa_Int"/>
<!-- this could be the name -->                <element name="abstract" type="Pessoa_Char"/>            </sequence>
         </complexType></element> <xsd:import namespace=http://localhost:8080/axis2/schema/unqualified/datatypes schemaLocation="datatypes.xsd" />

now reference the namespace thusly<xsd:schema targetNamespace="http://apache.org/axis2/schema/unqualified/companyService"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:types=http://localhost:8080/axis2/schema/unqualified/datatypes> now your wsdl can itself compose Simple or Complex Elements referencing the previously declared elements of 
<types:Pessoa>
<types:Pessoa_Int>
<types:Pessoa_Char> then use WSDL2Java to create your Java Classes from the XSD elements which have been incorporated in the WSDL via the xsd:import Capire?
Martin 
______________________________________________ 
Perfavore ni alterare la posta elettronica From: junejo.sheeraz@gmail.com
Date: Wed, 26 Dec 2012 09:49:16 +0000
Subject: Re: client pojo composition/pojo inheritance - URGENT
To: java-user@axis.apache.org

You mean you are trying to use Complex objects in your interface and you are getting NULL on the way back?
The solution is to wrap all the return complex objects into a ResponseObject and return it from your method.


If its unclear send more information like your service class etcHope this helps,
--SJunejo



On Tue, Dec 25, 2012 at 7:05 PM, Bárbara Minitti <bm...@gmail.com> wrote:


 Hi,
>
>>
>>  I am developing my graduate work with Axis2.
>>
>>  I have a service. The method of my service has POJO like parameter
>> input and return string message,
>>
>>  This POJO has others POJO in your structure, like composition and
>> inheritance.
>>
>>  To invoke  my service I'm using RPCServiceClient, but when my pojo is
>> read in the service method  the attributes of my pojo composition and pojo
>> inheritance is null.
>>
>>  How to create a client that support composition pojo and  pojo
>> inheritance?
>>
>>  Please, help. I don't know how to resolve this problem and I don't
>>  where to search. My graduate work is delayed because only this.
>>
>>  Thanks,
>> Bárbara



 		 	   		  

Re: client pojo composition/pojo inheritance - URGENT

Posted by Sheeraz Junejo <ju...@gmail.com>.
You mean you are trying to use Complex objects in your interface and you
are getting NULL on the way back?

The solution is to wrap all the return complex objects into a
ResponseObject and return it from your method.

If its unclear send more information like your service class etc
Hope this helps,

--
SJunejo


On Tue, Dec 25, 2012 at 7:05 PM, Bárbara Minitti <bm...@gmail.com> wrote:

>  Hi,
>
>> >
>> >>
>> >>  I am developing my graduate work with Axis2.
>> >>
>> >>  I have a service. The method of my service has POJO like parameter
>> >> input and return string message,
>> >>
>> >>  This POJO has others POJO in your structure, like composition and
>> >> inheritance.
>> >>
>> >>  To invoke  my service I'm using RPCServiceClient, but when my pojo is
>> >> read in the service method  the attributes of my pojo composition and pojo
>> >> inheritance is null.
>> >>
>> >>  How to create a client that support composition pojo and  pojo
>> >> inheritance?
>> >>
>> >>  Please, help. I don't know how to resolve this problem and I don't
>> >>  where to search. My graduate work is delayed because only this.
>> >>
>> >>  Thanks,
>> >> Bárbara
>>
>>
>