0
我想從我的Blackbrry應用程序中調用.Net webservice。我如何從我的應用程序調用webservice,哪個協議是用戶,以及我必須使用哪個jar文件來調用webservice。以及如何從Blackberry的web服務中獲得迴應?如何在Blackberry中調用.Net webservice?
我想從我的Blackbrry應用程序中調用.Net webservice。我如何從我的應用程序調用webservice,哪個協議是用戶,以及我必須使用哪個jar文件來調用webservice。以及如何從Blackberry的web服務中獲得迴應?如何在Blackberry中調用.Net webservice?
你可以使用這樣的事情(你可能需要設置正確的請求頭和cookie):
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();
可能重複http://stackoverflow.com/questions/1164744/how-to-call-a -network-web-service-from-blackberry-simulator – Vivart 2011-03-15 11:30:53
Hello Bharath - 我嘗試使用Java Wireless Toolkit,但它有一些問題。 SJWT生成的所有文件 - 它們只是實體文件,Web服務連接器不在其中。 – 2013-04-09 19:48:18