views:

61

answers:

2

Hi all.

i m calling an webservice which is soap based in my android application. it is returning me the XML response. how can i parse it?? i checked the xml parsing its asking for the URL. i m confused which url i need to pass??

Here is the code:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("pStrType", type);

request.addProperty("pIntPageNo", PageNo)

request.addProperty("pIntPageSize", PageSize);

           //Log.v(LOG_TAG," value:="+name);

           //Log.v(LOG_TAG," value:="+pass);
           SoapSerializationEnvelope envelope = 
           new SoapSerializationEnvelope(SoapEnvelope.VER11);
           envelope.dotNet = true;
           envelope.setOutputSoapObject(request);
           AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
           try
           {
           androidHttpTransport.call(SOAP_ACTION, envelope);
           SoapObject resultstring = (SoapObject) envelope.bodyIn; 
           Log.v(LOG_TAG," value:="+resultstring);
           String Result=resultstring.toString();

What to do after dis?? m getting the string of response in (resultString)

pls pls help me its very urgent.

+1  A: 

If you know how to use SAX XML Parser, you can convert the String into a byte stream and pass it to your handler.

    String result=resultstring.toString();
    SAXParser saxP = SAXParserFactory.newInstance().newSAXParser();
    ResponseHandler respH = new ResponseHandler();//your implementation
    saxP.parse(new ByteArrayInputStream(result.getBytes()), respH);            

If you don't know SAX parser, i would advice you to learn that first. It is simple.

Hope that helps.

Ramp
Hi. thanks for the reply. Actually m using SOAP.
vivek_Android
pls help me in this case..
vivek_Android
HI ramp. can you pls tell me more.. m really having tough time using this.
vivek_Android
Hi, As Ramp has suggested.. you need to use the SAXparser to parse the XML. His sample provided will be placed just below yours and you can use it..
Vinay
Look at this example... http://bit.ly/d4smP8
Vinay
A: 

You need to get some sort of Code generator like WSClient++

Akash Kava