androidweb-servicessoapksoap2sap-basis

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


I added the user name and password as URL parameter the following 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

I run in the desktop Browser. It's asking Username and password. Whenever I entered Credentials it shows the WSDL file. How can I give user name and password through program in android?


Solution

  • Another way of doing it.. write some Java Code :)

    javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider)port;
    Map<String,Object> context = bp.getRequestContext();
    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://new.endpoint.example");
    context.put(BindingProvider.USERNAME_PROPERTY,"userName");
    context.put(BindingProvider.PASSWORD_PROPERTY,"pass");
    

    More details on this over here