RIM: connection

https://developer.BlackBerry.com/HTML5/documentation/ww_developing/rim_connection_element_834681_11...


   MDS
   BIS-B
   TCP_WIFI
   TCP_CELLULAR
   WAP2
   WAP

The above is the code that says which methosd connection unit must be used?

But the API documentation says what compatible sound devices with?

Anyone know? It works on the playbook? Are there test apps?

It is only compatible with phones at the moment (without BB10 or PlayBook, yet).

At the top of each entry there are icons that let you know that it works with (a phone, one thing looking for the playbook or "BB10")

Tags: BlackBerry Developers

Similar Questions

  • Software BlackBerry cannot connect on BlackBerry ID with link BB on Mac OS Yosemite and mixture does not either

    Hello

    When I want to connect with my ID from BB to BB link it shows only a blank page. (see photo: http://postimg.org/image/4c2ofplan/ - it's in Czech language) Mixture of not even start. During the launch, the icon in the dock appears and disappears in a few seconds.

    If a solution presented itself!

    I got all new Mac and compared the differences between this one and mine.

    The only thing that was on my own, "com. RIM connection point. PeerManager"has been disabled.

    I don't remember the neutralization of him but he reactivation solved the situation. It's probably the cause of CleanMyMac app. I'll try to address this issue to support CMM to recreate the bug and post here results...

  • Connection problems with O2/UK

    Hi all

    II having connection problems when running my application on the network O2/UK. It is specific to the said operator then please don't direct me to General articles on connection settings (I have a simple library for dealing with this).

    I first tried WAP2, which I think I read was the best option, and it failed with the following text: "java.io.IOException: APN is not specified." Connection parameters used were: «;» ConnectionUID = WAP2 + trans"(extract from the records of service). This indicates to me that the settings in the service record are not OK...

    Then I tried wap1 with the following settings found on the web (pinstack.com):

    Gateway IP: 192.113.200.195
    Port: 9201
    APN: wap.o2.co.uk
    username: o2wap
    password: password

    with this, I have net.rim.device.cldc.io.waphttp.WAPIOException. The parameters can of course be wrong (that's the point of not having them in the camera, as do all other manufacturers, BTW...). Y at - there someone here who has done other app works with o2 UK without resorting to the BIS? Any help is appreciated.

    Thank you

    Laszlo

    1. If you try WAP 2.0 TCP, then instead of '+' it probably should be a space in the ConnectionUID. It should read "ConnectionUID = WAP2 trans. You probably get a sign '+' because you think you need exhaust URL parameters, which is not the specific case for RIM connection settings.

    2. If you try Direct TCP (aka carrier TCP today), then take a look here: http://www.filesaveas.com/gprs.html I got a card SIM O2 (contract) and the "Mobile Web" APN settings worked very well.

  • RIM Push Notifications - connection limit

    Hello

    I send the rim push push through my BES BlackBerry.

    I received notifcation to another server. This server another wait notification.

    It works well, but it stops to work every day.

    The BES stops to send notifications to the other server. (even if the push message has been successfully delivered).

    I think that there is a connection limit or something like that.

    You have an idea?

    Looks like I'm wrong, we do not see a response from the device:

    <2011-01-28 10:35:36.095 CET>:[45819]:::
    

    But logging still does not show an attempt to notify the server and yet some information is missing. Could you please allow both verbose and logging HTTP? Also please let me know:

    -What size of shoot you send

    -The frequency that they are sent

    -Are there many instances of MDS - CS in your environment?

    -Try to push to another user, after that this problem occurs, you receive a response?

    -You send all right pushing every time during this test?

  • When I tried to run my Application with "Launch Android BlackBerry" on Bb 10.2 Simulator error: ERROR: code net.rim.ajde = 4 connecting 192.168.48.130 to BAD failed! NULL children = [status ERROR: code = 0 net.rim.ajde]

    ERROR: code net.rim.ajde = 4 connecting 192.168.48.130 to BAD failed! NULL children = [Status ERROR: net.rim.ajde]

     

     

    code 0 = Please check if the Android player was totally started when you got this error. Otherwise, you can either

     

    increase the time-out of the launch of reader Android on BlackBerry-> BlackBerry Android Development Tools

     

    page preferably or wait until the Android player is completely started and try again. NULL.]

     

     

    Please guide me how to solve this question where can I find

     

    BlackBerry-BlackBerry Android Development Tools >

    Please guide me with the Exact path

    Thank you

    OK, I have one installed and installed a new freshly.

    Solved my problem. Please answer my query to the other

    on the loading BAR file on BlackBerry Q5 Please.

    http://supportforums.BlackBerry.com/T5/Android-runtime-development/how-to-load-a-signed-bar-on-the-R...

  • XMPP? net.rim.device.cldc.io.ippp.SocketBaseIOException: Connection refused: connect

    Hello

    My system is running under the power of Attorney and I confifured mds setting of Article number: DB-00047.

    After this adjustment, I am able to do the http connection.

    I have downloaded the open source XMPP from this link. and I'm doing the connection socket with my Gmail now, but through it throw net.rim.device.cldc.io.ippp.SocketBaseIOException: connection refused: exception, but when I add on the side of true device he throw "java.io.IOException: Peer refused the connection.

    final StreamConnection connection = (StreamConnection) Connector.open("socket://" + this.host + ":" + this.port, Connector.READ_WRITE);
    

    I also tried adding deviceside = 'true' and 'false' parameter but I got same result.please help where I am doing wrong or it is still problem of proxy that do not allow the socket connection. Thoughts or ideas is greatly appreciated.

    Thank you.

    Currently, the MDS - CS Simulator allows only proxies be set for straight HTTP connections.

    Kind regards

  • net.rim.device.api.io.ConnectionClosedException: Connection closed

    Hello

    I'm "net.rim.device.api.io.ConnectionClosedException: Connection closed" exception so that he was trying to get the response code in the following code snippet. What will be the reason for this exception: -.

    HttpConnection connection=(HttpConnection)Connector.open(url);
            System.out.println("Post-----------------------1");
            connection.setRequestMethod(HttpConnection.POST);
            System.out.println("Post-----------------------2");
            connection.setRequestProperty("Content-Type",aRequest.getContentType());
            System.out.println("Post-----------------------3");
            Hashtable header=aRequest.getHeader();
            if(header!=null)
            {
                Enumeration enumeration =header.keys();
                while(enumeration.hasMoreElements())
                {
                    String headerStr=(String)enumeration.nextElement();
                    String headerValue=(String)header.get(headerStr);
                    //System.out.println("header:"+headerStr+"headerval::"+headerValue);
                    connection.setRequestProperty(headerStr,headerValue);
                }
            }
            System.out.println("Post-----------------------4");
            OutputStream postRequestOutputStream=connection.openOutputStream();
            System.out.println("Post-----------------------4#########");
            postRequestOutputStream.write(aRequest.getPostData());
            System.out.println("Post-----------------------4%%%%%%%");
            postRequestOutputStream.close();
            System.out.println("Post-----------------------5");
            System.out.println("RES CODE:"+connection.getResponseCode());
            InputStream is=connection.openInputStream();
    

    Try opening the InputStream before getResponseCode().

    concerning

  • net.rim.device.api.io.ConnectionClosedException: not connected

    Hello world

    I have problems when making calls POST on my app.

    When I meet first the question above, I fixed it by running the network call in a different thread.

    However, the problem has started again,

    Whenever I'm doing a POST request, my connection returns a response code 0, and I don't know what is causing the connection close. Download the application are works very well as a POST request when a user connects.

    However, for example when a user connects, I get a response code 0.

    I've been on it for a month now and I read many post about this, and yet I found nothing that solve my problem.

    Can someone help me with this.

    Thank you

    I would like to be confident that you are coding is different, because you say this:

    "I noticed that the response code is already 0.

    How many checks the response code are there in the sample that I pointed you to?

    You must complete your writing before you get the response code.  Get the response code means that BlackBerry, sends it the data to the server and gets a response from the server.  Thus, after the getResponseCode(), if you try to do anything other than read the answer, it will fail, as you have described.

    Please see the following Post, and you might find other positions in the interesting Thread:

    http://supportforums.BlackBerry.com/T5/notifications/notifymoderatorpage/message-UID/2867136

  • Not connected: net.rim.device.api.io.ConnectionClosedException on HttpConnection.openInputStream

    I am trying to download. AMR file to my server. My code is as follows:

    public byte[] send(byte[] fileBytes) throws Exception
        {
            String boundary = getBoundaryString();
            String endBoundary = "\r\n--" + boundary + "--\r\n";
            HttpConnection hc = null;
            InputStream is = null;
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            byte[] res = null;
            try
            {
                hc = (HttpConnection) Connector.open(url);
                hc.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + getBoundaryString());
                hc.setRequestMethod(HttpConnection.POST);
                hc.setRequestProperty(HttpProtocolConstants.HEADER_ACCEPT_CHARSET,
                        "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
                OutputStream dout = hc.openOutputStream();
                dout.write(boundaryMessage.getBytes());
                dout.write(this.postBytes);
                dout.write(endBoundary.getBytes());
                dout.close();
                int ch;
                is = hc.openInputStream(); //exception raised here
                if(hc.getResponseCode()== HttpConnection.HTTP_OK)
                        {
                    while ((ch = is.read()) != -1)
                    {
                        bos.write(ch);
                    }
                    res = bos.toByteArray();
                    System.out.println("res loaded..");
                         }
                else {
                    System.out.println("Unexpected response code: " + hc.getResponseCode());
                    hc.close();
                    return null;
                }
            }
            catch(IOException e)
            {
                System.out.println("====IOException : "+e.getMessage()+" Class: "+e.getClass());
            }
            catch(Exception e1)
                {
                    System.out.println("====Exception : "+e1.getMessage()+" Class: "+e1.getClass());
                }
            finally
            {
                try
                {
                    if(bos != null)
                        bos.close();
    
                    if(is != null)
                        is.close();
    
                    if(hc != null)
                        hc.close();
                }
                catch(Exception e2)
                {
                    e2.printStackTrace();
                    System.out.println("====Exception : "+e2.getMessage());
                }
            }
            return res;
        }
    

    The line of code highlighted above raises a ConnectionClosedException. Can someone tell me why and what I can do to overcome? Thanks in advance.

    This suggests that the server does not accept your application.  See if you can find what the server thinks is happening.  Check your URL too.

  • Cannot connect my BlackBerry 9700 with Windows.

    Original title: Divece driver does not

    Hi, I have a Blackberry 9700. I tried to connect it to my PC, which runs on windows Vista (also another one that turns under W7) and know it has no driver. and can not find a. Also tried several times to download as remove that to redownload the file of the driver from the website RIM still cannot find a driver, even thought that he integrates the latest version, and still claims the CD which is not included in any pack 9700.

    Please send me some answear because I'm going nuts.

    Hello
     

    1. How do you try to connect your BlackBerry to your computer? You use a USB cable or via Bluetooth?
    2. could you give us the exact error that you are experiencing?
    3. What is the status of this device in the Device Manager?
     
    See the links below for help on Device Manager.
    Open the Device Manager
    http://Windows.Microsoft.com/en-us/Windows-Vista/open-Device-Manager

    Method 1.
    Check if there is no driver available for BlackBerry 9700, through Windows update. You can also try to update this device in the Device Manager.
    You can also check the items below that explain to update hardware drivers.
    Updated a hardware driver that is not working properly
    http://Windows.Microsoft.com/en-us/Windows-Vista/update-a-driver-for-hardware-that-isn ' t-work correctly
     

    Method 2.
    First of all, you need to install the BlackBerry Desktop Software from the link below and then try borrowed the BlackBerry with your Windows computer using the USB cable. Navigate on the following link and in the dropdown choose the first option:
    BlackBerry Desktop Software version 5.0 Service Pack 1 and then press next and download it. Install this software and check if it works.
    https://www.BlackBerry.com/downloads/browseSoftware.do
    Here is the alternative link to download the software above.
    http://NA.BlackBerry.com/eng/services/desktop/
     
    Here is the support page for desktop software:
    http://NA.BlackBerry.com/eng/support/software/desktop.jsp
     
     
    This is the homepage of support BlackBerry:
    http://NA.BlackBerry.com/eng/support/

    Important note: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.
     
     
     
    I hope this helps.

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Connect my BB app to a webservice

    First of all Hello to everyone , this is my first post, I recently started to develop apps for BB

    I searched a lot, but I'll get into trouble trying to connect my blackberry application to a Web service that I am running. My Web service runs on a JBoss 5.0 Server and an Apache Axis2 runtime.

    If possible, good advice to want me please on what I need to accomplish this connectivity required.

    Kind regards!!!

    BB-DUDE!

    I got it to work, after a lot of research on! The only problem I had was that I wasn't running the MDS Simulator...

    So for the sum for all those wishing to have connectivity between BB and an Axis2 webservice (any compatible JSR - 172, JAX - WS webservice actually works wonderful too, .NET, etc.)

    1. you generate your heel using the Webtoolkit above, if you need a tut on how to do this, google "lotus domino Web service with blackberry", it is a very detailed example he

    2. Once you have your heels, import them into your BB project

    3. If you want to call your heels, you just need to instantiate the class stub (is the class that ends with '_Stub', generated by the webtoolkit)

    4. you call a method of the stub surrounded by try-catch

    5. PREVIOUSLY, use the BB Simulator, install and launch the Simulator MDS (BlackBerry® mail and v4.1.2). MDS Services Simulator Package If you don't do this, you will have a net.rim.VMError on the BB

    6. it is, you have connectivity between BB and the webservice - FINALLY!

    It is a solution not KSoap2, I read that KSoap2 was good, but now that BB natively supports the connection methods, you mustn't use KSoap2. This means that using Ksoap2 does not work, I just personally preferred to go with this solution.

    Best regards to all!

  • http connections fail after removing an application via the BES

    This is consistent - happened on three different phones.

    Measures taken since the BES

    1 deploy an application that uses an HTTP (definition of a custom policy of IT) through the BES connection. Everything works fine

    2 remove the app (by its configuration was rejected.)

    3. assign the policy to the default device

    4 configuration of the software place the device no

    5 deploy

    5. wait and check that app has been removed from the default value of advertising device it in place policy

    Now, the unit measures

    1. install the app even through Javaloader - now http connections fails

    On the curve (Rogers)

    java.io.IOException: Tunnel failed

    on Tour (Verizon)

    javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io. "http. Protocol

    Any ideas?

    Turns out I had put extra quotes in my url string. It works fine now.

    This diagnostic network (DB-00684) tool was very useful.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

  • Application does not work without wifi connection

    Hello I have a problem with the http connection

    my code is

    public class HttpConnectionFactory
    {
    
        /**
         * Specifies that only wifi should be used
         */
        public static final int TRANSPORT_WIFI = 1;
    
        /**
         * Specifies that only BES (also known as MDS or corporate servers)
         */
        public static final int TRANSPORT_BES = 2;
    
        /**
         * Specifies that only BIS should be used (Basically RIM hosted BES)
         */
        public static final int TRANSPORT_BIS = 4;
    
        /**
         * Specifies that TCP should be used (carrier transport)
         */
        public static final int TRANSPORT_DIRECT_TCP = 8;
    
        /**
         * Specifies that WAP2 should be used (carrier transport)
         */
        public static final int TRANSPORT_WAP2 = 16;
    
        /**
         * Equivalent to: TRANSPORT_WIFI | TRANSPORT_BES | TRANSPORT_BIS |
         * TRANSPORT_DIRECT_TCP | TRANSPORT_WAP2
         */
        public static final int TRANSPORTS_ANY = TRANSPORT_WIFI | TRANSPORT_BES
                | TRANSPORT_BIS | TRANSPORT_DIRECT_TCP | TRANSPORT_WAP2;
    
        /**
         * Equivalent to: TRANSPORT_WIFI | TRANSPORT_BES | TRANSPORT_BIS
         */
        public static final int TRANSPORTS_AVOID_CARRIER = TRANSPORT_WIFI
                | TRANSPORT_BES | TRANSPORT_BIS;
    
        /**
         * Equivalent to: TRANSPORT_DIRECT_TCP | TRANSPORT_WAP2
         */
        public static final int TRANSPORTS_CARRIER_ONLY = TRANSPORT_DIRECT_TCP
                | TRANSPORT_WAP2;
    
        /**
         * The default order in which selected transports will be attempted
         *
         */
        public static final int DEFAULT_TRANSPORT_ORDER[] = { // TRANSPORT_DIRECT_TCP
        // ,TRANSPORT_WAP2
                TRANSPORT_WIFI,
                // TRANSPORT_BES, TRANSPORT_BIS,
                // TRANSPORT_WAP2,
                TRANSPORT_DIRECT_TCP };
    
        private static final int TRANSPORT_COUNT = DEFAULT_TRANSPORT_ORDER.length;
    
        private static ServiceRecord srMDS[], srBIS[], srWAP2[], srWiFi[];
        private static boolean serviceRecordsLoaded = false;
    
        private int curIndex = 0;
        private int curSubIndex = 0;
        // private String url;
        private final String extraParameters;
        private final int transports[];
        private int lastTransport = 0;
    
        /**
         * Equivalent to
         * HttpConnectionFactory( url, null, HttpConnectionFactory.DEFAULT_TRANSPORT_ORDER )
         *
         * @see #HttpConnectionFactory(String, String, int[])
         * @param url
         *            See {@link #HttpConnectionFactory(String, String, int[])}
         */
        public HttpConnectionFactory() {
            this(null, 0);
        }
    
        /**
         * Equivalent to
         * HttpConnectionFactory( url, null, allowedTransports )
         *
         * @see #HttpConnectionFactory(String, String, int)
         * @param url
         *            See {@link #HttpConnectionFactory(String, String, int)}
         * @param allowedTransports
         *            See {@link #HttpConnectionFactory(String, String, int)}
         */
        public HttpConnectionFactory(int allowedTransports) {
            this(null, allowedTransports);
        }
        public HttpConnectionFactory(int transportPriority[]) {
            this(null, transportPriority);
        }
    
        public HttpConnectionFactory(String extraParameters, int allowedTransports) {
            this(extraParameters, transportMaskToArray(allowedTransports));
        }
        public HttpConnectionFactory(String extraParameters,
                int transportPriority[]) {
            if (!serviceRecordsLoaded) {
                loadServiceBooks(false);
            }
            //
            // if (url == null) {
            // throw new IllegalArgumentException("Null URL passed in");
            // }
            // if (!url.toLowerCase().startsWith("http")) {
            // throw new IllegalArgumentException("URL not http or https");
            // }
            //
            // this.url = url;
            this.extraParameters = extraParameters;
            transports = transportPriority;
        }
        public Connection getNextConnection(String url)
                throws NoMoreTransportsException {
            Connection con = null;
            int countsWap = 0;
            int countsBis = 0;
            int countsBes = 0;
            int curTransport = 0;
            while (con == null && curIndex < transports.length) {
                System.out.println("con=" + con + " curid=" + curIndex);
                curTransport = transports[curIndex];
                switch (curTransport) {
                case TRANSPORT_WIFI:
                    curIndex++;
                    curSubIndex = 0;
                    try {
                        con = getWifiConnection(url);
                    } catch (Exception e) {
                    }
                    break;
                case TRANSPORT_BES:
                    curIndex++;
                    curSubIndex = 0;
                    try {
                        if (countsBes > 3) {
                            throw new NoMoreTransportsException();
                        }
                        con = getBesConnection(url);
                        countsBes++;
                    } catch (Exception e) {
                    }
                    break;
                case TRANSPORT_BIS:
                    while (con == null) {
                        try {
                            if (countsBis > 3) {
                                throw new NoMoreTransportsException();
                            }
                            con = getBisConnection(url, curSubIndex);
                            countsBis++;
                        } catch (NoMoreTransportsException e) {
                            curIndex++;
                            curSubIndex = 0;
                            break;
                        } catch (Exception e) {
                        }
                    }
                    break;
                case TRANSPORT_DIRECT_TCP:
                    curIndex++;
                    try {
                        con = getTcpConnection(url);
                    } catch (Exception e) {
                    }
                    break;
                case TRANSPORT_WAP2:
                    while (con == null)
                    {
                        // try {
                        // if (countsWap > 3) {
                        // throw new NoMoreTransportsException();
                        // }
                        // // con = getWap2Connection(url, curSubIndex);
                        // countsWap++;
                        // } catch (NoMoreTransportsException e) {
                        // curIndex++;
                        // curSubIndex = 0;
                        // break;
                        // } catch (Exception e) {
                        // }
                    }
                    break;
                }
            }
            if (con == null) {
                throw new NoMoreTransportsException();
            }
    
            lastTransport = curTransport;
            return con;
        }
    
        public Connection getCurrentConnection(String url)
                throws NoMoreTransportsException {
            Connection con = null;
            switch (lastTransport) {
            case TRANSPORT_WIFI:
                try {
                    con = getWifiConnection(url);
                } catch (Exception e) {
                }
                break;
            case TRANSPORT_BES:
                try {
                    con = getBesConnection(url);
                } catch (Exception e) {
                }
                break;
            case TRANSPORT_BIS:
                while (con == null) {
                    try {
                        con = getBisConnection(url, curSubIndex);
                    } catch (NoMoreTransportsException e) {
                        break;
                    } catch (Exception e) {
                    }
                }
                break;
            case TRANSPORT_DIRECT_TCP:
                try {
                    con = getTcpConnection(url);
                } catch (Exception e) {
                }
                break;
            case TRANSPORT_WAP2:
                while (con == null) {
                    try {
                        con = getWap2Connection(url, curSubIndex);
                        System.out.println("" + con);
                    } catch (NoMoreTransportsException e) {
                        break;
                    } catch (Exception e) {
                    }
                }
                break;
            }
    
            return con;
        }
    
        /**
         * Returns the transport used in the connection last returned via
         * {@link #getNextConnection()}
         *
         * @return the transport used in the connection last returned via
         *         {@link #getNextConnection()} or 0 if none
         */
        public int getLastTransport() {
            return lastTransport;
        }
    
        /**
         * Generates a connection using the BIS transport if available
         *
         * @param index
         *            The index of the service book to use
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws NoMoreTransportsException
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getBisConnection(String url, int index)
                throws NoMoreTransportsException, IOException {
            System.out.println("BIS Try");
            if (index >= srBIS.length) {
                throw new NoMoreTransportsException("Out of BIS transports");
            }
            ServiceRecord sr = srBIS[index];
            return getConnection(url, ";deviceside=false;connectionUID=", sr
                    .getUid());
        }
    
        /**
         * Generates a connection using the BES transport if available
         *
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getBesConnection(String url) throws IOException {
            System.out.println("BES try");
            if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS)) {
                return getConnection(url, ";deviceside=false", null);
            }
            return null;
        }
    
        /**
         * Generates a connection using the WIFI transport if available
         *
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getWifiConnection(String url) throws IOException {
            System.out.println("wifi try");
            // if (RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)
            // && (RadioInfo.getActiveWAFs() & RadioInfo.WAF_WLAN) != 0
            // && CoverageInfo.isCoverageSufficient(1 /*
            // * CoverageInfo.COVERAGE_DIRECT
            // */,
            // RadioInfo.WAF_WLAN, false)) {
            //
            // return getConnection(";deviceside=true;interface=wifi", null);
            // // return getConnection(";deviceside=true;interface=wifi", null);
            //
            // }
            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED
                    && srWiFi.length > 0) {
                return getConnection(url, ";interface=wifi", null);
            }
            return null;
        }
    
        /**
         * Generates a connection using the WAP2 transport if available
         *
         * @param index
         *            The index of the service book to use
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws NoMoreTransportsException
         *             if index is outside the range of available service books
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getWap2Connection(String url, int index)
                throws NoMoreTransportsException, IOException {
            System.out.println("WAP2 try");
            if (index >= srWAP2.length) {
                throw new NoMoreTransportsException("Out of WAP2 transports");
            }
            if (CoverageInfo
                    .isCoverageSufficient(1 /* CoverageInfo.COVERAGE_DIRECT */)) {
                ServiceRecord sr = srWAP2[index];
                return getConnection(url, ";ConnectionUID=", sr.getUid());
            }
            return null;
        }
    
        /**
         * Generates a connection using the TCP transport if available
         *
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getTcpConnection(String url) throws IOException {
            System.out.println("direct try");
            if (CoverageInfo
                    .isCoverageSufficient(1 /* CoverageInfo.COVERAGE_DIRECT */)) {
                String extraParameter = null;
                if (!DeviceInfo.isSimulator()) {
                    url = url + ";deviceside=true";
                }
    
                return getConnection(url, null, null);
                // ";deviceside=true", null);
            }
            return null;
        }
    
        /**
         * Utility method for actually getting a connection using whatever transport
         * arguments the transport may need
         *
         * @param transportExtras1
         *            If not null will be concatenated onto the end of the
         *            {@link url}
         * @param transportExtras2
         *            If not null will be concatenated onto the end of {@link url}
         *            after transportExtras1
         * @return An {@link HttpConnection} built using the url and transport
         *         settings provided
         * @throws IOException
         *             any exceptions thrown by {@link Connector.open( String name
         *             )}
         */
        private Connection getConnection(String url, String transportExtras1,
                String transportExtras2) throws IOException {
            StringBuffer fullUrl = new StringBuffer();
            fullUrl.append(url);
            if (transportExtras1 != null) {
                fullUrl.append(transportExtras1);
            }
            if (transportExtras2 != null) {
                fullUrl.append(transportExtras2);
            }
            if (extraParameters != null) {
                fullUrl.append(extraParameters);
            }
            // fullUrl.append(";ConnectionTimeout=5000");
            System.out.println(fullUrl.toString());
            return Connector.open(fullUrl.toString(), Connector.READ_WRITE, true);
        }
    
        /**
         * Public method used to reload service books for whatever reason (though I
         * can't think of any)
         */
        public static void reloadServiceBooks() {
            loadServiceBooks(true);
        }
    
        /**
         * Loads all pertinent service books into local variables for later use.
         * Called upon first instantiation of the class and upload {@link
         * reloadServiceBooks()}
         *
         * @param reload
         *            Whether to force a reload even if they've already been loaded.
         */
        private static synchronized void loadServiceBooks(boolean reload) {
            if (serviceRecordsLoaded && !reload) {
                return;
            }
            ServiceBook sb = ServiceBook.getSB();
            ServiceRecord[] records = sb.getRecords();
            Vector mdsVec = new Vector();
            Vector bisVec = new Vector();
            Vector wap2Vec = new Vector();
            Vector wifiVec = new Vector();
    
            if (!serviceRecordsLoaded) {
                for (int i = 0; i < records.length; i++) {
                    ServiceRecord myRecord = records[i];
                    String cid, uid;
                    // sometimes service record is disabled but works
                    if (myRecord.isValid() /* && !myRecord.isDisabled() */) {
                        cid = myRecord.getCid().toLowerCase();
                        uid = myRecord.getUid().toLowerCase();
                        // BIS
                        if (cid.indexOf("ippp") != -1 && uid.indexOf("gpmds") != -1) {
                            bisVec.addElement(myRecord);
                        }
                        // WAP1.0: Not implemented.
    
                        // BES
                        if (cid.indexOf("ippp") != -1 && uid.indexOf("gpmds") == -1) {
                            mdsVec.addElement(myRecord);
                        }
                        // WiFi
                        if (cid.indexOf("wptcp") != -1 && uid.indexOf("wifi") != -1) {
                            wifiVec.addElement(myRecord);
                        }
                        // Wap2
                        if (cid.indexOf("wptcp") != -1 && uid.indexOf("wap2") != -1) {
                            wap2Vec.addElement(myRecord);
                        }
                    }
                }
                srMDS = new ServiceRecord[mdsVec.size()];
                mdsVec.copyInto(srMDS);
                mdsVec.removeAllElements();
                mdsVec = null;
    
                srBIS = new ServiceRecord[bisVec.size()];
                bisVec.copyInto(srBIS);
                bisVec.removeAllElements();
                bisVec = null;
    
                srWAP2 = new ServiceRecord[wap2Vec.size()];
                wap2Vec.copyInto(srWAP2);
                wap2Vec.removeAllElements();
                wap2Vec = null;
    
                srWiFi = new ServiceRecord[wifiVec.size()];
                wifiVec.copyInto(srWiFi);
                wifiVec.removeAllElements();
                wifiVec = null;
    
                serviceRecordsLoaded = true;
            }
        }
    
        /**
         * Utility methd for converting a mask of transports into an array of
         * transports in default order
         *
         * @param mask
         *            ORed collection of masks, example:
         *            TRANSPORT_WIFI | TRANSPORT_BES
         * @return an array of the transports specified in mask in default order,
         *         example: { TRANSPORT_WIFI, TRANSPORT_BES }
         */
        private static int[] transportMaskToArray(int mask) {
            if (mask == 0) {
                mask = TRANSPORTS_ANY;
            }
            int numTransports = 0;
            for (int i = 0; i < TRANSPORT_COUNT; i++) {
                if ((DEFAULT_TRANSPORT_ORDER[i] & mask) != 0) {
                    numTransports++;
                }
            }
            int transports[] = new int[numTransports];
            int index = 0;
            for (int i = 0; i < TRANSPORT_COUNT; i++) {
                if ((DEFAULT_TRANSPORT_ORDER[i] & mask) != 0) {
                    transports[index++] = DEFAULT_TRANSPORT_ORDER[i];
                }
            }
            return transports;
        }
    }
    

    HIII, I use this class to call http to the server, but each time that gives the error No more TransportsException
    application only works on wifi
    I try both GET and POST nothing worked

    device: = 8520 os 5.0
    BIS service provider:-vodaphone plan 15/day
    in that gtalk and facebook works fine

    also I test this app in Arabic countries it also does not work

    ------------------------------after i am test using ---------------------------------------------
    networkDignostic link:- http://supportforums.blackberry.com/t5/Java-Development/What-Is-Network-API-alternative-for-legacy-O...

    use networkDignostic to test the available transport connection

    Here is the result

    The Radio Signal level:-81 dBm
    WIFI Signal level: No coverage
    Network name: Vodafone in
    Network type: GPRS
    Network services: data + EDGE + voice
    PIN: 27F03947
    Battery: 81%
    = End of network Info =.
    Transport: by default (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /
    Journal:

    Login to http://www.google.ca:80 /
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: by default (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80
    Journal:

    Connecting to a socket: / /www.google.ca:80
    Opening connection...
    Error: java.io.IOException: invalid url parameter.
    = END OF LOG =.

    Transport: by default (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /
    Journal:

    Login to http://www.google.ca:80 /
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: By default (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80
    Journal:

    Connecting to a socket: / /www.google.ca:80
    Opening connection...
    Error: java.io.IOException: invalid url parameter.
    = END OF LOG =.

    Transport: TCP cellular (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true
    Journal:

    Login to http://www.google.ca:80 /; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: TCP cell (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: TCP cellular (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true
    Journal:

    Login to http://www.google.ca:80 /; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: TCP cell (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: MDS (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: MDS (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: MDS (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: MDS (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: BIS - B (HTTP GET)
    Result: pass
    Answer: 200
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = false; ConnectionType = m * s - pub *
    Journal:

    Login to http://www.google.ca:80 /; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Definition of the properties of application...
    Host: www.google.ca
    User-Agent: Mozilla/4.0
    Connection: close
    Get the response code...
    Response code: 200
    Got the content length:-1 bytes
    Downloading content...
    Download time: 3,034 seconds
    Downloaded: 37943 bytes
    Closes the connection...
    Connection closed
    = END OF LOG =.

    Transport: BIS - B (Socket GET)
    Result: pass
    Answer: 200
    Length: 38696
    URL: socket: / /www.google.ca:80; deviceside = false; ConnectionType = m * s - could * c
    Journal:

    Connecting to a socket: / /www.google.ca:80; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Send GET request:
    "GET / HTTP/1.1".
    Host: www.google.ca
    User-Agent: Mozilla/4.0
    Connection: close

    "
    Downloading content...
    Download time: 2,397 seconds
    Downloaded: 38696 bytes
    Closing connection
    Connection closed
    = END OF LOG =.

    Transport: BIS - B (HTTP POST)
    Result: failure
    Answer: 405
    Length: 959
    URL: http://www.google.ca:80 /; deviceside = false; ConnectionType = m * s - p * ic
    Journal:

    Login to http://www.google.ca:80 /; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Request method POST value
    Definition of the properties of application...
    Host: www.google.ca
    Content-Length: 1500
    Content-Type: application/octet-stream
    User-Agent: Mozilla/4.0
    Connection: close
    Display of 1 500 bytes...
    Posted 1 500 bytes
    Get the response code...
    Response code: 405
    Got the content length: 959 bytes
    Downloading content...
    Download time: 1,044 seconds
    Downloaded: 959 bytes
    Closing connection
    Connection closed
    = END OF LOG =.

    Transport: BIS - B (POST plug)
    Result: failure
    Answer: 405
    Length: 1204
    URL: socket: / /www.google.ca:80; deviceside = false; ConnectionType = m * Pei * li *
    Journal:

    Connecting to a socket: / /www.google.ca:80; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Definition of the properties of application...
    Envoy POST request:
    "POST / HTTP/1.1".
    Host: www.google.ca
    Content-Length: 1500
    Content-Type: application/octet-stream
    User-Agent: Mozilla/4.0
    Connection: close

    "
    Display of 1 500 bytes...
    Posted 1 500 bytes
    Downloading content...
    Download time: 2,041 seconds
    Downloaded: 1204 bytes
    Closing connection
    Connection closed
    = END OF LOG =.

    Transport: WAP (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP2 (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connection http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WAP2 (socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WAP2 (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connection http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WAP2 (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WiFi (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Transport: WiFi (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Transport: WiFi (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Transport: WiFi (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Thank you peter and jovinz

    I think I have problem in httpconnectionfactory with several url parameter, as peter says

    so now I have usr post url as the code below

       public static void CheckConnection()
        {
            HttpConnection hc=null;
            try
            {
                //Wifi Connection
                if ( (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) && RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN))
                {
                    ConstantData.postURL=";interface=wifi";
                    return;
                }
                //for BES or MDS Connection
                if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS))
                {
                    boolean connectionFlag=false;
                    String post_url;
    
                    //for BES Connections
                    post_url="";
                    try
                    {
                        hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url,Connector.READ_WRITE);
                        if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                        {
                            connectionFlag=true;
                            ConstantData.postURL=post_url;
                            return;
                        }
                        if(hc!=null)
                            hc.close();
                    }
                    catch (Exception e)
                    {
                        System.out.println(e.toString());
                        connectionFlag=false;
                    }
                    //for MDS Connection
                    if(!connectionFlag)
                    {
                        try
                        {
                            post_url = ";deviceside=false";
                            hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);
                            if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                            {
                                ConstantData.postURL=post_url;
                                return;
                            }
                            if(hc!=null)
                                hc.close();
                        }
                        catch (Exception e)
                        {
                            System.out.println(e.toString());
                        }
                    }
                }
                //for BIS Connection
                if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B))
                {
                    //BIS Connection
                    String post_url = ";deviceside=false;ConnectionType=m**-pu***c";
                    try
                    {
                        hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);//Connector.READ_WRITE
                        if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                        {
                            ConstantData.postURL=post_url;
                            return;
                        }
                        if(hc!=null)
                            hc.close();
                    }
                    catch (Exception e)
                    {
                        System.out.println(e.toString());
                    }
                }
                //for WAP Connection
                if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT))
                {               //for WAP Connection
                    String post_url = null;
                    ServiceBook sb = ServiceBook.getSB();
                    ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
                    String uid = null;
                    boolean connectionFlag=false;
                    for(int i=0; i < records.length; i++)
                    {
                        if (records[i].isValid() && !records[i].isDisabled())
                        {
                            if (records[i].getUid() != null && records[i].getUid().length() != 0)
                            {
                                if ((records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
                                        (records[i].getUid().toLowerCase().indexOf("mms") == -1))
                                {
                                    uid = records[i].getUid();
                                    break;
                                }
                            }
                        }
                    }
                    if (uid != null)
                    {
                        post_url= ";deviceside=true;ConnectionUID=" + uid;
                    }
                    try
                    {
                        hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);
                        if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                        {
                            connectionFlag=true;
                            ConstantData.postURL=post_url;
                            return;
                        }
                        if(hc!=null)
                            hc.close();
                    }
                    catch (Exception e)
                    {               System.out.println(e.toString());
                    connectionFlag=false;
                    }
                    if(!connectionFlag)
                    {
                        post_url=";deviceside=true;apn=blackberry.net";
                        try
                        {
                            hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);
                            if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                            {
                                ConstantData.postURL=post_url;
                                return;
                            }
                            if(hc!=null)
                                hc.close();
                        }
                        catch (Exception e)
                        {
                            System.out.println(e.toString());
                        }
                    }}
            }
            catch (Exception e)
            {
    
                e.printStackTrace();
            }
            finally
            {
                try
                {
                    if(hc!=null)
                        hc.close();
                } catch (IOException e) {
                    System.out.println(e.toString());
                    e.printStackTrace();
                }
            }
    
        }
    

    so now its works on WAP2, BIS and the WIFi works fine

    the first issue of priority celluler TCP post code is also more WAP2 then

    Thus, each transport time select TCP when BIS, WIFI not presend and need for apn

    in any case, once again, thank you Peter and demo tools network dignostic is awasome...

  • Extract the value of CallType when the call is connected by using the callConnected() method

    Hi all

    I want to get the value of CallType when a call is connected I use this code:

    Public MyClass extends AbstractPhoneListener {}

    private static int callType;

    public MyClass()

    {

    }

    {} public void callConnected (int callId)
    Boolean checkType is Phone.getCall (callId) .isOutgoing ();.
    If (checkType)
    callType = PhoneCallLog.TYPE_PLACED_CALL;
    on the other
    callType = PhoneCallLog.TYPE_RECEIVED_CALL;
    }

    }

    but I did not value of callType when the call is connected. I also debug application but control entered the callConnected method. What should I do now please help...

    have you added the phonelistener?
    http://www.BlackBerry.com/developers/docs/7.1.0api/NET/RIM/BlackBerry/API/phone/phone.html#addPhoneL...

  • Examples of code to create the connection of BWS

    Hi I started using BWS (Blackberry Web Services) recently after the use of BAA (Blackberry Administration API) for some time. I would get a tutorial or sample code showing the initialization of the connection to the BWS and then use it to call the getUsersDetail method. I have the below code is missing the connection of BWS.

    import java.util.List;
    
    import com.rim.ws.enterprise.admin.*;
    public class BWSTest {
    
        public static String locale = "en_US";
        public static void main(String[] args){
    
            RequestMetadata requestMetadata = new RequestMetadata();
            requestMetadata.setLocale(locale);
            GetUsersDetailRequest userRequest = new GetUsersDetailRequest();
            userRequest.setMetadata(requestMetadata);
            userRequest.setLoadDevices(true);
            userRequest.setLoadAccounts(true);
            userRequest.setLoadITPolicies(true);
            userRequest.setLoadSWConfigs(true);
    //      List allUsers=userRequest.getUsers(); this method reflects users added as part of the request, not resulting from it
            GetUsersDetailResponse response = bws.getUsersDetail(request);
    
            if (response.getReturnStatus().getCode().compareTo("SUCCESS") !=0){
                System.out.println("Error occurred: "+response.getReturnStatus().getMessage() );
            }
    
            for(GetUsersDetailIndividualResponse individualResponse:response.getIndividualResponses()){
                individualResponse.getUserDetail().getDisplayName();
            }
    
        }
    
    }
    

    I found this code on the following link in a zip file:

    BWS Java sample

    import java.net.MalformedURLException;
    import java.net.URL;
    
    import javax.xml.ws.BindingProvider;
    
    import com.rim.ws.enterprise.admin.BWS;
    import com.rim.ws.enterprise.admin.BWSService;
    import com.rim.ws.enterprise.admin.BWSUtil;
    import com.rim.ws.enterprise.admin.BWSUtilService;
    import com.rim.ws.enterprise.admin.GetEncodedUsernameRequest;
    import com.rim.ws.enterprise.admin.GetEncodedUsernameResponse;
    import com.rim.ws.enterprise.admin.GetUsersRequest;
    import com.rim.ws.enterprise.admin.GetUsersResponse;
    import com.rim.ws.enterprise.admin.GetUsersSearchCriteria;
    import com.rim.ws.enterprise.admin.GetUsersSortBy;
    import com.rim.ws.enterprise.admin.RequestMetadata;
    import com.rim.ws.enterprise.admin.User;
    
    /**
     * This simple program finds users on the BlackBerry Administration Server,
     * and displays the existing users in the Console output.
     *
     * @author gbeukeboom
     *
     */
    
    public class TestMain {
    
        public static BWSService _myBWSService;
        public static BWS _bws;
        public static BWSUtilService _myBWSUtilService;
        public static BWSUtil _bwsUtil;
        private static String _locale = "en_US";
        private static String _clientVersion = "5.0.3"; //The version of BAS this application was created for
        private static RequestMetadata _meta = new RequestMetadata();;
    
        private static boolean setup() {
            String strBASURL=System.getProperty("basurl");
            URL serviceUrl = null;
            URL utilServiceUrl=null;
    
            //The Metadata object includes information about this application, it is included with every call
            _meta.setClientVersion(_clientVersion);
            _meta.setOrganizationUid("0"); //Not used currently, set to "0"
            _meta.setLocale(_locale);
    
            try {
                serviceUrl = new URL("https://" + strBASURL + "/enterprise/admin/ws?wsdl");
                utilServiceUrl = new URL("https://" + strBASURL + "/enterprise/admin/util/ws?wsdl");
            } catch (MalformedURLException e) {
                System.err.println("Cannot initialize the wsdl");
                return false;
            }
    
            //Initialize our web service stubs that will be used for all calls
            _myBWSService = new BWSService(serviceUrl);
            _bws = _myBWSService.getBWS();
            _myBWSUtilService = new BWSUtilService(utilServiceUrl);
            _bwsUtil = _myBWSUtilService.getBWSUtil();
    
            String username=System.getProperty("username");
            String password=System.getProperty("password");
    
            GetEncodedUsernameRequest request=new GetEncodedUsernameRequest();
            request.setMetadata(_meta);
            request.setUsername(username);
            request.setDomain(strBASURL);
    
            //The BAS expects the username to be encoded, this call returns the encoded value
            GetEncodedUsernameResponse geurResponse = _bwsUtil.getEncodedUsername(request);
    
            if (geurResponse.getReturnStatus().getCode().compareTo("SUCCESS") != 0){
                System.out.println("Error occurred: " + geurResponse.getReturnStatus().getMessage());
                return false;
            }
    
            String myEncodeUsername = geurResponse.getEncodedUsername();
    
            //Set http basic authentication on the web service
            BindingProvider bp = (BindingProvider)_bws;
            bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, myEncodeUsername);
            bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
    
            return true;
        }
    
        public static void getUsers() {
    
            GetUsersRequest request = new GetUsersRequest();
            request.setMetadata(_meta); //Assign our Metadata to the call
    
            //This criteria object could be used to specify search parameters
            GetUsersSearchCriteria searchCriteria = new GetUsersSearchCriteria();
    
            request.setSearchCriteria(searchCriteria);
            request.setPageSize(500);
    
            GetUsersSortBy sortBy = new GetUsersSortBy();
            sortBy.setEMAILADDRESS(true);
            sortBy.setValue("EMAIL_ADDRESS");
            request.setSortBy(sortBy);
            request.setSortAscending(true);
    
            GetUsersResponse response = _bws.getUsers(request);
    
            //If the result returned from the call is SUCCESS then we loop through all returned users
            //outputting their information to the console.
            if (response.getReturnStatus().getCode().compareTo("SUCCESS") != 0){
                System.out.println("Error occurred: " + response.getReturnStatus().getMessage());
            } else if (response.getUsers() != null) {
                for (User itr: response.getUsers()) {
                    System.out.println("Display name: " + itr.getDisplayName());
                    System.out.println("User ID: " + itr.getUid());
                    for (String emailAddress :itr.getEmailAddresses() ){
                        System.out.println("Email Address: " + emailAddress);
                    }
                    System.out.print("\n");
                }
            }
        }
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            System.out.println("Starting to intiialize credentials...");
            if (!setup()){
                System.out.println("Problem occurred while setting up credentials.");
                System.exit(0);
            }
            System.out.println("Credentials initialized.\n");
            System.out.println("Starting to retrieve users...");
            getUsers();
        }
    
    }
    

Maybe you are looking for