View Single Post
Old 03-14-2009, 07:42 PM   #2
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Putting parameters in the URL is not the HTTP POST protocol, but you just include the parameters in the URL as you have it coded there (with the https:// prefix of course, eg):

Code:
HttpConnection http = (HttpConnection)Connector.open("https://example.com/path/app.asmx/Function?Param1=123456&Param2=098765");

 returnCode = http.getResponseCode();
 String returnMessage = http.getResponseMessage();
 InputStream in = http.openInputStream();
                        
 returnContentType = http.getType();
            
 int cl = (int)http.getLength();
 if (cl > 0)
 {
    byte[] buf = new byte[cl];
    in.read(buf);
    returnContent = new String(buf);
 }
 else
 {
    StringBuffer sb = new StringBuffer();
    byte[] buf = new byte[1024];
    int n = 0;
                            
    while ((n = in.read(buf)) > 0)
    {
       sb.append(new String(buf,0,n));
    }
    returnContent = sb.toString();
 }
                        
 in.close();
 http.close();
Offline   Reply With Quote