BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   What's wrong with my java code ?? (http://www.blackberryforums.com/showthread.php?t=2442)

callaway 11-22-2004 09:25 AM


Sdevitt 11-22-2004 09:45 AM


NJBlackBerry 11-22-2004 10:54 AM


arconsulting 11-22-2004 01:36 PM


Emdis 01-16-2005 12:22 PM

What's wrong with my java code ??
 
Hi All,

I'm trying to write a java program that connects to a webservice server and retrieve some information (this is a very basic program for the moment) but unfortunaltely I'm already stuck. My program works fine with the emulator but freezes on my handheld (even if my code is launch in a thread).

I would really appreciate that someone look at my thread code to give me a clue because I'm really stuck :cry:
Here is my code:

Code:

private class ConnectionThread extends Thread
    xxx123;
        private static final int TIMEOUT = 500; //ms

        private String _theUrl;

        private volatile boolean _start = false;
        private volatile boolean _stop = false;

        public void essaixxx40;xxx41;
        xxx123;
            if xxx40; _start xxx41;
            xxx123;
                Dialog.alertxxx40;_resources.getStringxxx40;HTTPDEMO_ALERT_REQUESTINPROGRESSxxx41;xxx41;;
            xxx125;
            else
            xxx123;
                synchronizedxxx40;thisxxx41;
                xxx123;
                    if xxx40; _start xxx41;
                    xxx123;
                        Dialog.alertxxx40;_resources.getStringxxx40;HTTPDEMO_ALERT_REQUESTINPROGRESSxxx41;xxx41;;
                    xxx125;
                    else
                    xxx123;
                        _start = true;
                    xxx125;
                xxx125;
            xxx125;
        xxx125;

        //shutdown the thread
        public void stopxxx40;xxx41;
        xxx123;
            _stop = true;
        xxx125;

        public void runxxx40;xxx41;
        xxx123;
            forxxx40;;;xxx41;
            xxx123;
                //Thread control
                whilexxx40; !_start && !_stopxxx41;
                xxx123;
                    //sleep for a bit so we don't spin
                    try
                    xxx123;
                        sleepxxx40;TIMEOUTxxx41;;
                    xxx125;
                    catch xxx40;InterruptedException exxx41;
                    xxx123;
                        System.err.printlnxxx40;e.toStringxxx40;xxx41;xxx41;;
                    xxx125;
                xxx125;
                //exit condition
                if xxx40; _stop xxx41;
                xxx123;
                    return;
                xxx125;
 
                synchronizedxxx40;thisxxx41;
                xxx123;
                    try
                    xxx123;
                        Call call = new Callxxx40;xxx41;;
                                               
                        call.addParameterxxx40;"example", pxxx41;;
                        call.setMethodNamexxx40;"list"xxx41;;
                        call.setTargetObjectURIxxx40;"urnxxx58;try"xxx41;;
                       
                        HTTPTransport transport = new HTTPTransport xxx40;"httpxxx58;//www.myfirm.comxxx58;90/soap/servlet/rpcrouter","urnxxx58;try"xxx41;;
                        transport.getResponsexxx40;truexxx41;;
                        Envelope responseEnvelope = call.invokexxx40;transportxxx41;;
                   
                        Stringxxx91;xxx93; results = new Stringxxx91;4xxx93;;
                        Object hhxxx91;xxx93;;
                        hh = xxx40;Objectxxx91;xxx93;xxx41; responseEnvelope.getParameterxxx40;0xxx41;;
                                           
                        stopStatusThreadxxx40;xxx41;;
                       
                        _statusThread.stopxxx40;xxx41;;
                        _connectionThread.stopxxx40;xxx41;;
                    xxx125;
                    catch xxx40;Exception exxx41;
                    xxx123;
                        System.err.printlnxxx40;e.toStringxxx40;xxx41;xxx41;;
                        stopStatusThreadxxx40;xxx41;;
                    xxx125;
                    //we're done one connection so reset the start state
                    _start = false;
                xxx125;
            xxx125;
        xxx125;

The handheld freezes on this line:
Code:

Envelope responseEnvelope = call.invokexxx40;transportxxx41;;
By the way I'm using the wingfoot soap class.

Please help me
Thanks in advance

Emdis

arconsulting 01-22-2005 10:15 AM

What does the code look like that instantiates the thread?

Does the Dialog.alert() get called? This could be a source of your problem.


All times are GMT -5. The time now is 02:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.