我正在開發一個帶有soap服務的android應用程序。但是,當我添加請求屬性時它不起作用。我錯過了什麼嗎?對象referans沒有設置ksoap2
public class WebServiceCallerImp {
private static final String METHOD_NAME = "GetForexStocksandIndexesInfo";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String SOAP_ACTION = "http://tempuri.org/GetForexStocksandIndexesInfo";
private static final String URL = "http://mobileexam.veripark.com/mobileforeks/service.asmx";
public static String GetForex() {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("IsIPAD", "true");
request.addProperty("DeviceID", "test");
request.addProperty("DeviceType", "ipad");
request.addProperty("RequestKey", "%%UmVxdWVzdElzVmFsaWQyNzowNDoyMDE3IDEzOjEy%%");
request.addProperty("Period", "Month");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject) envelope.getResponse();
System.out.println("output: " + response.toString());
return response.toString();
} catch (Exception e) {
System.out.println("@@@@: " + e.toString());
}
return "null";
}
響應
Object reference not set to an instance of an object. at Denizbank.IpadApplication.Integration.ForexIntegration.StocksandIndexes.GetForexStocksandIndexesInfo(StocksandIndexesRequest req)
在Denizbank.IpadApplication.Service.Service.GetForexStocksandIndexesInfo(StocksandIndexesRequest請求)
SOAP請求
我在哪裏犯錯?請幫幫我。
我想問題與 刪除那一個。因爲你沒有啓動該標記,只把完成標記部分。 –
thanx安迪,但沒有工作 –
看到我的答案它適用於我。我做這件事,它適用於我。 –