help me, i'm on it about 5 hour working its not working..
everything unfortunately always it giving this response:
output: anyType{RequestResult=anyType{Success=false; Message=Object reference not set to an instance of an object.; }; }
my class is here:
public class WebServiceCallerImp implements WebServiceCaller{
static final String NAMESPACE="http://tempuri.org/";
static final String SERVICE_URL="http://93.94.199.145/IPhoneIPad/Service.asmx";
static String METHOD="GetForexStocksandIndexesInfo";
static String SOAP_ACTION = "http://tempuri.org/GetForexStocksandIndexesInfo";
@Override
public String GetForex(GetForexInput input) {
SoapObject request = new SoapObject(NAMESPACE,METHOD);
request.addProperty("IsIPAD", "false");
request.addProperty("DeviceID", "test");
request.addProperty("DeviceType", "ipad");
request.addProperty("RequestKey", "UmVxdWVzdElzVmFsaWQxNjowNToyMDEyIDExOjU0%%");
request.addProperty("Period", "Month");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(SERVICE_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";
}}
i checked metots and parameters from wsdl :
http: //93.94.199.145/IPhoneIPad/Service.asmx?WSDL
and its methot:
http: //93.94.199.145/IPhoneIPad/Service.asmx?op=GetForexStocksandIndexesInfo
where's my mistake?
Parameters are structure request{isipad, deviceid...} (see under SoapUI). So parameters do like this, and set implicitTypes to true to prevent type attributes:
SoapObject request = new SoapObject(NAMESPACE,METHOD);
SoapObject req_params = new SoapObject(NAMESPACE, "request");
req_params.addProperty("IsIPAD", "false");
req_params.addProperty("DeviceID", "test");
req_params.addProperty("DeviceType", "ipad");
req_params.addProperty("RequestKey", "UmVxdWVzdElzVmFsaWQxNjowNToyMDEyIDExOjU0%%");
req_params.addProperty("Period", "Month");
request.addSoapObject(req_params);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.implicitTypes = true;
envelope.setOutputSoapObject(request);
Dont ask me why it return "Request is not Valid". Same response is under SoapUI for parameters values You provided. I think about "DeviceId" parameter is invalid but really dont know this WS ;) hope it helps Marcin