I'm defining a complex type in wsdl and using xfire eclipse plugin to generate 
java sources. Using tcptrace to see the communication between client and 
webservice i can see that there is actually an xml document returned with the 
expected test-data. Still, making a client by either doing:

PersonService service = new PersonServiceClient().getPersonServiceSOAPDev();

or

Service serviceModel = new AnnotationServiceFactory().create
(PersonService.class);
PersonService service = (PersonService) new XFireProxyFactory().create
(serviceModel, "http://localhost/webservicetest/services/PersonService";);

and using the methods in 'service' returns an object of the xfire generated 
class but with null values. For compare I've made a webservice in same wsdl 
with simple type returned, and this works as expected.

So what have i done wrong or is it simply not possible to get complex types 
returned from webservice using client?


/Michael

for reference:


xml returned be the webservice (simple type):

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"><soap:Body><GetPersonFirstnameResponse 
xmlns="http://localhost/services/person";><personFirstname 
xmlns="">Michael</personFirstname></GetPersonFirstnameResponse></soap:Body></soa
p:Envelope>


xml returned be the webservice (complex type):

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"><soap:Body><GetPersonResponse 
xmlns="http://localhost/services/person";>
b0
<ns2:person 
xmlns:ns2="http://localhost/services/person";><id>1</id><firstname>John</firstnam
e><lastname>Jensen</lastname><active>true</active><country>dk</country></ns2:per
son>
30
</GetPersonResponse></soap:Body></soap:Envelope>



My wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:tns="http://localhost/services/person"; name="localhost" 
targetNamespace="http://localhost/services/person";>

<xs:complexType name="Person">
  <xs:all>
    <xs:element name="id" form="unqualified" nillable="false">
      <xs:simpleType>
        <xs:restriction base="xs:int">
          <xs:minInclusive value="0"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
    <xs:element name="firstname" form="unqualified" nillable="false">
      <xs:simpleType>
        <xs:restriction base="xs:string"/>
      </xs:simpleType>
    </xs:element>       
    <xs:element name="lastname" form="unqualified" nillable="false">
      <xs:simpleType>
        <xs:restriction base="xs:string"/>
      </xs:simpleType>
    </xs:element>                                       
    <xs:element name="active" form="unqualified" nillable="false">
      <xs:simpleType>
        <xs:restriction base="xs:boolean">
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
    <xs:element name="country" form="unqualified" nillable="false">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:length value="2"/>
          <xs:whiteSpace value="collapse"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
  </xs:all>
</xs:complexType>

<wsdl:message name="PersonId">
  <wsdl:part name="personId" type="xs:int"/>
</wsdl:message>
<wsdl:message name="Person">
  <wsdl:part name="person" type="tns:Person"/>
</wsdl:message>
<wsdl:message name="PersonFirstname">
  <wsdl:part name="personFirstname" type="xs:string"/>
</wsdl:message>
        
<wsdl:portType name="PersonService">
  <wsdl:operation name="GetPerson">
    <wsdl:input message="tns:PersonId"/>
    <wsdl:output message="tns:Person"/>
  </wsdl:operation>
  <wsdl:operation name="GetPersonFirstname">
    <wsdl:input message="tns:PersonId"/>
    <wsdl:output message="tns:PersonFirstname"/>
  </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="PersonServiceSOAP" type="tns:PersonService">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  <wsdl:operation name="GetPerson">
    <soap:operation soapAction="http://localhost/services/person/GetPerson"/>
    <wsdl:input>
      <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
      <soap:body use="literal"/>
    </wsdl:output>
  </wsdl:operation>
  <wsdl:operation name="GetPersonFirstname">
    <soap:operation 
soapAction="http://localhost/services/person/GetPersonFirstname"/>
    <wsdl:input>
      <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
      <soap:body use="literal"/>
    </wsdl:output>
  </wsdl:operation>             
</wsdl:binding>

<wsdl:service name="PersonService">
  <wsdl:port name="PersonServiceSOAPDev" binding="tns:PersonServiceSOAP">
    <soap:address 
location="http://localhost/webservicetest/services/PersonService"/>
  </wsdl:port>
</wsdl:service>

</wsdl:definitions>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to