You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Thamm, Russell" <ru...@dsto.defence.gov.au> on 2005/11/10 06:41:02 UTC

Java2WSDL converts String arrays to strings

Hi, 

I am trying to convert an RPC/Encoded service to a "WRAPPED" style service.

I used Java2WSDL on the Java Interface and supporting classes.

I was very surprised to see that class members of the form:

String[] collections; 

Were converted to strings instead of arrays of strings.

So the class:

Public class collections : implements java.io.Serializable
{
    private String[] collections;
    private String[] resources;

    public String[] getCollections()
    {
       return collections;
    }

    public void setCollections(String[] collections)
    {
        this.collections = collections;
    }
    
    ....
}

Generated the type:

<complexType name="collection">
    <sequence>
        <element name="collections" type="xsd:string"/>
        <element name="resources" type="xsd:string"/>
    </sequence>
</complexType>

To get the original class from WSDL2Java, I had to add maxoccurs="unbounded"
to both elements in question.

Am I doing something stupid or is this a bug?

Thanks
Russell Thamm





Re: Java2WSDL converts String arrays to strings

Posted by Davanum Srinivas <da...@gmail.com>.
Don't be surpised :) Rely on WSDL-First :) :) As i mentioned in
another email, use Java2WSDL just as a jumpstart and then start
tweaking the wsdl.

-- dims

On 11/10/05, Thamm, Russell <ru...@dsto.defence.gov.au> wrote:
>
>
> Hi,
>
> I am trying to convert an RPC/Encoded service to a "WRAPPED" style service.
>
> I used Java2WSDL on the Java Interface and supporting classes.
>
> I was very surprised to see that class members of the form:
>
> String[] collections;
>
> Were converted to strings instead of arrays of strings.
>
> So the class:
>
> Public class collections : implements java.io.Serializable
> {
>     private String[] collections;
>     private String[] resources;
>
>     public String[] getCollections()
>     {
>        return collections;
>     }
>
>     public void setCollections(String[] collections)
>     {
>         this.collections = collections;
>     }
>
>     ....
> }
>
> Generated the type:
>
> <complexType name="collection">
>     <sequence>
>         <element name="collections" type="xsd:string"/>
>         <element name="resources" type="xsd:string"/>
>     </sequence>
> </complexType>
>
> To get the original class from WSDL2Java, I had to add maxoccurs="unbounded"
> to both elements in question.
>
> Am I doing something stupid or is this a bug?
>
> Thanks
> Russell Thamm
>
>
>


--
Davanum Srinivas : http://wso2.com/blogs/