Search code examples
androidweb-servicessoapksoap2

How can Add username and password as URL parameter in Android SOAP webservices program with SAP SOAP WSDL?


I added the Username and password as URL parameter the fallowing URL:

private static final String URL ="http://*********:****/sap/bc/srt/wsdl/srvc_14DAE9C8D79F1EE193CF0AB8FEE64345/wsdl11/allino‌​ne/ws_policy/document?sap-client=*****&UserName=*******&password=******";

I got the following Exception:

:02-24 12:37:44.159: WARN/System.err(530): java.net.SocketTimeoutException 02-24 12:37:44.159: WARN/System.err(530): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:130


Solution

  • Please try the same URL in the desktop browser and check that the server is accessible and the URL is correct.

    try The following code:

    HttpGet request = new HttpGet(...);
    request.setHeader("Authorization", "Basic "+Base64.encodeBytes("login:password".getBytes()));
    

    Assuming you are using HttpClient. Following is a example of HttpClient