I would like to parse a soap envelope using KSOAP2 how can Istart I
am new and I tried the following code but i couldnot. Also I would
like to display the parsed elements on the screen?Thanks
package parsingsteps;
import java.io.*;
import org.ksoap2.SoapEnvelope;
import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParserException;
/**
*
* @author fa00064
*/
public class ParsingSteps {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try{
// String msg="<hello>World!</hello>";
String msg = "<SOAP-ENV:Envelope " + "xmlns:SOAP-ENV=\"http://
www.w3.org/2001/12/soap- envelope\" " + "xmlns:xsi=\"http://www.w3.org/
2001/XMLSchema-instance\" " +"xmlns:xsd=\"http://www.w3.org/2001/
XMLSchema\"& gt;" +
"<SOAP-ENV:Body>" +
"<result>" +
"<message xsi:type=\"xsd:string\">Hello World</message>" +
"</result>" +
"</SOAP-ENV:Body>" +
"</SOAP-ENV:Envelope>";
// byte[] in= msg.getBytes();
KXmlParser parser=new KXmlParser();
parser.setInput(new StringReader(msg));
SoapEnvelope soapenvelope= new SoapEnvelope
(SoapEnvelope.VER12);
//soapenvelope.parse(parser);
soapenvelope.parseBody(parser);
}
catch (IOException e) {
System.out.println("Error reading URI: " + e.getMessage
());
} catch (XmlPullParserException e) {
System.out.println("Error in parsing: " + e.getMessage
());
}
// String result=parser.getName();
//System.out.println(result);
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---