Skip to Content
0
Jan 11, 2018 at 11:46 AM

Consuming SAP business by design SOAP webservice from android app

390 Views

Hello,

I am SAP Business by design developer, i created a custom BO holding users and passwords. then i created a webservice based on this custom BO. it is working fine when testing from SOAP UI but when consuming from my Android app the following error appears "soap-env:client" " web service processing error"

when i check the tenant only find this vague message "System error during SOAP processing" Please help this is very urgent matter.

wsdl file :https://www.dropbox.com/s/s7asr7p9hfy5a14/UsersWebService.wsdl?dl=0

find below my android code

private static final String MAIN_REQUEST_URL = "https://my338967.sapbydesign.com/sap/bc/srt/scs/sap/yyih6dcgyy_manageusersin?sap-vhost=my338967.sapbydesign.com";
static String NAMESPACE = "http://0014476683-one-off.sap.com/YIH6DCGYY_";
static String SOAP_ACTION = "http://0014476683-one-off.sap.com/YIH6DCGYY_/YIH6DCGYY_ManageUsersIn/ReadRequest";

static SoapSerializationEnvelope getSoapSerializationEnvelope(SoapObject request) {
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.implicitTypes = true;
    envelope.setAddAdornments(false);
    envelope.setOutputSoapObject(request);


    //envelope.headerOut = new Element[1];
    //envelope.headerOut[0] = buildAuthHeader();

    return envelope;
}

static HttpTransportSE getHttpTransportSE() {
    HttpTransportSE ht = new HttpTransportSE(Proxy.NO_PROXY,MAIN_REQUEST_URL,60000);
    //HttpTransportSE ht = new HttpTransportSE(MAIN_REQUEST_URL);
    //ht.debug = true;
    //ht.setXmlVersionTag("<!--?xml version=\"1.0\" encoding= \"UTF-8\" ?-->");
    return ht;
}

   static String getUser(String fValue) {
    String data = null;
    String methodname = "Read";

    SoapObject request = new SoapObject(NAMESPACE, methodname);
    request.addProperty("userName", fValue);

    SoapSerializationEnvelope envelope = getSoapSerializationEnvelope(request);


    HttpTransportSE  ht = getHttpTransportSE();
    try {
        List<HeaderProperty> headerList = new ArrayList<>();
        headerList.add(new HeaderProperty("Authorization", "Basic " + org.kobjects.base64.Base64.encode("xhitham:********".getBytes())));
        ht.call(SOAP_ACTION, envelope,headerList);
        SoapObject resultsString = (SoapObject)envelope.getResponse();
        data = resultsString.toString();

    } catch (SocketTimeoutException t) {
        t.printStackTrace();
    } catch (IOException i) {
        i.printStackTrace();
    } catch (Exception q) {
        q.printStackTrace();
    }
    return data;
}