I have Java Enterprice Application with BlazeDS installed there and Flash client (created in pure Flash -not Flex). Now I want to send my custom Java object over the wire.
On The java side i have method:
//////////////////////
public void echo1(Dupa dupa){
System.out.println("--");
System.out.println(dupa.dup);
System.out.println("--");
}
//////////////////////
On the Flash side:
////////////////////////
var myDupa:Dupa = new Dupa();
myDupa.dup = "www";
var rooms:Object = remoteObject.echo1(myDupa);
////////////////////////
Where object's 'Dupa' definition is:
Java:
/////////////////////////
package test;
public class Dupa {
public String dup;
}
//////////////////////////
Flash:
/////////////////////////
package test {
[Bindable]
[RemoteClass(alias="test.Dupa")]
public class Dupa {
public var dup:String;
}
}
/////////////////////////
And I always receives error:
//////////////////////////
[FaultEvent fault=[RPC Fault faultString="Cannot invoke method 'echo1'." faultCode="Server.ResourceUnavailable" faultDetail="The expected argument types are (test.Dupa) but the supplied types were (flex.messaging.io.amf.ASObject) and converted to (null)."] messageId="2EEB750E-240E-9AE3-9AE4-284E56C81B89" type="fault" bubbles=false cancelable=true eventPhase=2]
//////////////////////////
When i change me Java method signature to:
public String echo2(flex.messaging.io.amf.ASObject test){...}
Everything work fine. But it this situation I have ASObject which i have to convert to test.Dupa.
The question is:
How can i force Flash to convert sent content to my custom object (test.Dupa)?
If its not possible, how can I convert ASObject object to test.Dupa (or whatever I want).
Thx fo replies.