coxfrederic commented on issue #119: Request to AMFPHP fails to return any 
fault or result event
URL: https://github.com/apache/royale-asjs/issues/119#issuecomment-366354537
 
 
   When I modify the AMF sample project with my AMFPHP implementation (changed 
the endPoint, source and destination and called my own function getPackages) 
like below:
   
   ```
   <?xml version="1.0" encoding="utf-8"?>
   <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
                    xmlns:js="library://ns.apache.org/royale/basic"
                    xmlns:local="*">
   
       <fx:Script>
                <![CDATA[
                        import org.apache.royale.net.events.FaultEvent;
                        import org.apache.royale.net.events.ResultEvent;
               import valueObjects.ClientValueObject;
               import valueObjects.Product;
                        
                        protected function sendName():void
                        {
                   service.send("getPackages", null);
                        }
                        
                        private function onResult(evt:ResultEvent):void
                        {
                                trace("Result=" + evt.data);
                                if (evt.data is String)
                                        received.text = "Received: " + evt.data;
                                else if (evt.data is Product)
                   {
                       var product:Product = evt.data as Product;
                       received.text = "Received: product name is '" + 
product.name + "' and product description is '" + product.description + "'" ;
                   } else
                        {
                       var arr:Array = evt.data as Array;
                       list.dataProvider = arr;
                                }
                        }
                        
                        private function onFault(evt:FaultEvent):void
                        {
                                trace("Fault=" + evt.message);
                        }
   
                        protected function getVOs():void
                        {
                   service.send("getObjectArray1", []);
                        }
   
               protected function getSomeProduct():void
                        {
                   service.send("getPackages", []);
                        }
   
               protected function reportChange():void
               {
                   var vo:ClientValueObject = list.selectedItem as 
ClientValueObject;
                   received.text = "selected " + vo.id;
               }
                        
                ]]>
        </fx:Script>
   
       <js:beads>
           <js:ClassAliasBead />
           <js:RemoteObject id="service" result="onResult(event)" 
fault="onFault(event)"
                            endPoint = 
"https://clients.cityfashion.dev.exuvis.com/amfphp/gateway.php";
                            destination = "Meta"
                            source = "Meta"/>
       </js:beads>
   
       <js:initialView>
           <js:View>
               <js:beads>
                   <js:VerticalLayout />
               </js:beads>
               <js:Label text="Text to be sent via AMF RemoteObject..." />
               <js:TextInput id="name_txt" />
               <js:TextButton text="Send Name to AMF" click="sendName()"/>
                        <js:Label id="received" width="300"/>
               <js:TextButton text="Get Array of ValueObjects" 
click="getVOs()"/>
               <js:List id="list" labelField="id" width="100" height="100" 
change="reportChange()"/>
               <js:TextButton text="Get Some Product" click="getSomeProduct()"/>
           </js:View>
       </js:initialView>
   
       <js:valuesImpl>
           <js:SimpleCSSValuesImpl />
       </js:valuesImpl>
   </js:Application>
   ```
   
   In debug mode I get the following error:
   
   ```
   Language.js:238
   Object {code: -1004, message: "Invalid response type.", detail: "Invalid 
XMLHttpRequest response status or type.", data: null}
   Language.js:238
   code:-1004
   data:null
   detail:"Invalid XMLHttpRequest response status or type."
   message:"Invalid response type."
   ```
   
   I am unable to get the JAVA part of the example to work so can't verify if 
that works for me but since it does for you I presume this is something related 
to the AMFPHP implementation.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to