Axis
  1. Axis
  2. AXIS-2586

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

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Tomcat 5.5
      Sun JRE 1.5.0.07
      Windows XP SP2

      Description

      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

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Steve McDuff
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development