1 Reply Latest reply on May 7, 2008 2:32 PM by Siarhei Kudzelia

    Empty object is returned.

    Siarhei Kudzelia Newbie

      I try to user webservice client that is created using JBossWS with Axis1 server. The problem is that I cannot receive a complex type from the server even though it is properly returned. Judging by TCPMon U receive th following message:

      <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><findOrderReturn xmlns="http://osmoticweb.com/PurchaseService/"><customerName>Ron</customerName><itemCodes xsi:nil="true"/><quantities xsi:nil="true"/><shippingAddress xsi:nil="true"/></findOrderReturn></soapenv:Body></soapenv:Envelope>
      

      As you see customerName has value "Ron". I user the following code to call the server method:
      Service service = Service.create(wsdlLocation, serviceName);
      BeanService beanS = (BeanService) service.getPort(BeanService.class);
      Order o = beanS.findOrder();
      

      No exceptions are thrown. Order object is returned but it has all the properties values equal to null (as you can see from the result message from the server "customerName" has its value).
      Here is the wsdl:
      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions targetNamespace="http://osmoticweb.com/Purchase" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://osmoticweb.com/Purchase" xmlns:intf="http://osmoticweb.com/Purchase" xmlns:tns1="urn:BeanService" xmlns:tns2="http://osmoticweb.com/PurchaseService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <!--WSDL created by Apache Axis version: 1.2.1
      Built on Jun 14, 2005 (09:15:57 EDT)-->
       <wsdl:types>
       <schema elementFormDefault="qualified" targetNamespace="http://osmoticweb.com/Purchase" xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="urn:BeanService"/>
       <complexType name="ArrayOf_xsd_string">
       <sequence>
       <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
       </sequence>
      
       </complexType>
       <complexType name="ArrayOf_xsd_int">
       <sequence>
       <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:int"/>
       </sequence>
       </complexType>
       <element name="order" type="tns1:Order"/>
       </schema>
       <schema elementFormDefault="qualified" targetNamespace="urn:BeanService" xmlns="http://www.w3.org/2001/XMLSchema">
      
       <import namespace="http://osmoticweb.com/Purchase"/>
       <complexType name="Order">
       <sequence>
       <element name="customerName" nillable="true" type="xsd:string"/>
       <element name="itemCodes" nillable="true" type="impl:ArrayOf_xsd_string"/>
       <element name="quantities" nillable="true" type="impl:ArrayOf_xsd_int"/>
       <element name="shippingAddress" nillable="true" type="xsd:string"/>
       </sequence>
       </complexType>
      
       </schema>
       <schema elementFormDefault="qualified" targetNamespace="http://osmoticweb.com/PurchaseService/" xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="http://osmoticweb.com/Purchase"/>
       <import namespace="urn:BeanService"/>
       <element name="findMeReturn" type="xsd:string"/>
       <element name="findOrderReturn" type="tns1:Order"/>
       </schema>
       </wsdl:types>
      
       <wsdl:message name="findOrderRequest">
      
       </wsdl:message>
      
       <wsdl:message name="findMeResponse">
      
       <wsdl:part element="tns2:findMeReturn" name="findMeReturn"/>
      
       </wsdl:message>
      
       <wsdl:message name="findMeRequest">
      
       <wsdl:part element="impl:order" name="order"/>
      
       </wsdl:message>
      
       <wsdl:message name="findOrderResponse">
      
       <wsdl:part element="tns2:findOrderReturn" name="findOrderReturn"/>
      
       </wsdl:message>
      
       <wsdl:portType name="BeanService">
      
       <wsdl:operation name="findMe" parameterOrder="order">
      
       <wsdl:input message="impl:findMeRequest" name="findMeRequest"/>
      
       <wsdl:output message="impl:findMeResponse" name="findMeResponse"/>
      
       </wsdl:operation>
      
       <wsdl:operation name="findOrder">
      
       <wsdl:input message="impl:findOrderRequest" name="findOrderRequest"/>
      
       <wsdl:output message="impl:findOrderResponse" name="findOrderResponse"/>
      
       </wsdl:operation>
      
       </wsdl:portType>
      
       <wsdl:binding name="OrderProcessorSoapBinding" type="impl:BeanService">
      
       <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      
       <wsdl:operation name="findMe">
      
       <wsdlsoap:operation soapAction=""/>
      
       <wsdl:input name="findMeRequest">
      
       <wsdlsoap:body use="literal"/>
      
       </wsdl:input>
      
       <wsdl:output name="findMeResponse">
      
       <wsdlsoap:body use="literal"/>
      
       </wsdl:output>
      
       </wsdl:operation>
      
       <wsdl:operation name="findOrder">
      
       <wsdlsoap:operation soapAction=""/>
      
       <wsdl:input name="findOrderRequest">
      
       <wsdlsoap:body use="literal"/>
      
       </wsdl:input>
      
       <wsdl:output name="findOrderResponse">
      
       <wsdlsoap:body use="literal"/>
      
       </wsdl:output>
      
       </wsdl:operation>
      
       </wsdl:binding>
      
       <wsdl:service name="BeanServiceService">
      
       <wsdl:port binding="impl:OrderProcessorSoapBinding" name="OrderProcessor">
      
       <wsdlsoap:address location="http://127.0.0.1:9999/axis/services/OrderProcessor"/>
      
       </wsdl:port>
      
       </wsdl:service>
      
      </wsdl:definitions>
      
      

      In case a string ibject is returned from the method than it's OK, I receive the value. An Order object is also properly send to the server as a method parameter. What is wrong? I've spend the whole day trying to find the cause of problem.
      Order class and BeanService are generated by using WSConsume tool. JBoss 4.2.2GA is used.

        • 1. Re: Empty object is returned.
          Siarhei Kudzelia Newbie

          Here is an Order class, may be it will be useful:

          
          package beanservice;
          
          import javax.xml.bind.annotation.XmlAccessType;
          import javax.xml.bind.annotation.XmlAccessorType;
          import javax.xml.bind.annotation.XmlElement;
          import javax.xml.bind.annotation.XmlType;
          import com.osmoticweb.purchase.ArrayOfXsdInt;
          import com.osmoticweb.purchase.ArrayOfXsdString;
          
          
          /**
           * <p>Java class for Order complex type.
           *
           * <p>The following schema fragment specifies the expected content contained within this class.
           *
           * <pre>
           * &lt;complexType name="Order">
           * &lt;complexContent>
           * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
           * &lt;sequence>
           * &lt;element name="customerName" type="{http://www.w3.org/2001/XMLSchema}string"/>
           * &lt;element name="itemCodes" type="{http://osmoticweb.com/Purchase}ArrayOf_xsd_string"/>
           * &lt;element name="quantities" type="{http://osmoticweb.com/Purchase}ArrayOf_xsd_int"/>
           * &lt;element name="shippingAddress" type="{http://www.w3.org/2001/XMLSchema}string"/>
           * &lt;/sequence>
           * &lt;/restriction>
           * &lt;/complexContent>
           * &lt;/complexType>
           * </pre>
           *
           *
           */
          @XmlAccessorType(XmlAccessType.FIELD)
          @XmlType(name = "Order", propOrder = {
           "customerName",
           "itemCodes",
           "quantities",
           "shippingAddress"
          })
          public class Order {
          
           @XmlElement(required = true, nillable = true)
           protected String customerName;
           @XmlElement(required = true, nillable = true)
           protected ArrayOfXsdString itemCodes;
           @XmlElement(required = true, nillable = true)
           protected ArrayOfXsdInt quantities;
           @XmlElement(required = true, nillable = true)
           protected String shippingAddress;
          
           /**
           * Gets the value of the customerName property.
           *
           * @return
           * possible object is
           * {@link String }
           *
           */
           public String getCustomerName() {
           return customerName;
           }
          
           /**
           * Sets the value of the customerName property.
           *
           * @param value
           * allowed object is
           * {@link String }
           *
           */
           public void setCustomerName(String value) {
           this.customerName = value;
           }
          
           /**
           * Gets the value of the itemCodes property.
           *
           * @return
           * possible object is
           * {@link ArrayOfXsdString }
           *
           */
           public ArrayOfXsdString getItemCodes() {
           return itemCodes;
           }
          
           /**
           * Sets the value of the itemCodes property.
           *
           * @param value
           * allowed object is
           * {@link ArrayOfXsdString }
           *
           */
           public void setItemCodes(ArrayOfXsdString value) {
           this.itemCodes = value;
           }
          
           /**
           * Gets the value of the quantities property.
           *
           * @return
           * possible object is
           * {@link ArrayOfXsdInt }
           *
           */
           public ArrayOfXsdInt getQuantities() {
           return quantities;
           }
          
           /**
           * Sets the value of the quantities property.
           *
           * @param value
           * allowed object is
           * {@link ArrayOfXsdInt }
           *
           */
           public void setQuantities(ArrayOfXsdInt value) {
           this.quantities = value;
           }
          
           /**
           * Gets the value of the shippingAddress property.
           *
           * @return
           * possible object is
           * {@link String }
           *
           */
           public String getShippingAddress() {
           return shippingAddress;
           }
          
           /**
           * Sets the value of the shippingAddress property.
           *
           * @param value
           * allowed object is
           * {@link String }
           *
           */
           public void setShippingAddress(String value) {
           this.shippingAddress = value;
           }
          
          }