1 Reply Latest reply on May 23, 2008 4:30 AM by l00p0

    flex.messaging.io.amf.ASObject

    l00p0
      My application is suffering from the following error.
      [RPC Fault faultString="Cannot invoke method 'putOrder'." faultCode="Server.ResourceUnavailable" faultDetail="The expected argument types are (<java type>) but the supplied types were (flex.messaging.io.amf.ASObject) and converted to (null).
      I haven't found a lot of information on this error except that it may have something to do with the types not matching exactly and that the object type will default to ASObject if it's not 'strongly typed'

      here's my OrderVO.as:

      package nh
      {
      import mx.collections.ArrayCollection;
      [Bindable]
      [RemoteClass(alias="nh.Order")]
      public class OrderVO
      {
      public var orderId:int;
      public var custId:int;
      public var customerName:String;
      public var invAddr:Address;
      public var delAddr:Address;
      public var status:String;
      public var delCharge:Number;
      [ArrayElementType(OrderLine)]
      public var orderLines:Array;
      }
      }

      and my java class on the server :

      package nh;
      import java.io.Serializable;
      public class Order implements Serializable {
      static final long serialVersionUID = 103844514947365244L;
      private int orderId;
      private int custId;
      private String customerName;
      private Address invAddr;
      private Address delAddr;
      private String status;
      private float delCharge;
      private OrderLine[] orderLines;


      public Order (){


      }

      ...........
      getter and setter methods

      }
        • 1. Re: flex.messaging.io.amf.ASObject
          l00p0 Level 1
          Not sure what I did. But it's now working. I think originally the package names of the .as and the java class did not match exactly. Then I thought it might have something to do with having methods as well as just properties in the .as class (most of the demo/example/tutorials have no methods in the .as Definitions), so I took out the methods and put them in a subclass. For the RPC I was then trying to cast/copy the subclass to a superclass (properties only - without the methods) object and call the remote procedure with that. However when doing a trace I noticed that the call was still being made using the subclass type, so I recombined the properties and methods into one .as class and now it seems to be working.
          (I guess sometimes you just need to go around and 'round in circles for a while 'till you figure out what's going on)

          I have the following suspicions, please correct me if I'm wrong.
          * The package names need to match exactly on the server and the client
          * The properties don't necessarily need to have counterparts on the other side, but if they do they need to have exactly the same name
          * You can have any amount of (different) methods in your actionscript vs. your java Class