'at org.ksoap2.transport.HttpTransportSE.call (HttpTransportSE. java: 68)' - PullRequest
0 голосов
/ 21 марта 2020

У меня есть пара веб-сервисов navision, которые я пытаюсь использовать их SOAP URL, используя библиотеку K SOAP с моим android приложением. Даже после нескольких уроков в YouTube и здесь, в StackOverflow, я не могу получить ответ от веб-служб

, помогите

package com.armydev.payme.soap;

import androidx.appcompat.app.AppCompatActivity;

import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;

import com.mysoapsample.payme.R;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

public class WebServiceActivity extends AppCompatActivity {
    final static String METHOD_NAME = "Read";
    final static String SOAP_ACTION = "urn:microsoft-dynamics-schemas/page/appitemlist:Read";
    final static String URL = "http://localhost:7047/DynamicsNAV100/WS/company name/Page/AppItemList";
    final static String NAME_SPACE = "urn:microsoft-dynamics-schemas/page/appitemlist";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_service);

        new SoapClass().execute();
    }

    public static class SoapClass extends AsyncTask<Void, Void, Void> {

        @Override
        protected Void doInBackground(Void... voids) {
            SoapObject soapObject = new SoapObject(NAME_SPACE, METHOD_NAME);
            //soap method param and value
            PropertyInfo params = new PropertyInfo();
            params.setName("No");
            params.setNamespace(NAME_SPACE);
            params.setType(PropertyInfo.STRING_CLASS);
            params.setValue(100);

            soapObject.addProperty(params);

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.dotNet = true;
            envelope.setOutputSoapObject(soapObject);

            HttpTransportSE transport = new HttpTransportSE(URL);

            try {
                transport.debug = true;

                transport.call(SOAP_ACTION, envelope);
                SoapObject soapResponse = (SoapObject) envelope.getResponse();

                Log.d("SOAP response", soapResponse.toString());

            } catch (Exception e) {
                e.printStackTrace();
            }

            return null;
        }
    }
}

Я получаю эту ошибку в своих журналах

2020-03-21 19:08:51.383 10098-10139/com.armydev.payme W/System.err:     at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:46)
2020-03-21 19:08:51.383 10098-10139/com.armydev.payme W/System.err:     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:68)
2020-03-21 19:08:51.383 10098-10139/com.armydev.payme W/System.err:     at com.armydev.payme.soap.WebServiceActivity$SoapClass.doInBackground(WebServiceActivity.java:59)
2020-03-21 19:08:51.383 10098-10139/com.armydev.payme W/System.err:     at com.armydev.payme.soap.WebServiceActivity$SoapClass.doInBackground(WebServiceActivity.java:36)

это строка, которая выдает ошибку

transport.call(SOAP_ACTION, envelope);
...