It finally worked, my biggest issue was the url i was passing to HttpPost and ksoap2 with SAP did not work for me at all.
private void testCallingService() {
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(
new AuthScope("ip here", port here),
new UsernamePasswordCredentials(username, password));
try {
String buffer = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='namespace'><soapenv:Header/><soapenv:Body><urn:methodname><USERNAME>test</USERNAME></urn:methodname></soapenv:Body></soapenv:Envelope>";
HttpPost httppost = new HttpPost(url);
StringEntity se = new StringEntity(buffer, HTTP.UTF_8);
se.setContentType("text/xml");
httppost.setHeader("Content-Type",
"application/soap+xml;charset=UTF-8");
httppost.setEntity(se);
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope("ip", port),
new UsernamePasswordCredentials(username, password));
httpclient.setCredentialsProvider(credsProvider);
BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient
.execute(httppost);
if (httpResponse.getStatusLine() != null) {
System.out.println("Http status: "
+ httpResponse.getStatusLine());
}
RequestLine requestLine = httppost.getRequestLine();
String response = getResponseBody(httpResponse); // read server response. response.getEntity().getContent();...
System.out.println("response: " + response);
} catch (IOException e) {
// TODO Auto-generated catch block
}
httpclient.getConnectionManager().shutdown();
}
So, I constructed myself the SOAP envelope, will try to stop doing that in the nearest future. Made an instance of CredentialsProvider and set my user/pass details. The status from server is 200 and i receive information that i need. One problem remains that the response is apparently too large(and it's not going to stop here) so my response is truncated. Working to solve that now.
I really hope this helps someone.