7 Replies Latest reply on Nov 6, 2011 6:43 AM by yancaoshi

    iOS cannot call blazeDS service?

    yancaoshi Level 1

      Hi all,

       

       

      My application works OK on android platform all the time. And I want to make it run on iPad too. It runs fine on virtual device. So, I tried standard debug by exporting an ipa file but see service call fails

      From service log of my web server, I opened all level information and no request is received there.

      I tried to use standard 80 port instead of my default 8080 and nothing happens either.

      Following, I tried to set channel by coding, by using AMFEndpoint  amfpolling/http rather than amf.

       

      I got below error message from Faultevent:

      Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://192.168.1.100:80/test/messagebroker/amfpolling'

       

      All above can testify that remote service call fails on iPad.

       

      I tried to debug into class MessageAgent, AsyncToken and so on, but things become more and more complex and give up now.

       

      Anybody could tell me why?

       

      Best regards,

        • 1. Re: iOS cannot call blazeDS service?
          yancaoshi Level 1

          I find a thread http://forums.adobe.com/message/3648817 but Mark's solution about pure AS/MXML is not convincing enough.

          • 2. Re: iOS cannot call blazeDS service?
            yancaoshi Level 1

            I created a very simple demo. Still, it works on android and virtual device but not on iPad.


            http://www.mediafire.com/file/ln6k5g209w2aeqf/TestBlazeDS.fxp


            Please help

            • 3. Re: iOS cannot call blazeDS service?
              alinator11 Level 2

              I am calling blaze just fine on an iPod...

              1 person found this helpful
              • 4. Re: iOS cannot call blazeDS service?
                yancaoshi Level 1

                Thanks for your attention but I am not able to get it work. WOuld you please so kind to check my sample coding? My blazeDS works and destination bp provides a method getSystemTime which simply returns server time.

                It returns NetConnection.Call.Failed on iPad though I am assure it works fine on android.

                 

                Regards,

                 

                 

                <?xml version="1.0" encoding="utf-8"?>
                <components:View xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:components="spark.components.*"
                     creationComplete="view1_creationCompleteHandler(event)" title="HomeView">
                 <fx:Script>
                  <![CDATA[
                   import mx.events.FlexEvent;
                   import mx.messaging.ChannelSet;
                   import mx.messaging.channels.AMFChannel;
                   import mx.rpc.events.FaultEvent;
                   import mx.rpc.events.ResultEvent;
                   protected function view1_creationCompleteHandler(event:FlexEvent):void
                   {
                    serviceObject.getSystemTime();
                   }
                   
                   protected function serviceObject_faultHandler(event:FaultEvent):void
                   {
                    testResult.text += event.toString();
                   }
                   
                   protected function serviceObject_resultHandler(event:ResultEvent):void
                   {
                    testResult.text += event.result.toString();
                   }
                   
                  ]]>
                 </fx:Script>
                 <fx:Declarations>
                  <!-- Place non-visual elements (e.g., services, value objects) here -->
                   <s:ChannelSet id="channelSet"> 
                    <s:AMFChannel id="amfChannel"
                         url="http://192.168.1.100:8080/ordersyssrv/messagebroker/amf"/> 
                   </s:ChannelSet> 
                   <s:RemoteObject id="serviceObject" channelSet="{channelSet}" destination="bp"
                       fault="serviceObject_faultHandler(event)"
                       result="serviceObject_resultHandler(event)"/> 
                  
                 </fx:Declarations>
                 <s:TextArea id="testResult" width="366" height="434">
                  
                 </s:TextArea>
                </components:View>
                
                
                • 5. Re: iOS cannot call blazeDS service?
                  JeffreyGong Level 1

                  Hi yancaoshi,

                   

                  Your endpoint IP 192.168.1.100 is a internal network one in the fact that it starts with 192.168.  If you can use your server's public IP or put your BlazeDS to a server with an open IP or Internet domain name.  It should work.

                   

                  Hope this solves the problem.

                   

                  Jeffrey

                  1 person found this helpful
                  • 6. Re: iOS cannot call blazeDS service?
                    yancaoshi Level 1

                    My apology for having not update the thread ASAP.

                    I found out the root cause last Friday actually and that is win7 firewall. Still not know which setting blocks the request out.

                    I used win7 32bit version at home which installs tomcat and doesn't get request from iPad until I close the firewall. And the same application works in my office PC which has win7 64bit and tomcat installed no matter firewall is on or off.

                     

                    Anyway, it proves that iPad can interact with blazeDS fine.

                     

                    Thanks and regards,

                    • 7. Re: iOS cannot call blazeDS service?
                      yancaoshi Level 1

                      Another point. Before I close firewall to make it run, I set the channel manually in the class generated by data service. Otherwise, it doesn't work either.

                       

                       

                           protected override function preInitializeService():void
                          {
                              super.preInitializeService();
                              // Initialization customization goes here
                              // Here I set the channelSet manually because I find it's null when debugging
                              channelSet = new ChannelSet();
                              var amfChannel:AMFChannel = null;  
                              amfChannel = new AMFChannel("my-amf", "http://192.168.1.100:80/test/messagebroker/amfpolling");
                              amfChannel.pollingEnabled = false;
                              channelSet.addChannel(amfChannel);
                          }