-1

This is my web service code.I don't know how to parse soap response.what should i do? i don't even know it is json or Xml.So please tell me which type of response it is? my response like this

anyType{Product_Details=anyType{P_id=129;p_name=ffff;C_name=gggg;};}

public  class MyAsyncTask extends AsyncTask<String, String , String>
{

    @Override
    protected void onPostExecute(String arrPersons )
    {
        uid.setText(arrPersons);            
    }

    @Override
      protected void onProgressUpdate(String... text) 
    {

     uid.setText(text[0]);

    }

    @Override
    protected String doInBackground(String... arg0) 
    {

        SOAP_ADDRESS="";

        request=new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME);
        publishProgress("Loading contents...");
        PropertyInfo pi=new PropertyInfo();
        pi.setName("PID");
        pi.setValue(Integer.parseInt(arg0[1]));
        pi.setType(String.class);
        request.addProperty(pi);
        pi=new PropertyInfo();

        envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.dotNet=true;
        envelope.setOutputSoapObject(request);

        httpTransport=new HttpTransportSE(SOAP_ADDRESS);
        try 
        {
            httpTransport.call(SOAP_ACTION, envelope);

            SoapObject response = (SoapObject)envelope.getResponse();


            for (int i = 0; i < response.getPropertyCount(); i++) 
            {
                Object property = response.getProperty(i);
                if (property instanceof SoapObject)
                {
                    SoapObject category_list = (SoapObject) property;
                  String  returnString1 = category_list.getProperty(0).toString();

                }
            }

         } 
        catch (Exception e) 
        {

            returnString1 = e.getMessage();
        }
        return  returnString1;

    }

}
Rajesh Singh
  • 11
  • 1
  • 5

2 Answers2

0

The format might in data table return format. you better show your web services code which you created on asp.net

0

This is my asp code for Web service

public class qr : System.Web.Services.WebService {

[WebMethod]
public DataTable findData(String PID)
{
    String constr = ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString;
    using (SqlConnection con = new SqlConnection(constr))
    {
        using (SqlCommand cmd = new SqlCommand("SELECT * FROM Product_Details WHERE P_id = @P_id"))
        {
            cmd.Parameters.AddWithValue("@P_id", PID);
            cmd.Connection = con;
            con.Open();
            cmd.ExecuteNonQuery();
            using (SqlDataAdapter sda = new SqlDataAdapter())
            {
                sda.SelectCommand = cmd;
                using (DataTable dt = new DataTable())
                {
                    dt.TableName = "Product_Details";
                    sda.Fill(dt);
                    return dt;
                }
            }
        }
    }
}
Rajesh Singh
  • 11
  • 1
  • 5