I would like to call .Net webservice from my Blackbrry application. How can I call webservice from my app and which protocol is user and which jar file i have to used to call webservice. and how to get responce from webservice in Blackberry?
Asked
Active
Viewed 699 times
0
-
possible duplicate http://stackoverflow.com/questions/1164744/how-to-call-a-net-web-service-from-blackberry-simulator – Vivart Mar 15 '11 at 11:30
-
Hello Bharath - I tried to use Java Wireless Toolkit, but it has some issues. All files generated by SJWT - They were just entity files and Web service connector was not present in it. – RedBottleSanitizer Apr 09 '13 at 19:48
1 Answers
0
you can use something like this (you probably need to setup correct request headers and cookies):
connection = (HttpConnection) Connector.open(url
+ ConnectionUtils.getConnectionString(), Connector.READ_WRITE);
connection.setRequestProperty("ajax","true");
connection.setRequestProperty("Cookie", "JSESSIONID=" + jsessionId);
inputStream = connection.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = inputStream.read(responseData))) {
rawResponse.append(new String(responseData, 0, length));
}
int responseCode = connection.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + responseCode);
}
responseString = rawResponse.toString();

Janci
- 863
- 1
- 9
- 24