try {
HttpClient httpclient = new DefaultHttpClient();
UsernamePasswordCredentials creds = new
UsernamePasswordCredentials("username", "password");
((AbstractHttpClient)
httpclient).getCredentialsProvider().setCredentials(new
AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),creds);
//give the Below request details u will get from soap Ui
String data = "<soapenv:Envelope "
+ " xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\""
+ "
xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">"+
("<soapenv:Body>"
+ " <urn:Zemptrack>"
+ "<Mno></Mno>"//Give parameter values here which u want to send u
want to send
+ " <Userid></Userid>"
+" <Year></Year>"
+ "</urn:Zemptrack> </soapenv:Body> </soapenv:Envelope>");
Log.e("Referral_Request"," xmlRequest" +data);
HttpPost post = new HttpPost("give the url address if u open the
WSDL link bottom u will find the Another link address use that one");
StringEntity se = new StringEntity(data,HTTP.UTF_8);
post.setHeader("Content-Type", "text/xml;charset=UTF-8");
post.addHeader("SOAPAction: ","");
post.setEntity(se);
BasicHttpResponse httpResponse =
(BasicHttpResponse)httpclient.execute(post);
httpResponse.getEntity();
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());
}
finally {
if (is != null) {
// is.close();
}
}
On Fri, Jul 13, 2012 at 5:56 PM, MERT TUNÇBİLEK <[email protected]>wrote:
> Hi everyone,
>
> I try to consume SAP web service by android with ksoap2 but ı did not
> achieve it, since this error,
>
> WARN/System.err(1229): org.xmlpull.v1.XmlPullParserException: expected:
> START_TAG
> {http://schemas.xmlsoap.org/soap/envelope/}Envelope(position:START_TAG <{
> http://schemas.xmlsoap.org/wsdl/}wsdl:definitionstargetNamespace='urn:sap-com:document:sap:soap:functions:mc-style'>@1:686
> in java.io.InputStreamReader@4052bc78)
>
> I investigated and almost 95% of people, that try to access SAP web
> service, have this error but there is not a succesfull answer.
> please help me.
> are there any other way to access SAP web service by android without
> KSOAP2.
>
> Thanks.
>
> Mert
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en