thanks for your reply
  i have to connect to the sap server and fetch the data using soap
webservice....i hav e to authenticate to the server and fetch the response
from it...



*public* *void* onCreate(Bundle savedInstanceState) {

*super*.onCreate(savedInstanceState);

setContentView(R.layout.*main*);

 *try* {

DefaultHttpClient httpclient = *new* DefaultHttpClient();

 UsernamePasswordCredentials creds = *new* UsernamePasswordCredentials(
"arun", "kumar");

 ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials(*
new* AuthScope("76.10.226.133", 8000), creds);

String postURL =
http://76.10.226.133:8000/sap/bc/srt/rfc/sap/zemptrack_overview/800/zemptrack_overview/zemptrack_overview
;

//String postURL = "
http://76.10.226.133:8000/sap/bc/srt/wsdl/bndg_E0D85C5AAE9ADFF19D0400221969C2CB/wsdl11/allinone/ws_policy/document?sap-client=800
";

HttpPost post = *new* HttpPost(postURL);

 List<NameValuePair> params = *new* ArrayList<NameValuePair>();

UrlEncodedFormEntity ent = *new* UrlEncodedFormEntity(params,HTTP.*UTF_8*);

//post.setHeader("Content-Type", "text/xml;charset=UTF-8");

//post.addHeader("SOAPAction: ","");

//post.addHeader("Authorization:","Basic c3Jpbml2YXN1czppbml0aWFsMQ==");

 post.setEntity(ent);

BasicHttpResponse httpResponse =
(BasicHttpResponse)httpclient.execute(post);

httpResponse.getEntity();

 Log.*e*("httpResponse","Referral_Request" +httpResponse);

Log.*e*("HTTPStatus","Referral_Request Response"
+httpResponse.getStatusLine().toString());

String *Status* = httpResponse.getStatusLine().toString();

  InputStream is = httpResponse.getEntity().getContent();

String line = "";

StringBuilder sb = *new* StringBuilder();

BufferedReader rd = *new* BufferedReader(*new* InputStreamReader(is));

*while* ((line = rd.readLine()) != *null*) {

sb.append(line);

}

 Log.*i*("Response:","Referral_Request Response data is:"+sb.toString());

  } *catch* (Exception e) {

Log.*e*(getClass().getSimpleName(), e.toString());

}

  }

  10-04 20:04:12.159: DEBUG/dalvikvm(32): GC_EXPLICIT freed 57 objects /
2520 bytes in 86ms
10-04 20:04:12.419: DEBUG/dalvikvm(32): GC_EXPLICIT freed 2 objects / 64
bytes in 244ms
10-04 20:04:12.579: INFO/tag(1623): msg
10-04 20:04:14.389: ERROR/httpResponse(1623):
Referral_Requestorg.apache.http.message.BasicHttpResponse@44ed0058
10-04 20:04:14.389: ERROR/HTTPStatus(1623): Referral_Request
ResponseHTTP/1.1 200 OK
10-04 20:04:14.399: INFO/global(1623): Default buffer size used in
BufferedReader constructor. It would be better to be explicit if an 8k-char
buffer is required.
10-04 20:04:16.389: DEBUG/SntpClient(59): request time failed:
java.net.SocketException: Address family not supported by protocol
10-04 20:09:16.411: DEBUG/SntpClient(59): request time failed:
java.net.SocketException: Address family not supported by protocol

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to