0 Replies Latest reply on Sep 11, 2007 5:40 PM by Karen Lease

    Jaxrpc service with parameter Type[] fails if array contains

    Karen Lease Newbie

      I have a jaxrpc endpoint which has methods like these:

      public interface TrivialService extends Remote
       int purchase (String person, Product[] products) throws RemoteException;
       int purchaseA (String person, ProductA[] products) throws RemoteException;

      I used wstools (java-wsdl) to generate deployment artifacts and deployed on a 4.2.1.GA jboss with 2.0.1.GA jbossws.

      Class ProductA is a subclass of Product.
      If I call purchase like this:
      public void testPurchase() throws Exception
       String person = "Karen";
       ProductA bike = new ProductA();
       ProductA bike2 = new ProductA();
       ProductA bike3 = new ProductA();
       Product[] bikes = new Product[] {bike, bike2, bike3};
       int price = port.purchase(person, bikes);
       assertEquals(9000, price);

      the test case fails because it returns only the price of the last element in the list.
      In the service it only sees one element.
      If I call it like this (with same actual objects),
      ProductA[] bikes = new ProductA[] {bike, bike2, bike3};
      int price = port.purchaseA(person, bikes);

      the service receives all 3 elements and returns the correct response.

      The incoming soap message on the server is correct in both cases. In the first case, the elements all have the type attribute set, like so:
      <ns1:purchase xmlns:ns1='http://com.kl/test1/types'>
       <arrayOfProduct_2 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns1:ProductA'>
       <arrayOfProduct_2 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns1:ProductA'>

      This happens with both a jaxrpc style client and a jaxws client generated with wsconsume (-t 2.1). However it works correctly with jaxrpc client if I deploy into a jbossws 1.2.1GA server.

      I don't see anything in Jira which is quite like this, shall I file a new bug?