1 Reply Latest reply on Feb 26, 2008 3:27 AM by odin69

    jaxrpc Array problem

    odin69

      Hello,
      I have created a web service which returns a non-standard value type to the invoking app. I used the wsconsume tool to create the client side files from the wsdl.
      My Problem right now is that my value type named customerData contains an int_array which causes problems on the client side. In the class CustomerData the in_array is defined as follows:

      private int[] products;
      + setters and getters

      on the client-side the wsconsume tool generates the follwoing:

      public List<Integer> getProducts() {
       if (products == null) {
       products = new ArrayList<Integer>();
       }
       return this.products;
       }


      the web service is invoked with:
      CustomerData cdCell = ND_CELLPHONE_STUB.getCustomerData(phoneNumber);


      when I use the generated customerData file I get an error, but when I am using the orig. CustomerData file from the service everything is ok. I am a little bit stuck right now. Am I doing something wrong generating the client-side classes?
      thx

        • 1. Re: jaxrpc Array problem
          odin69

          So here is my next question. I have the following Value type on the client-side created from a wsdl using wsconsume.

          package com.seitenbau.test.Client;
          
          import java.util.ArrayList;
          import java.util.List;
          import javax.xml.bind.annotation.XmlAccessType;
          import javax.xml.bind.annotation.XmlAccessorType;
          import javax.xml.bind.annotation.XmlElement;
          import javax.xml.bind.annotation.XmlType;
          
          
          @XmlAccessorType(XmlAccessType.FIELD)
          @XmlType(name = "CustomerData", propOrder = {
           "city",
           "givenname",
           "password",
           "phonenumber",
           "products",
           "street",
           "surname",
           "zipCode"
          })
          public class CustomerData implements java.io.Serializable {
          
           @XmlElement(required = true, nillable = true)
           protected String city;
           @XmlElement(required = true, nillable = true)
           protected String givenname;
           @XmlElement(required = true, nillable = true)
           protected String password;
           protected int phonenumber;
           @XmlElement(type = Integer.class)
           protected List<Integer> products;
           @XmlElement(required = true, nillable = true)
           protected String street;
           @XmlElement(required = true, nillable = true)
           protected String surname;
           @XmlElement(required = true, nillable = true)
           protected String zipCode;
          
           public String getCity() {
           return city;
           }
           public void setCity(String value) {
           this.city = value;
           }
           public String getGivenname() {
           return givenname;
           }
           public void setGivenname(String value) {
           this.givenname = value;
           }
           public String getPassword() {
           return password;
           }
           public void setPassword(String value) {
           this.password = value;
           }
           public int getPhonenumber() {
           return phonenumber;
           }
           public void setPhonenumber(int value) {
           this.phonenumber = value;
           }
           public List<Integer> getProducts() {
           if (products == null) {
           products = new ArrayList<Integer>();
           }
           return this.products;
           }
           public String getStreet() {
           return street;
           }
           public void setStreet(String value) {
           this.street = value;
           }
           public String getSurname() {
           return surname;
           }
           public void setSurname(String value) {
           this.surname = value;
           }
           public String getZipCode() {
           return zipCode;
           }
           public void setZipCode(String value) {
           this.zipCode = value;
           }
          
          }
          


          Now I have the problem that by invoking the web service the customerData information is given back fine but on client side I get an UndeclaredThrowableException. Right now I don't know why this happens and i am really stuck I hope someone might be able to help me. in the following there is the wsdl. The error occurs by invoking the getCustomerData operation. Well thanks in advance i hope someone comes up with s.th.

          <?xml version="1.0" encoding="UTF-8"?>
          <definitions name='ND_CELLPHONE' targetNamespace='http://test' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://test' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
           <types>
           <schema targetNamespace='http://test' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://test' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
           <complexType name='CustomerData'>
           <sequence>
           <element name='city' nillable='true' type='string'/>
           <element name='givenname' nillable='true' type='string'/>
           <element name='password' nillable='true' type='string'/>
           <element name='phonenumber' type='int'/>
           <element maxOccurs='unbounded' minOccurs='0' name='products' type='int'/>
           <element name='street' nillable='true' type='string'/>
           <element name='surname' nillable='true' type='string'/>
           <element name='zipCode' nillable='true' type='string'/>
           </sequence>
           </complexType>
           </schema>
           </types>
           <message name='IND_CellphoneService_checkForNumberExistence' xmlns='http://schemas.xmlsoap.org/wsdl/'>
           <part name='int_1' type='xsd:int'/>
           <part name='String_2' type='xsd:string'/>
           </message>
           <message name='IND_CellphoneService_checkForNumberExistenceResponse'>
           <part name='result' type='xsd:int'/>
           </message>
           <message name='IND_CellphoneService_getCustomerData'>
           <part name='int_1' type='xsd:int'/>
           </message>
           <message name='IND_CellphoneService_getCustomerDataResponse'>
           <part name='result' type='tns:CustomerData'/>
           </message>
           <message name='IND_CellphoneService_setEditFlag'>
           <part name='int_1' type='xsd:int'/>
           </message>
           <message name='IND_CellphoneService_setEditFlagResponse'>
           <part name='result' type='xsd:boolean'/>
           </message>
           <portType name='IND_CellphoneService'>
           <operation name='checkForNumberExistence' parameterOrder='int_1 String_2'>
           <input message='tns:IND_CellphoneService_checkForNumberExistence'/>
           <output message='tns:IND_CellphoneService_checkForNumberExistenceResponse'/>
           </operation>
           <operation name='getCustomerData' parameterOrder='int_1'>
           <input message='tns:IND_CellphoneService_getCustomerData'/>
           <output message='tns:IND_CellphoneService_getCustomerDataResponse'/>
           </operation>
           <operation name='setEditFlag' parameterOrder='int_1'>
           <input message='tns:IND_CellphoneService_setEditFlag'/>
           <output message='tns:IND_CellphoneService_setEditFlagResponse'/>
           </operation>
           </portType>
           <binding name='IND_CellphoneServiceBinding' type='tns:IND_CellphoneService'>
           <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
           <operation name='checkForNumberExistence'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body namespace='http://test' use='literal'/>
           </input>
           <output>
           <soap:body namespace='http://test' use='literal'/>
           </output>
           </operation>
           <operation name='getCustomerData'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body namespace='http://test' use='literal'/>
           </input>
           <output>
           <soap:body namespace='http://test' use='literal'/>
           </output>
           </operation>
           <operation name='setEditFlag'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body namespace='http://test' use='literal'/>
           </input>
           <output>
           <soap:body namespace='http://test' use='literal'/>
           </output>
           </operation>
           </binding>
           <service name='ND_CELLPHONE'>
           <port binding='tns:IND_CellphoneServiceBinding' name='IND_CellphoneServicePort'>
           <soap:address location='http://localhost:8080/services/ND_PRODUCTS'/>
           </port>
           </service>
          </definitions>