Web Service Network Issue on Android using Flex

流过昼夜 提交于 2019-12-11 14:11:24

问题


I am developing a mobile application to be deployed to both iOS and Android using Flash Builder and Flex. I'm at a point where I want to begin testing on a physical device as everything is working on the Flash Builder emulator.

When my app is loaded and the first view is displayed the following code is run.

creationComplete="initApp(event)

protected function initApp(event:FlexEvent):void
{               
    pricingAppWebService1.updateApp("RAMISAppUpdate");                          
}   

My issue is that when I try and load the xml data from the server into the app using the Web Service (shown below), it results in a fault. This is strange as it works on the Flash Builder emulator.

<fx:Declarations>
    <s:WebService id="pricingAppWebService" 
        wsdl="http://dev.ramislive.com/webservice/pricing.asmx?WSDL"
        result="dataSent_resultHandler(event)"
        fault="dataSent_faultHandler(event)" />    
</fx:Declarations>

When the app tries to get the xml data it hits the pricingAppWebService_faultHandler at which point the device displays a OK/Cancel pop-up box with the local IP of my machine displayed in a input text.

protected function pricingAppWebService_faultHandler(event:FaultEvent):void
{
    trace(event.fault);
    navigator.pushView(MainMenu);           
}   

The trace provides the following information in the Flash Builder Console.

[ RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request"
    faultDetail="Unable to load WSDL. 
    If currently online, please verify the URI and/or format of the WSDL    
    (http://dev.ramislive.com/webservice/pricing.asmx?WSDL)" ]

Naturally I considered the security settings on the device and the following exists in the android manifest file within src/Main-App.xml.

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

As a note I have looked at THIS QUESTION and the solution to my problem may be very similar. however i have tried replacing the domain with the IP address with no success. Apologies if this question is too vague, it's my first on the site. I've tried to provide as much detail as I possibly could short of the whole mxml file.

The issue seems to be throwing some kind of security issue - which is what I assume the pop-up box is. This however, is only speculation but my server notices a response after clicking OK and pressing the phone back button to try and reload the data.


回答1:


It's important to note this does not happen when testing using my internal wifi connection as the connection to the test computer is available (this is the IP in the box). To avoid the issue use the release version of the ipa instead. Otherwise do not worry it will not be shown in the final release build.

Project --> Export Release Build 


来源:https://stackoverflow.com/questions/11969210/web-service-network-issue-on-android-using-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!