Amila,

Posted below are the service implementation classes, the soap response and wsdl.

I have taken the code first approach so I coded the service classes first,
and generated the wsdl from the service class.

As you will see in the generated wsdl, the child class is described along with 
the parent's fields as well,
but strangely the response is missing those.
The data objects are well formed java bean with public getters/setters.
Is the serializer using reflection on the child where it is somehow skipping 
the parent's fields?
Could this be a serializer bug?

**************************************************************************
public class CustomerService {
    public PremierCustomerDTO[] getPremierCustomers() throws AxisFault {
        PremierCustomerDTO pc = new PremierCustomerDTO();
        pc.setName("nametest");
        pc.setAddress("addrtest");
        pc.setPhone("545-454-5434");
        pc.setVipNumber("xyz");
        pc.setClubName("ToastMasters");
        PremierCustomerDTO[] pcs = new PremierCustomerDTO[]{pc};
        return pcs;
    }
}

public class CustomerDTO {
    private String name;
    private String phone;
    private String address;
// public getters and setters .
}

public class PremierCustomerDTO extends CustomerDTO {
    private String clubName;
    private String vipNumber;
// public getters and setters .
}
**************************************************************************

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Header />
<soapenv:Body>
<ns:getPremierCustomersResponse xmlns:ns="http://service.ws.xyz.abc.com/xsd";>
<ns:return>
<clubName xmlns="http://service.ws.ena.emprisa.com/xsd";>ToastMasters</clubName>
<vipNumber xmlns="http://service.ws.ena.emprisa.com/xsd";>xyz</vipNumber>
</ns:return>
</ns:getPremierCustomersResponse>
</soapenv:Body>
</soapenv:Envelope>

**************************************************************************
<wsdl:definitions targetNamespace="http://service.ws.xyz.abc.com";>
    <wsdl:documentation>
        Service class used to retrieve and update device component.
    </wsdl:documentation>
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" 
elementFormDefault="qualified"
targetNamespace="http://service.ws.xyz.abc.com/xsd";>
            <xs:element name="getPremierCustomersFault">
            <xs:complexType>
                <xs:sequence>
                     <xs:element name="getPremierCustomersFault" 
type="xs:anyType"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="getPremierCustomersResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="return" 
nillable="true" type="ns0:PremierCustomerDTO"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="PremierCustomerDTO" type="ns0:PremierCustomerDTO"/>
            <xs:complexType name="PremierCustomerDTO">
                <xs:sequence>
                    <xs:element name="address" nillable="true" 
type="xs:string"/>
                    <xs:element name="name" nillable="true" type="xs:string"/>
                    <xs:element name="phone" nillable="true" type="xs:string"/>
                    <xs:element name="clubName" nillable="true" 
type="xs:string"/>
                    <xs:element name="vipNumber" nillable="true" 
type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>
<wsdl:message name="getPremierCustomersMessage"/>
    <wsdl:message name="getPremierCustomersResponse">
    <wsdl:part name="part1" element="ns0:getPremierCustomersResponse"/>
</wsdl:message>
<wsdl:message name="getPremierCustomersFault">
    <wsdl:part name="part1" element="ns0:getPremierCustomersFault"/>
</wsdl:message>
<wsdl:portType name="CustomerServicePortType">
<wsdl:operation name="getPremierCustomers">
    <wsdl:input message="axis2:getPremierCustomersMessage" 
wsaw:Action="urn:getPremierCustomers"/>
    <wsdl:output message="axis2:getPremierCustomersResponse"/>
<wsdl:fault message="axis2:getPremierCustomersFault" 
name="getPremierCustomersFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CustomerServiceSOAP11Binding" 
type="axis2:CustomerServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="document"/>
<wsdl:operation name="getPremierCustomers">
    <soap:operation soapAction="urn:getPremierCustomers" style="document"/>
    <wsdl:input>
        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="getPremierCustomersFault">
        <soap:body use="literal"/>
    </wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CustomerServiceSOAP12Binding" 
type="axis2:CustomerServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="document"/>
<wsdl:operation name="getPremierCustomers">
    <soap12:operation soapAction="urn:getPremierCustomers" style="document"/>
    <wsdl:input>
        <soap12:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <soap12:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="getPremierCustomersFault">
        <soap12:fault use="literal" name="getPremierCustomersFault"/>
    </wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CustomerServiceHttpBinding" 
type="axis2:CustomerServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="getPremierCustomers">
    <http:operation location="getPremierCustomers"/>
    <wsdl:input>
        <mime:content type="text/xml"/>
    </wsdl:input>
    <wsdl:output>
        <mime:content type="text/xml"/>
    </wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CustomerService">
    <wsdl:port name="CustomerServiceSOAP11port_http" 
binding="axis2:CustomerServiceSOAP11Binding">
        <soap:address 
location="http://s-pavuluri-02:8080/enetaware/services/CustomerService"/>
    </wsdl:port>
    <wsdl:port name="CustomerServiceSOAP12port_http" 
binding="axis2:CustomerServiceSOAP12Binding">
        <soap12:address 
location="http://s-pavuluri-02:8080/enetaware/services/CustomerService"/>
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

**************************************************************************

Thanks!




> On 1/25/07, Sathija Pavuluri <[EMAIL PROTECTED]> wrote:
>>
>> Sanjiva,
>>
>> The code has been generated from wsdl. I think the problem is not with
>> generated code.
>
>
> Sometimes it may not  serialize the child object correctly. Can you send you
> wsdl?
>
> The soap response itself does not look right.
>> It is missing some elements which are defined in the wsdl. Specifically,
>> these are the elements from the super class
>> of the object that the service is returning.
>>
>> I am not sure if this is a bug or my approach is incorrect.
>> Is there anything different I need to do so that the super class elements
>> are serialized when its child class element
>> is being sent in the response?
>>
>> Thanks,
>> Sathija.
>>
>>
>>
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to