×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Webservice - compley type and array

Webservice - compley type and array

Webservice - compley type and array

(OP)
I'm trying to make a webservice that returns an array of objects, which contains another array of objects.

Everything works fine, when I hack the wsdl manually.
How can I make it work automatically?

I'm using Eclipse 3.4 for Java EE, Axis 1.4, Glassfish v2 UR2, and Eclipse's Web Services Explorer for testing.

My service method looks like this:
    public DataSet[] getDataSet(User owner) {
        DataSet[] res = new DataSet[2];
        res[0] = new DataSet();
        DataSet ds = res[0];
        ds.setName("DataSet1");
        ds.setDescription("No desc");
        ds.setIsDefault(false);
        String[] ss = {"One", "Two"};
        ds.setColumns(ss);
        return res;
    }
DataSet is a simple JavaBean:

public class DataSet implements java.io.Serializable {
    private String name;
    private String description;
    private boolean isDefault;
    private String[] columns;
    
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public boolean getIsDefault() {
        return isDefault;
    }
    public void setIsDefault(boolean isDefault) {
        this.isDefault = isDefault;
    }
    public String[] getColumns() {
        return columns;
    }
    public void setColumns(String[] columns) {
        this.columns = columns;
    }

}

Generated WSDL:
   <element name="getDataSetResponse">
    <complexType>
     <sequence>
      <element maxOccurs="unbounded" name="getDataSetReturn" type="impl:DataSet"/>
     </sequence>
    </complexType>
   </element>
   <complexType name="ArrayOf_xsd_string">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
    </sequence>
   </complexType>
   <complexType name="DataSet">
    <sequence>
     <element name="columns" nillable="true" type="impl:ArrayOf_xsd_string"/>
     <element name="description" nillable="true" type="xsd:string"/>
     <element name="isDefault" type="xsd:boolean"/>
     <element name="name" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>


It works when I set the name of the element of "ArrayOf_xsd_string" to "columns".   (<element maxOccurs="unbounded" minOccurs="0" name="columns" type="xsd:string"/>)




SOAP response:
- <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>
- <getDataSetResponse xmlns="http://score.com">
- <getDataSetReturn>
- <columns>
  <columns>One</columns>
  <columns>Two</columns>
  </columns>
  <description>No desc</description>
  <isDefault>false</isDefault>
  <name>DataSet1</name>
  </getDataSetReturn>
  <getDataSetReturn xsi:nil="true" />
  </getDataSetResponse>
  </soapenv:Body>
  </soapenv:Envelope>



Any idea?

RE: Webservice - compley type and array

Why do you say the other option is wrong? I think it's being generated OK.

Cheers,
Dian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close