4 Replies Latest reply on Jun 2, 2011 12:02 PM by Noyz2k

    How can you make a project in eclipse with amf client

    Noyz2k Level 1

      Hi there;

      I want to make a amf connection but i don;t know how and from where can i get all java sources, and how to add them to eclipse - svn / maven

      can you explain me how can i make a client to work in java.

        • 1. Re: How can you make a project in eclipse with amf client
          riesvantwisk

          Hey,

           

          I am not going to make a tutorial here, sorry about that! But many persons already made blogpost around that.

           

          Here is a good start though : http://opensource.adobe.com/wiki/display/blazeds/BlazeDS+4.0+Installation+Guide

           

          When I start such a application, I create a DynamicWeb Application in Eclipse, and later add a FlexApplicaiton to it.

          From there I added the Blaze-DS libraries to the lib directory under WebContent.

           

          Read about Blaze-DS, that's a good start.

           

          Ries

          • 2. Re: How can you make a project in eclipse with amf client
            Noyz2k Level 1

            Thats the server side project eclipse...

            i do have a server somewhere with amf...and i want to make a java aplication

            to connect to it

            i have found something on http://www.jarvana.com/jarvana/inspect-pom/com/adobe/blazeds/blazeds-core/3.0.0.544/blazed s-core-3.0.0.544.pom

             

            this has the amfCOnnect and other classes.. but is old

            because it give me error that my client is 2.5 and it has to be recompiled to 3...

            i've read about blaze ds...

            so the thing is i want client side java lib and not the server side.. servlets or what they are.. j2ee project..

            • 3. Re: How can you make a project in eclipse with amf client
              riesvantwisk Level 1

              So, to be clear.

               

              You have a java application (jsp/Spring) and you need to get/send data to a AMF client, possible a remote server?

              • 4. Re: How can you make a project in eclipse with amf client
                Noyz2k Level 1

                i have a java .java file

                 

                Lets say a robot..so i want to connect this robot to a server wich has amf...

                 

                 

                AMFConnection amfConn = new AMFConnection();
                CommandMessage cmd = new CommandMessage();
                cmd.setDestination("1");
                cmd.setOperation(CommandMessage.CLIENT_PING_OPERATION);
                amfConn.setObjectEncoding(1);
                amfConn.setInstantiateTypes(true);
                amfConn.addHttpRequestHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; U; en; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 Opera 11.11");
                amfConn.addHttpRequestHeader("Accept", "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1");
                amfConn.addHttpRequestHeader("Accept-Language", "en-US,en;q=0.9");
                amfConn.addHttpRequestHeader("Referer", "http://live.bodog.co.uk/swf/live.swf?version=2.4.10.1");
                amfConn.addHttpRequestHeader("Connection", "Keep-Alive");
                amfConn.addHttpRequestHeader("Content-Type", "application/x-amf");

                 

                String url = "http://live.bodog.co.uk/messagebroker/amf";
                try {
                amfConn.connect(url);
                } catch (ClientStatusException e) {
                e.printStackTrace();
                }
                AcknowledgeMessage ackMessage = new AcknowledgeMessage();
                try {
                ackMessage = (AcknowledgeMessage) amfConn.call("null", cmd);
                } catch (ClientStatusException e) {
                e.printStackTrace();
                } catch (ServerStatusException e) {
                e.printStackTrace();
                }
                System.out.println(ackMessage.toString());
                cmd.setOperation(CommandMessage.SUBSCRIBE_OPERATION);
                cmd.setCorrelationId(ackMessage.getCorrelationId());
                cmd.setClientId(ackMessage.getClientId());
                cmd.setMessageId(ackMessage.getMessageId());
                cmd.setBody(null);
                cmd.setDestination("live");

                 

                amfConn.call("1", cmd);

                 

                //        AmfMessageSerializer result = null;
                //            result = (AmfMessageSerializer)
                //        //        System.out.println(msg.toString());
                amfConn.close();

                 

                 

                and my pom to this project is :

                 

                 


                <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
                <modelVersion>4.0.0</modelVersion>
                <groupId>com.blaze.test</groupId>
                <artifactId>blaze-test</artifactId>
                <version>0.0.1-SNAPSHOT</version>

                <properties>
                <jre.version>1.6</jre.version>
                <encoding>UTF-8</encoding>
                <wtp.version>1.5</wtp.version>
                </properties>

                <dependencies>
                <!-- BlazeDS -->
                <dependency>
                <groupId>com.adobe.blazeds</groupId>
                <artifactId>blazeds-core</artifactId>
                <version>3.2.0.3978</version>
                </dependency>

                <dependency>
                <groupId>com.adobe.blazeds</groupId>
                <artifactId>blazeds-common</artifactId>
                <version>3.2.0.3978</version>
                </dependency>

                <dependency>
                <groupId>com.adobe.blazeds</groupId>
                <artifactId>blazeds-remoting</artifactId>
                <version>3.2.0.3978</version>
                </dependency>

                <dependency>
                <groupId>com.adobe.blazeds</groupId>
                <artifactId>blazeds-opt</artifactId>
                <version>3.2.0.3978</version>
                </dependency>

                <dependency>
                <groupId>com.adobe.blazeds</groupId>
                <artifactId>blazeds-proxy</artifactId>
                <version>3.2.0.3978</version>
                </dependency>

                </dependencies>

                 

                <repositories>
                <repository>
                <id>codehaus</id>
                <name>codehaus</name>
                <url>http://repository.codehaus.org</url>
                </repository>
                <repository>
                <id>codehaus-plugins</id>
                <url>http://dist.codehaus.org/</url>
                <layout>legacy</layout>
                <snapshots>
                <enabled>true</enabled>
                </snapshots>
                <releases>
                <enabled>true</enabled>
                </releases>
                </repository>

                 


                </repositories>

                </project>

                 

                 

                and the output when i run that class with connect.. thing

                is :


                Flex Message (flex.messaging.messages.AcknowledgeMessage)
                clientId = F7845000-CC0F-81C2-4BC2-C41232345BCA
                correlationId = F784427A-E209-11C0-4149-FD5DC88EC504
                destination = null
                messageId = F7845000-CC19-9D9C-4B42-D797201E5BEA
                timestamp = 1307041127308
                timeToLive = 0
                body = null
                hdr(DSMessagingVersion) = 1.0
                Exception in thread "main" ServerStatusException
                data: Flex Message (flex.messaging.messages.ErrorMessage)
                clientId = F7845000-CC0F-81C2-4BC2-C41232345BCA
                correlationId = F7845000-CC19-9D9C-4B42-D797201E5BEA
                destination = live
                messageId = F784529D-BE0D-A5E4-A721-D9A0BA41A25A
                timestamp = 1307041127582
                timeToLive = 0
                body = null
                code =  Server.Processing
                message =  Destination 'live' requires FlexClient support which was introduced in version 2.5. Please recompile the client application with an updated client framework.
                details =  null
                rootCause =  null
                body =  null
                extendedData =  null
                HttpResponseInfo: HttpResponseInfo
                code: 200
                message: OK
                at flex.messaging.io.amf.client.AMFConnection.processAmfBody(AMFConnection.java:665)
                at flex.messaging.io.amf.client.AMFConnection.processAmfPacket(AMFConnection.java:629)
                at flex.messaging.io.amf.client.AMFConnection.processHttpResponseBody(AMFConnection.java:601 )
                at flex.messaging.io.amf.client.AMFConnection.processHttpResponse(AMFConnection.java:584)
                at flex.messaging.io.amf.client.AMFConnection.send(AMFConnection.java:685)
                at flex.messaging.io.amf.client.AMFConnection.call(AMFConnection.java:450)
                at BlazeDSTest.main(BlazeDSTest.java:50)

                 

                 

                  Destination 'live' requires FlexClient support which was introduced in version 2.5. Please recompile the client application with an updated client

                this is why i was asking you how to set up a amf client in eclipse.. as a java aplication

                seems that this blaze-ds-test that i have is old..and i found it really hard.. everything i search about amf is about server side - jsp / spring.. and Flex client..

                adobe has an example of a java client but nothing really about where u can get those libs..

                and maybe that lib has the same exception with version..