移动应用程序中的webservice as3

时间:2013-10-07 16:36:44

标签: web-services actionscript-3

我的移动设备应用程序有问题,当我在我的电脑上测试应用程序时,webservice连接正常,我得到了答案。然而,当我在我的移动设备中测试应用程序时,首次使用该应用程序需要很长时间才能从服务器获得答案,并且屏幕保持在“发送...”,经过多次尝试并重置应用程序后,连接没关系,之后,应用程序运行正常。什么可能是我的问题? pd:我不会说英语。

代码是:

private function panicStart(e:MouseEvent = null):void
    {
        trace("han presionado el boton de panico");
        //Alert.show(_canvas, "Datos de Usuario :" + "\nNombre: " + _currentName + "\nKey: " + _currentKey + "\nD.N.I. :" + _currentDni + "\nMóvil: " + _currentPhone + "\n\nDatos de Geoposición:\n" + "\Latitud: " + _latitud + "\nLongitud: " + _longitud + "\n ", "Envío de Datos", new Array("ok"), null);
        var url:String = "http://appmovil.munijesusmaria.gob.pe/1380panico/ws_panico.asmx?WSDL";

        webService = new WebService();
        webService.loadWSDL(url);

        webService.addEventListener(LoadEvent.LOAD, BuildServiceRequest);

        _state = STATE_STARTSEND
    }

    function BuildServiceRequest(evt:LoadEvent)
    {
        _state = STATE_SENDING;
        serviceOperation = webService.getOperation("Insertar");
        trace("esperando respuesta");
        serviceOperation.addEventListener(FaultEvent.FAULT, DisplayError);
        serviceOperation.addEventListener(ResultEvent.RESULT, DisplayResult);
        if (_panicScreen.txtReference.text == _textReference || _panicScreen.txtReference.text == "")
            serviceOperation.send(_currentDni, _currentName, _currentPhone, _latitud.toString(), _longitud.toString(), "ninguna", "285DF565H5654CC");
        else
            serviceOperation.send(_currentDni, _currentName, _currentPhone, _latitud.toString(), _longitud.toString(), _panicScreen.txtReference.text, "285DF565H5654CC");

    }

    function sentgotoPanic(e:MouseEvent = null):void
    {       
        ScreenManager.gotoScreen("panic");
        _state = STATE_SENT;
    }

    function DisplayError(evt:FaultEvent)
    {
        _state = STATE_JUSTSENT;
        sentgotoPanic();
        Alert.show(_canvas, "Error al enviar los datos" + "\n ", "Alerta", new Array("ok"), new Array("ok"), null);
        trace("error");
        _panicScreen.txtReference.text = "";

        _state = STATE_SENT;

    }

    function DisplayResult(evt:ResultEvent)
    {
        _state = STATE_JUSTSENT;
        trace("EEEEEEEXITO")
        var result:String = evt.result as String;
        sentgotoPanic();
        Alert.show(_canvas, "Datos Enviados" + "\n ", "Alerta", new Array("ok"), null);
        trace("error");
        _panicScreen.txtReference.text = "";
        _state = STATE_SENT;
    }

0 个答案:

没有答案