檢查這個網址http://www.codeproject.com/KB/android/webservice-from-android.aspx
NAMESPACE = "your web service package get this in wsdl";
URL = "wsdl path";
SOAP_ACTION = nameof;//portType name="" in wsdl;
METHOD_NAME_Rate = "web service methodname";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_Rate);
request.addProperty("webservice method parameter1", agr1);
request.addProperty("webservice method parameter1", arg2);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL, 10000);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
r = resultsRequestSOAP.getProperty("return").toString();
} catch (XmlPullParserException e) {
} catch (SocketTimeoutException e) {
} catch (IOException e) {
} finally {
}
http://code.google.com/p/wsdl2ksoap/ – aNi
我無法理解如何使用它,它似乎失敗了......任何其他想法? – user1052460