if you mean using webservice to send request and receive a response.
then you could you use this code, you could you DOM or SAX parser to parse
the respone but to send a request.

import java.util.List;
import org.apache.commons.lang.StringEscapeUtils;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.util.Log;
import android.util.Xml;

public class DataFetcher {
  private static final String NAMESPACE ="";
    private static String URL =
     "";
    private static final String METHOD_NAME = "";
    private static final String SOAP_ACTION =        "";
    private HttpTransportSE androidHttpTransport;
    private final SoapSerializationEnvelope envelope;

 public DataFetcher(int id)
 {
 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

   PropertyInfo propInfo = new PropertyInfo();
           propInfo.name = "Channel";
           propInfo.type = PropertyInfo.INTEGER_CLASS;
           request.addProperty(propInfo, id);

          /* PropertyInfo propInfo3 = new PropertyInfo();
           propInfo3.name = "limit";
           propInfo3.type = PropertyInfo.INTEGER_CLASS;
           request.addProperty(propInfo3, 2);*/

           PropertyInfo propInfo2 = new PropertyInfo();
           propInfo2.name = "Key";
           propInfo2.type = PropertyInfo.STRING_CLASS;
           request.addProperty(propInfo2, "2724466");

 envelope =
                new SoapSerializationEnvelope(SoapEnvelope.VER10);
         envelope.dotNet = true;

            envelope.encodingStyle = SoapSerializationEnvelope.XSD;
            envelope.setOutputSoapObject(request);

         androidHttpTransport =
                new HttpTransportSE(URL);
         androidHttpTransport.debug=true;

         Fetchdata();

 }

  public List<Channel> Fetchdata()
    {
  DataParser chanParser = new DataParser (); // SAX Parser - developed by me
        try
        {

              androidHttpTransport.call(SOAP_ACTION, envelope);
               String xml= androidHttpTransport.responseDump.toString();
               String strUnEscapeHTML = StringEscapeUtils.unescapeHtml(xml);
               Xml.parse(strUnEscapeHTML, chanParser);
        }
        catch(Exception e)
        {
            Log.e("SAX-Parser", "Exception = >" + e.toString());
        }
        return chanParser.getChannels();
    }

}



2013/5/22 Ibrahim Sada <[email protected]>

> Hi Friends..
>   how to sends and receive xml file from android to server and vise versa
> Thanks in Advance..
>
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to