gpt4 book ai didi

Android:关于ksoap2和webservice

转载 作者:行者123 更新时间:2023-11-30 04:32:40 24 4
gpt4 key购买 nike

我得到了 wsdl 和 URL,服务器是用 C++ 编写的;我在 android 中使用 KSoap2 来访问该方法,但它总是打印出来:“方法‘methodname’未实现”!!!谁能帮我吗?提前致谢!

最佳答案

您是否正确创建了请求和 SoapAction

试试下面的例子(它是一个带有 0 个参数的公共(public)网络服务),看看它是否适合你。

private static final String WSDL_URL = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL";
private static final String WS_NAMESPACE = "http://ws.cdyne.com/WeatherWS/";
private static final String WS_METHOD_NAME = "GetWeatherInformation";

// 1. Creating SOAP request with no arguments
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(new SoapObject(WS_NAMESPACE, WS_METHOD_NAME));

// 2. Create a HTTP Transport object to send the web service request
HttpTransportSE httpTransport = new HttpTransportSE(WSDL_URL);
httpTransport.debug = true; // allows capture of raw request/respose in Logcat

// 3. Make the web service invocation
httpTransport.call(WS_NAMESPACE + WS_METHOD_NAME, envelope);

Log.d(TAG, "HTTP REQUEST:\n" + httpTransport.requestDump);
Log.d(TAG, "HTTP RESPONSE:\n" + httpTransport.responseDump);

看看这个解释 using kSOAP2 with Android 基础知识的详细教程

关于Android:关于ksoap2和webservice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7426135/

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