简体   繁体   中英

Calling to a SAP web service from android

I need to call to a SAP web service using android to get material no using material document no. I am using ksoap2 library. Problem is I don't what exactly the NAMESPACE, SOAP_ACTION mean. I cannot get any response.

METHOD_NAME = "ZSL_GET_MAT_DOC";

URL = " http://SL_S :****@AP.vv.lk:8000/sap/bc/srt/rfc/sap/zsl_get_mat_doc/110/zsl_get_mat_doc/zl_web_svr4";

This is my method.

class RetrieveFeedTask extends AsyncTask<String, Void, String> {
        @Override
        protected String doInBackground(String... strings) {

            // Create SOAP request
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            request.addProperty("Materialdocument", "0407000147");

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.setOutputSoapObject(request);
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            try {
                androidHttpTransport.call(SOAP_ACTION, envelope);

                // Get response from envelope
                Object result = envelope.getResponse();

                // Display result
                Toast.makeText(getContext(), result.toString(), Toast.LENGTH_LONG).show();

            } catch (IOException e) {
                e.printStackTrace();
            } catch (XmlPullParserException e) {
                e.printStackTrace();
            }

            return null;
        }
    }

De Namespace is the namespace of your SOAP WSDL. Most likely this will be

urn:sap-com:document:sap:rfc:functions .

The Action is also mentioned in the WSDL. When using a SAP RFC this will be " name of the RFC Request". So this will most likely be ZSL_GET_MAT_DOCRequest .

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM