gpt4 book ai didi

android - 如何从 Soap 对象获取对 android 中字符串的响应?

转载 作者:行者123 更新时间:2023-11-29 21:31:27 25 4
gpt4 key购买 nike

我使用以下代码从 .Net 网络服务 (asmx) 获取响应。

try{
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet =true;
AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
envelope.setOutputSoapObject(request);
httpTransport.debug=true;
httpTransport.call(SOAP_ACTION, envelope);
SoapObject result=(SoapObject)envelope.getResponse();
String Text = result.getProperty(1).toString();
System.out.println("Text : " + Text);
}
catch (Exception e) {
e.printStackTrace();
}

当我尝试这段代码时,我得到了以下输出。

anyType{NewDataSet=anyType{ResponseTable=anyType{Result=Success; }; }; }

在这里,我需要“Result=Success”。

请帮帮我。

最佳答案

尝试:

SoapObject result = (SoapObject)envelope.bodyIn;
String Result = result.getProperty(0).toString();

关于android - 如何从 Soap 对象获取对 android 中字符串的响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19381009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com