gpt4 book ai didi

android - XmlPullParser 异常

转载 作者:行者123 更新时间:2023-11-30 04:43:49 27 4
gpt4 key购买 nike

我无法解决这个错误:

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://www.w3.org/2001/12/soap-envelope}Envelope (position:START_TAG @1:6 in java.io.InputStreamReader@43e524c8)

我有一个访问 .NET 网络服务的 Android 应用程序。它传递一个 int 并接收一个 int 作为响应。我正在使用 ksoap2。我还向 list 文件添加了权限,而且我还包含了所有 jar 文件。但是,我卡住了,无法查看我发送的是哪个 SOAP 请求。

我的代码是:

public class FirstAppUI extends Activity{

private static final String NAMESPACE = "http://tempuri.org/";

private static final String URL =
"http://nautilussoft.biz.whbus12.onlyfordemo.com/staging/litigation/demowebservice.asmx";

private static final String SOAP_ACTION ="http://tempuri.org/GetNumber";

private static final String METHOD_NAME = "GetNumber";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv= (TextView)findViewById(R.id.TextView01);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("maxbelow", "123");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.dotNet= true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
//Toast.makeText(getBaseContext(), "received object", Toast.LENGTH_SHORT).show();
androidHttpTransport.call(SOAP_ACTION, envelope);

Object resultsRequestSOAP = (SoapObject)envelope.getResponse();
//SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
//Toast.makeText(getBaseContext(), "received object", Toast.LENGTH_SHORT).show();
tv.setText("Received :" + resultsRequestSOAP.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
Log.e("APP", "MalformedURLException while sending\n" + e.getMessage());
tv.setText("Malformedexception"+e);
}
catch(Exception e1)
{
e1.printStackTrace();
tv.setText("exception"+e1);

}

}

}

提前致谢。

最佳答案

在 IIS 中或通过 IIS 管理器授予对 Web 服务文件夹的权限。

关于android - XmlPullParser 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5471469/

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