0

here is my code for getting data from server.

public class POSDataCloud {
private static String SOAP_ACTION1 = "http://tempuri.org/GetDescription";    
private static String NAMESPACE = "http://tempuri.org/"; 
private static String METHOD_NAME1 = "GetDescription";     
private static String URL = "http://182.160.99.115:2080/webservice1.asmx?WSDL";

public String GetPOSData(int POSID)
{
    String ret="";
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);    
    //request.addProperty("Id",POSID);
    PropertyInfo property = new PropertyInfo();
    {
        property.name = "Id";
        property.setNamespace(NAMESPACE);
        property.type = PropertyInfo.STRING_CLASS;
        property.setValue("3"); 
    }
    request.addProperty(property);

    //Declare the version of the SOAP request   
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);           
    envelope.setOutputSoapObject(request);
    envelope.implicitTypes=true;
    envelope.dotNet = true;
    try
    {
          HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);                   
          //this is the actual part that will call the webservice
          androidHttpTransport.call(SOAP_ACTION1, envelope);          
          // Get the SoapResult from the envelope body.
          SoapObject result = (SoapObject)envelope.bodyIn;
          if(result != null)
          {
              ret=result.getProperty(0).toString();
          }
          else
          {
              ret="no response";
          }
    } 
    catch (Exception ex)
    {
      ex.printStackTrace();
      ret=ex.getMessage();
    }
    return ret;


}

}

But I want to do it using asyncTaskLoader.How to do it? Edit:Actually property.setValue is the PosId.how to pass posId in loadInBackground in asynctaskloader?I only need the implementation of loadInBackground method.i think it shold have posId parameter.But i can't get any example of asynctaskloader which takes parameter in loadInBackground method.Anybody helps me is greatly appreciated.

decoder
  • 886
  • 22
  • 46

0 Answers0