0

我尝试使用此代码将数据发送到 MsSql 使用 web 服务。当我尝试手动发送数据时,它工作得很好,但是当我尝试通过此代码发送时,它不起作用。返回值始终是正确的值,但不发送到 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());
    }
4

2 回答 2

2

我已经遇到了与 SOAP WS 相同的问题 .... 经纬度和任何双精度数据类型值...我必须更喜欢“MarshalFloat 类”
http://seesharpgears.blogspot.in/2010/11/implementing- ksoap-marshal-interface.html

最后......无需改变整个逻辑。但只需创建 MarshalFloat 的实例并用信封注册它,它在我的情况下完成..

MarshalFloat md = new MarshalFloat();

md.register(信封);

于 2012-06-13T12:29:40.723 回答
0

要发送double值,您应该实现 ksoap Marshal 接口。有关更多信息,请访问此处:实现 KSOAP Marshal 接口

于 2012-05-30T14:46:55.723 回答