1

我是 android 新手。我有一个 xml,它显示了要通过 SOAP 在服务器上发送的详细信息,所以请告诉我如何在 KSOAP 请求中转换以下 xml。谢谢

<location>
<locationId>132</locationId>
<name>test</name>
<qualifiedCoordinates>
<altitude>10</altitude>
</qualifiedCoordinates>
</location>
4

1 回答 1

0
SoapObject request = new SoapObject(NAMESPACE, METHOD);
    request.addProperty("locationId", 132);
    request.addProperty("name", test);
    request.addProperty("altitude", 10);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapObject result = (SoapObject) envelope.getResponse();}
catch(Exception e) {
        tempText.setText("Error");
        e.printStackTrace();
    }
于 2012-06-15T11:25:07.027 回答