将字符串XML转换为soap序列化信封,并将其解析为Soap Object以进行对象映射

时间:2019-05-31 06:24:02

标签: java android xml soap

我正在使用kSoap库进行序列化和反序列化。我的回答是XML,并将其转换为字符串。然后将其解析为“ CustomSoapSerializationEnvelope”,但是当我将其解析为Soap Object进行对象映射时,它给了我空值。 代码在这里

     public SoapObject createSoapObjectFromSoapObjectString(String soapObjectString) {

    CustomSoapSerializationEnvelope env = new CustomSoapSerializationEnvelope(SoapEnvelope.VER12);
    env.dotNet = true;

    env.setOutputSoapObject(soapObjectString);

    SoapObject so = null;
    try {
        so = ( SoapObject) env.getResponse();
    } catch (Exception e){
        e.printStackTrace();
    }

    Log.d(TAG,"asdasd");
    return so;
}

so(肥皂对象)为null。但是Env有我的回应。响应在bodyOut中,我也尝试这样做

    so = ( SoapObject) env.bodyOut;

但还是同样的问题。

0 个答案:

没有答案