PDA

View Full Version : ext-js and AMF



SteveMercer
15 Jul 2014, 11:09 AM
I am a current Sencha Complete customer and have access to the Sencha AMF data connector.

Using the documentation at http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.direct.AmfRemotingProvider I can send strings and other data to the back end and get an array of objects back.

The problem I am having is that I can't seem to figure out how to send an object to the back end. Every time I try I get an error:

Uncaught Ext.data.amf.Encoder.write3GenericObject(): Serializing a non-object

This is my code:


Ext.direct.Manager.addProvider({
"url":"http://www.myserver.com//WebORB30/weborb.php", // URL for the AMFEndpoint
"type":"amfremoting",
"endpoint":"my-amf", // the name of the AMFEndpoint channel as defined in the server's services-config.xml
"binary":true, // chooses AMF encoding
"actions":
{
"TestDestination": // name of the destination as defined in remoting-config.xml on the server
[
{
"name":"getDataWithObjectParameter", // method name of the method to call
"len":1 // number of parameters
}
]
}
});

Ext.define('DataRequest',
{
extend: 'Ext.data.Model',
idProperty: 'id',
fields:
[
{name: 'id', type: 'int'},
{name: 'param', type: 'string'},
{name: '$flexType', defaultValue: 'Classes.Testing.DataRequest'}
]
});

var request = Ext.create('DataRequest',
{
id : 1234,
param : 'Steve'
});

TestDestination.getDataWithObjectParameter(request, function(provider, response)
{
// do something with the response
console.log("getDataWithObjectParameter. Should receive 2 objects...");
console.log("getDataWithObjectParameter - Got " + response.data.length + " objects");
});





Has anyone ever gotten this to work?
Are there any examples out there anywhere?

Any and all help is most appreciated.

Note: The back end works flawlessly with an Adobe Flex front end. Ext does not even try to send anything to the back end when the error occurs. It appears to be a serialization error but how does one serialize an object to be sent via AMF?

Gary Schlosberg
17 Jul 2014, 5:52 AM
Sorry to hear this still isn't working as expected. Hopefully evant is helping on this thread.
ww.sencha.com/forum/showthread.php?288749