2

I have a Java web service with code below:

@WebService
public class MyService {

    @WebMethod
    public String[] method1() {
        String[] strArray = new String[2];
        strArray[0] = "method1 array item 1";
        strArray[1] = "method1 array item 2";
        return strArray;
    }

    @WebMethod
    public MyComplexType method2() {
        return new MyComplexType();
    }
}

method2() returns a complex type which contains a string array as class member (code is below):

public class MyComplexType {

    public String[] InternalArray;

    public MyComplexType() {
        InternalArray = new String[2];
        InternalArray[0] = "complex type array item 1";
        InternalArray[1] = "complex type array item 2";
    }
}

and the result wsdl contains array_of_xsd_string for this member like.

element name="InternalArray " nillable="true" type="impl:ArrayOf_xsd_string"

when i create client code with wsdl2java, service returns an empty ArrayOf_xsd_string object.

also i have created C# client, webreference returns an empty string array.

briefly, i must return a string array inside a complex type, but service returns an empty array.

4

0 回答 0