Issue Details (XML | Word | Printable)

Key: AXIS-2586
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Steve McDuff
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Axis

Wrapped/Literal encoding and abstract parameters with arrays won't work.

Created: 03/Nov/06 05:03 PM   Updated: 04/Nov/06 09:40 PM
Return to search
Component/s: Serialization/Deserialization
Affects Version/s: 1.4
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Tomcat 5.5
Sun JRE 1.5.0.07
Windows XP SP2


 Description  « Hide
I found a problem when passing abstract parameters with array fields to a method in Wrapped/Literal encoding:

Steps to reproduce
1 - create a base class that has an array field of itself.
2 - create a sub class that inherits from the base class
3 - create a service class to publish as a web service that uses the base class as a paramter for a public method
4 - use Java2WSDL to publish the service class using wrapped/literal encoding
5 - run the web services on a web server
6 - use WSDL2Java to create stubs for a test client
7 - use the test client to call the method on the service class with a Sub Class instance.
8 - notice that the call to the service fails with the error : org.xml.sax.SAXException: Invalid element in BaseClass - item

Here are the code samples:

class BaseClass{
    private BaseClass[] childArray;
    public BaseClass[] getChildArray(){
        return childArray;
    }
    public void setChildArray(BaseClass[] childArray){
        this.childArray = childArray;
    }
}

class SubClass extends BaseClass{
    private BaseClass[] otherChildArray;
    public BaseClass[] getOtherChildArray(){
        return otherChildArray;
    }
    public void setOtherChildArray(BaseClass[] otherChildArray){
        this.otherChildArray = otherChildArray;
    }
}

// Use Java2WSDL to publish this as a web service
class MyTestInterface{
    // send and return the same base class parameter
    public BaseClass sendBase(BaseClass base){
        return base;
    }
    // this method just declares sub to make sure it finds its
    // way in the WSDL
    public void declareSub(SubClass sub){};
}

// client unit test code
class MyTest extends junit.framework.TestCase{
    public void testSendBase(){
        // Insert code to resolve URL and locate the web services here
        MyTestInterface x = null;
        SubClass sendSubClass = new SubClass();
        sendSubClass.setChildArray(new BaseClass[]{new SubClass()});
        // this call will fail with the message
        // org.xml.sax.SAXException: Invalid element in BaseClass - item
        BaseClass retVal = x.sendBase(sendSubClass);
        assertEquals(sendSubClass, retVal);
    }
}

Note:
- This problem is reproducible in Document/Literal
- This problem is not reproducible in RPC/Encoded


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No changes have yet been made on this issue.