emilkm / amfjs Goto Github PK
View Code? Open in Web Editor NEWA JavaScript AMF Client library
License: Apache License 2.0
A JavaScript AMF Client library
License: Apache License 2.0
In issue #2 davidef suggested one way of fixing ArrayCollection deserialization when working with BlazeDS.
Here is my take on it, based on BlazeDS' implementation.
I am trying to connect BlazeDS remote server, throwing an error,
core.js:6014 ERROR TypeError: Cannot read property '0' of undefined
at XMLHttpRequest.xhr.obj.onerror (amf.js:438)
at XMLHttpRequest.wrapFn (zone-evergreen.js:1191)
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:39679)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:465)
at invokeTask (zone-evergreen.js:1603)
at XMLHttpRequest.globalZoneAwareCallback (zone-evergreen.js:1629)
does it work for IE8 ?? coz im trying to implement the client for ie8 and it kept giving me error :
"uint8array undefined"
and then i try to use polyfill typedarray js and now it give me this error :
"invalid argument amf.js line 201"
its on the "this.send(new Uint8Array(xmlhttpRequest.message));"
Hi I am trying to use your JS library to send and receive AS3 Objects. It works well but only when BlazeDS (3.5) returns AcknowledgeMessage messages that it can deserialize, if Blaze returns the Object as a DSK it chokes (all properties are present). The problem is BlazeDS is not being consistent on the type it returns for any given method, sometimes DSK sometimes AcknowledgeMessage (for the same method call, at some point during its up time it decides to return AcknowledgeMessage). The flex application handles this no problem, but how can I force Blaze to respond correctly OR get the Lib to deserialize a DSK correctly?
I'm trying to use this amf javascript for an Air project that needed to migrate to HTML using Electron.
I'm having trouble with deserializing vectors type. I tried to debug with browser inspector, and when the type is 13, it throws an error exception.
Also, retrieving strings with Japanese characters returned garbish. I tried to escape the output string but still not getting the proper characters.
I have no direct access with the Server, thus I do not know how the flex service implemented.
By the way, using Charles proxy, I can see the response string properly (not garbaged).
Any help is much appreciated.
Thanks.
Hello.
Having some troubles getting this library to work with Angular/Typescript.
The import declaration in Typescript...
import * as amf from '../../src/amf.js';
The code creating the object...
const amfClient = new amf.Client('param1','param2', param3);
The error in chome im getting...
ERROR TypeError: src_amf_js__WEBPACK_IMPORTED_MODULE_4_.Client is not a constructor
Any thoughts would be greatly appreciated and thank you for updating Surrey's library.
Regards
Hello,
it seems the lib cannot be used with IE11 or less which do not support "array functions". babeljs.io could translate it for my project.
Thx for your lib ๐
Hi,
actually I don't understand the example.
var amfClient = new amf.Client("amfphp", "http://127.0.0.1/server/gateway.php");
amfClient.invoke("test", "ping", [],
function(data) {
console.log(data);
},
function(data) {
console.log("ping errror");
}
);
What is the amfphp in this example? Is this the folder where the test.php class file is located? What should I type when I want to use a class file in a sub-sub directory?
So in this example the test.php file is located in the Services folder of the amfphp?
Dear emilkm,
My question is very simple, but I need to explain a little of my web application, I hope to be clear and not confuse.
I have a web application using Java, BlazeDS, Spring and the front-end it is made with FLEX... works great.
Now I want to change the front-end and using HTML5/Javascript, I plan to use the services exposed with BlazeDS so I need a library like yours.
I've done some testing and I can connect fine to "endpoint", for example, with flex I sent the authentication through method "ChannelSet.login(user, password)" which is nothing more than sending a simple "flex.messaging.messages.CommandMessage" with an "operation" equal to 8 and in the "body" the credentials encoded in base64, I've done this with his library and works very well.
This can be seen in the source code of the method ChannelSet login. http://opensource.adobe.com/svn/opensource/flex/sdk/branches/3.4.0/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as
So far all was well!
But, what I do not know is whether through your library can consume "RemotingDestination" (a simple service exposed with BlazeDS) because whenever I try to get to the service, the server sends me an error like this:
[btpool0-1] 2014-03-26 13:29:44,232 DEBUG SessionListener - Flex session created with id '17mj7k4e2xrou'
[btpool0-1] 2014-03-26 13:29:44,420 INFO AuthenticationServiceImpl - Authentication success with username : [email protected]
[BlazeDS]Exception when invoking service 'remoting-service': flex.messaging.MessageException: java.lang.NullPointerException
incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage)
operation = getUser
clientId = 74AE87D6-C10D-8E1D-170C-3625EE23F6A6
destination = userService
messageId = dba12e2a-74cf-4e31-aa22-180fe823ca3e
timestamp = 1395862186209
timeToLive = 0
body = null
hdr(DSEndpoint) = inca-amf
Exception: flex.messaging.MessageException: java.lang.NullPointerException
at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:225)
at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1503)
at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:884)
at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
.
.
.
With your library may call a "RemotingService" BlazeDS? and if is so, you know that is causing this "java.lang.NullPointerException", What's not clear is whether the problem is in your library or in my server settings BlazeDS :(
I hope you can guide me a bit
Best regards!
First off great work!
I am trying to connect to some BlazeDS 3.4 endpoints and some my ArrayList of simple objects throws "Unknown AMF type: " errors when decoding. Charles is show the list correctly but I noticed the following things that may throw off amfjs.
One of the properties is being sent as "String Reference" instead of String.
One of the properties is of Type Null.
One of the properties has the letter ร in the string.
I have removed the ร and Null problems but the problem still persists. If I skip the error amfjs decodes the array with some of the objects decoding correctly, and others not:
[object Object],[object Object],0,,[object Object],0,,[object Object],
when it should be:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Any help would be greatly appreciated.
In this commit e491ac2#diff-dfe09142006993477baa8e4018d02500
the header is changed to no longer mention that this code may have been derived from Surrey's r-amf. Can you explain why? Surrey's version appears to be LGPL so it isn't clear you can relicense this code to be under Apache License without their permission.
Hi,
I'm running into an issue when I request an AMF service that returns an ArrayCollection. Should be an array with 2 columns : Code, Libelle.
Here is what I get : The first object is OK but the others are split into an Object and a label ! See print screen for details.
Could you please tel me if I'm doing something wrong or if something could be done to solve this issue ?
Thanks in advance,
Olivier
I have an amf service that requires an array of a particular type and does not seem to like to take an array of Objects... Does your library allow us to do the old RemoteClass(alias="Type") that flash used to?
Me again.
Everything working great but I cant use methods on the server that have a custom object as an input, Blaze Says Cannot invoke method 'X'. : The expected argument types are (com.namespace.CustomObject) but the supplied types were (flex.messaging.io.amf.ASObject) and converted to (null). Any advices on what would be my first step to allow that to happen?
when i used it to show some Chinese characters content, it's fault in page. but i can find correct result of amf data by HTTP spying. May some issues in functions writeUTF and readUTF??
We have a remoting service that takes a List inside a List, it accept an ArrayCollection of ArrayCollections from Flex but is always null in Java if I send an Array inside an Array using your library.
change to XMLHttpRequest Level 2 so strings longer than 63 characters and different character sets can be sent and received
npm install?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.