Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7060499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:21:37+00:00 2026-05-28T04:21:37+00:00

I am developing BlackBerry application that connects to the web service. When I developed

  • 0

I am developing BlackBerry application that connects to the web service.

When I developed on simulator, I used BlackBerry MDS for simulator and everything just went fine. My application (running on simulator) can connect with my web service perfectly. Please note that the simulator and the web service are on different PCs.

Now, my project is done. I tried deploying my app to the real device (BB 8520). When I used the app on the device, I found it can’t connect to the web service. I did a research on the Internet and I am sure it must be due to MDS issue. It seems like I have to do something with MDS on the computer where my web service resides, but I still can’t find the obvious answer.

Anyone please help me…

PS. My web service is published on IIS and is developed in Visual Studio 2010. The BlackBerry application is developed in Eclipse and connects to web service via ksoap2. Firewall on the computer where web service resides is closed. The connection used is WIFI.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:21:37+00:00Added an answer on May 28, 2026 at 4:21 am

    You have to add all connection parameter into your URL using HTTPConnetion. Create one Custom class to check connetion parameter .. USE the below Custom Class.

    public class HttpConnectionImpl 
    extends impl.javame.com.twitterapime.io.HttpConnectionImpl {
    
    private static String appendConnectionParameters;
    
    private static String connectionParameters;
    
    
    private static ServiceRecord getWAP2ServiceRecord() {
        String cid;
        String uid;
        ServiceBook sb = ServiceBook.getSB();
        ServiceRecord[] records = sb.getRecords();
        //
        for (int i = records.length -1; i >= 0; i--) {
            cid = records[i].getCid().toLowerCase();
            uid = records[i].getUid().toLowerCase();
            //
            if (cid.indexOf("wptcp") != -1 
                    && uid.indexOf("wifi") == -1 
                    && uid.indexOf("mms") == -1) {
                return records[i];
            }
        }
        //
        return null;
    }
    
    
    public static String getConnectionParams() {
        String connParams = "";
        //
        if (connectionParameters != null) {
            connParams = connectionParameters;
        } else {
            if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
                connParams = ";interface=wifi"; //Connected to a WiFi access point.
            } else {
                int coverageStatus = CoverageInfo.getCoverageStatus();
                //
                if ((coverageStatus & CoverageInfo.COVERAGE_BIS_B) == CoverageInfo.COVERAGE_BIS_B) {
                    connParams = ";deviceside=false;ConnectionType=mds-public";
                } else if ((coverageStatus & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT) {
                    // Have network coverage and a WAP 2.0 service book record
                    ServiceRecord record = getWAP2ServiceRecord();
                    //
                    if (record != null) {
                        connParams = ";deviceside=true;ConnectionUID=" + record.getUid();
                    } else {
                        connParams = ";deviceside=true";
                    }
                } else if ((coverageStatus & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS) {
                    // Have an MDS service book and network coverage
                    connParams = ";deviceside=false";
                }
            }
            //
            if (appendConnectionParameters != null) {
                connParams += appendConnectionParameters;
            }
        }
        //
        return connParams;
    }
    
    
    public static void setAppendConnectionParameters(String params) {
        if (params != null && !params.startsWith(";")) {
            params = ";" + params;
        }
        //
        appendConnectionParameters = params;
    }
    
    
    public static void setConnectionParameters(String params) {
        if (params != null && !params.startsWith(";")) {
            params = ";" + params;
        }
        //
        connectionParameters = params;
    }
    
    
    public void open(String url) throws IOException {
        super.open(url + getConnectionParams());
    }
    }
    

    After integrating above class u have to make one package with name impl.javame.com.twitterapime.io and add below class.

    `package impl.javame.com.twitterapime.io;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.microedition.io.Connector;
    import com.twitterapime.io.HttpConnection;

    public class HttpConnectionImpl implements HttpConnection {
    private javax.microedition.io.HttpConnection httpConn;

    public void open(String url) throws IOException {
        httpConn =
            (javax.microedition.io.HttpConnection)
                Connector.open(url, Connector.READ_WRITE, true);
    }
    
    public void close() throws IOException {
        httpConn.close();
    }
    
    public int getResponseCode() throws IOException {
        return httpConn.getResponseCode();
    }
    public InputStream openInputStream() throws IOException {
        return httpConn.openInputStream();
    }
    
    public OutputStream openOutputStream() throws IOException {
        return httpConn.openOutputStream();
    }
    public void setRequestMethod(String method) throws IOException {
        httpConn.setRequestMethod(method);
    }
    public void setRequestProperty(String key, String value) throws IOException{
        httpConn.setRequestProperty(key, value);
    }
    public String getRequestProperty(String key) throws IOException {
        return httpConn.getRequestProperty(key);
    }
    public String getHeaderField(String name) throws IOException {
        return httpConn.getHeaderField(name);       
    }
    

    }`

    Now you have to integrate another two class

    1. HttpConnection
    2. HttpResponsein com.twitterapime.io package.

    `package com.twitterapime.io;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    public interface HttpConnection {
    public static final String GET = “GET”;

    public static final String POST = "POST";
    
    public static final String HEAD = "HEAD";
    
    public static final int HTTP_OK = 200;
    
    public static final int HTTP_FORBIDDEN = 403;
    
    public static final int HTTP_UNAVAILABLE = 503;
    
    public static final int HTTP_NOT_MODIFIED = 304;
    
    public static final int HTTP_BAD_REQUEST = 400;
    
    public static final int HTTP_UNAUTHORIZED = 401;
    
    public static final int HTTP_NOT_FOUND = 404;
    
    public static final int HTTP_NOT_ACCEPTABLE = 406;
    
    public static final int HTTP_INTERNAL_ERROR = 500;
    
    public static final int HTTP_BAD_GATEWAY  = 502;
    
    public void open(String url) throws IOException;
    
    public void close() throws IOException;
    
    public int getResponseCode() throws IOException;
    
    public InputStream openInputStream() throws IOException;
    
    public OutputStream openOutputStream() throws IOException;
    
    public void setRequestMethod(String method) throws IOException;
    
    public void setRequestProperty(String key, String value) throws IOException;
    
    public String getRequestProperty(String key) throws IOException;
    
    public String getHeaderField(String name) throws IOException;
    


    Bwlow is HttpResponse Class`

    `package com.twitterapime.io;

    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.UnsupportedEncodingException;

    public final class HttpResponse {
    private int code;

    private String body;
    
    private InputStream stream;
    
    private HttpConnection conn;
    
    HttpResponse(HttpConnection conn) throws IOException {
        this.conn = conn;
        code = conn.getResponseCode();
        stream = conn.openInputStream();
    }
    
    public boolean wasSuccessful() {
        return code >= 200 && code < 400;
    }
    
    public String getBodyContent() throws IOException {
        return body != null ? body : (body = parseBody(stream));
    }
    
    public InputStream getStream() {
        return stream;
    }
    
    public int getCode() {
        return code;
    }
    
    public String getResponseField(String key) throws IOException {
        return conn.getRequestProperty(key);
    }
    
    private String parseBody(InputStream in) throws IOException {
        if (in == null) {
            return null;
        }
        //
        ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
        byte[] buffer = new byte[1024];
        //
        for (int n; (n = in.read(buffer)) > 0;) {
            out.write(buffer, 0, n);
        }
        //
        try {
            return new String(out.toByteArray(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new IOException(e.getMessage());
        }
    }
    

    }`

    Use the below mathod to check your connetion parameter. This method automatically check your device connetion availability and add connetion parameter based on your connection.

    protected HttpConnection getConnection(String url) throws IOException {
        url += HttpConnectionImpl.getConnectionParams();
        //
        return (HttpConnection)Connector.open(url);
    }
    

    The above HttpConnection method return URL with connetion parameter .. than u can use this connetion in yout InputStream and open any url as well as webservice.

    i hope this will help you…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a blackberry application using j2me and LWUIT (blackberry port). Everything works
When developing on BlackBerry or iOS, you can deploy your application just by dropping
I am developing a BlackBerry application that should work on OS 4.5+. I have
I am developing a web application that uses JSF 1.2 for the view layer.
I have used Netbeans 7.0 for developing Blackberry application with LWUIT framework. And I'm
I am developing a BlackBerry application that uses the Mail functionality. My problem is
I am developing blackberry application using BlackBerry JDE 5.0.X , in which i am
I'm developing a blackberry application to remotely access an external customer database. Selected employees
I am developing a blackberry application and i wanted to access the websites from
I have been developing a BlackBerry application for about 7 months, and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.