Search code examples
androidsql-serverweb-servicesksoap2

Ksoap2 Sent Data doesn't work "request.addProperty("Lat", "21233232");" doesnt work


I try this code for sent data to MsSql using webservice. when I try to Sent data Manuely its working wery well but when I try to sent by this code is not working. Return value is always correct value but dont send to mydatabase

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

        PropertyInfo pi = new PropertyInfo();
        pi.setName("DeviceId");
        pi.setValue("mumin burak");
        pi.setType(String.class);
        pi.setNamespace(NAMESPACE);
        request.addProperty(pi);


    request.addProperty("Lat", "21233232");

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

    AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);

    SoapPrimitive result = null;
    try {
        httpTransport.call(SOAP_ACTION, envelope);
        result = (SoapPrimitive) envelope.getResponse();
        twMsg.setText(result.toString());
    } catch (IOException e) {
        // TODO Auto-generated catch block
        twMsg.setText(e.getMessage());
    } catch (XmlPullParserException e) {
        // TODO Auto-generated catch block
        twMsg.setText(e.getMessage());
    }

Solution

  • To sending double values, you should implement ksoap Marshal interface. For more information visit here: Implementing KSOAP Marshal Interface