Web service gets null parameters from application using ksoap method

I saw topics discussing this, but no one seemed to post a solution. I am currently testing transfer parameters for my .Net web service. When the parameters reach the web service, he adds it with an extra line, and then returns it to my application too; but all I return is a string message, not the parameter I passed. Is there something wrong with my web service or my soap method?

Soap:

SoapObject request = new SoapObject (NAMESPACE, METHOD_NAME);

    request.addProperty("A", "workowr");


    SoapSerializationEnvelope envelope =
        new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);    
        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
            //SoapObject result = (SoapObject)envelope.getResponse();       
            String resultData = result.toString();
            testTV.setText(resultData);

        }
        catch(Exception e)
        {
            testTV.setText(e.getMessage());
        }

Here is my simple .Net web service:

Public function getRegInfo (ByVal A As String) As String

Return A + String Message

Final function

I would appreciate any help.

+3
5

, URL- .NET webservice, .

, :

" http://www.example.com/webservices/"

i :

"example.com/webservices/"

.

.

+5

. , (:) webservice KSoap. , - , -, .

+1

"/" .

, , , - WebService ksoap2.

"/" . "http://" .

+1

,   ,

       SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    envelope.dotNet = true;
    PropertyInfo pi = new PropertyInfo();
    pi.setName("ProcName");
    pi.setValue(a);
    pi.setType(int.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("UserName");
    pi.setValue(b);
    pi.setType(String.class);
    request.addProperty(pi);

    pi=new PropertyInfo();
    pi.setName("Password");
    pi.setValue(c);
    pi.setType(String.class);
    request.addProperty(pi);

    pi=new PropertyInfo();
    pi.setName("Paras");
    pi.setValue(d);
    pi.setType(String.class);
    request.addProperty(pi);


    Object response = null;

    HttpTransportSE androidHttpTransport = new HttpTransportSE(SOAP_ADDRESS);

    try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        response = envelope.getResponse();
    } catch (final Exception e) {
        String error = "no";
    }
    return response.toString();
}
+1

, XML WSDL.

, http:// ( " " ) ( WSDL http://) - (, )

However, I have another application that accesses an external .NET web service. (central bank web service to get the exchange rate) WSDL NameSpace and SoapAction Contains http: // My application worked fine without deleting http: //

0
source

Source: https://habr.com/ru/post/1750141/


All Articles