axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve McDuff (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-2586) Wrapped/Literal encoding and abstract parameters with arrays won't work.
Date Fri, 03 Nov 2006 17:03:22 GMT
Wrapped/Literal encoding and abstract parameters with arrays won't work.
------------------------------------------------------------------------

                 Key: AXIS-2586
                 URL: http://issues.apache.org/jira/browse/AXIS-2586
             Project: Apache Axis
          Issue Type: Bug
          Components: Serialization/Deserialization
    Affects Versions: 1.4
         Environment: Tomcat 5.5
Sun JRE 1.5.0.07
Windows XP SP2
            Reporter: Steve McDuff


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 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message