Maybe you should read some KSoap2 usage examples first ? You are asking quite basic questions which probably means that you didn't find any tutorial or documentation...
There are many ways to use KSoap2. You may find one here: http://code.google.com/p/sugadroid/ (and Android project that calls SugarCRM SOAP Web Services) KSoap2 usage examples in those classes: http://code.google.com/p/sugadroid/source/browse/trunk/code/src/com/excilys/sugadroid/services/impl/ksoap2/ServiceClientKsoap2Impl.java http://code.google.com/p/sugadroid/source/browse/trunk/code/src/com/excilys/sugadroid/services/impl/ksoap2/LoginServicesKsoap2Impl.java On Jul 3, 9:55 pm, feda al-shahwan <fa.alshah...@gmail.com> wrote: > How if I want to parse soap request for adding two integers. And the value > of the integers are provided by the client. > > On Tue, Jun 23, 2009 at 7:25 AM, sagar.indianic > <sagar.india...@gmail.com>wrote: > > > > > > > You dont need to parse manually... > > First get the "ksoap2-j2se-full-2.1.2.jar".. Search you will get it.. > > > then use the following code.. > > > private static String SOAP_ACTION = "namespace/FunName"; > > private static String METHOD_NAME = "method_name"; > > private static final String NAMESPACE = "namespace"; > > private static final String URL = "Url of web service"; > > > SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); > > request.addProperty("field of web service", variable); > > > SoapSerializationEnvelope envelope = new > > SoapSerializationEnvelope(SoapEnvelope.VER11); > > envelope.setOutputSoapObject(request); // same as > > envelope.bodyOut = request; > > > HttpTransportSE httpTransport = new HttpTransportSE(URL); > > httpTransport.call(SOAP_ACTION, envelope); //This sends a soap > > request and response will be in envelope only. > > > Now check for envelope.bodyIn will give you response from webservice. > > This will give you SoapObject. Retrieve response strings from the > > SoapObject method. > > > On Jun 22, 10:17 am, Desu Vinod Kumar <vinny.s...@gmail.com> wrote: > > > Hi everyone > > > > i am looking for soap web services in android. my hand also will help to > > u > > > > actually i need to connect the PHP soap web services in android > > > > i need to get the response from the PHP server and should return it in > > xml > > > format. > > > > can any body give me suggestions regarding this > > > > i have tried some small code but it is unexpectedly quiting > > > > if any android runtime errors in log cat is any problem > > > > how can i clear that android runtime errors in log cat what i am getting > > ... > > > > Here is my code > > > > protected void onCreate(Bundle icicle) > > > { > > > > super.onCreate(icicle); > > > > // SOAP Request for the FindServiceSOAP.GetRatingInfo web service > > > String soapRequestXML = "<?xml version=\"1.0\" > > encoding=\"utf-8\"?>\n" + > > > "<soap:Envelope xmlns:soap=\" > >http://schemas.xmlsoap.org/soap/envelope/\" " + > > > " xmlns:xsi=\" > >http://www.w3.org/2001/XMLSchema-instance\" " + > > > " xmlns:xsd=\" > >http://www.w3.org/2001/XMLSchema\">\n" + > > > " <getRating xmlns=\"http://tempuri.org > > \">\n" > > > + > > > " </getRating>\n" + > > > " </soap:Body>\n" + > > > "</soap:Envelope>"; > > > > String url = "http://www.hasdhs.com/ask.php"; > > > HttpClient client = new HttpClient(); > > > > PostMethod postMethod = new PostMethod(url); > > > > // Construct a SOAP request by hand > > > StringBuffer request = new StringBuffer(); > > > request.append(soapRequestXML); > > > > postMethod.setRequestBody(request.toString()); > > > postMethod.setRequestHeader("Content-Type","text/xml; > > charset=utf-8"); > > > postMethod.setRequestHeader("SOAPAction", > > > "\"http://tempuri.org\""); > > > > int statusCode = 0; > > > try { > > > statusCode = client.executeMethod(postMethod); > > > } catch (IOException e) { > > > Log.d("ReverseGeoCoder", e.toString(), e); > > > } > > > > // Parse the SOAP Response > > > MyContentHandler myContentHandler = new MyContentHandler(); > > > try { > > > SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); > > > > } catch (Exception e) { > > > Log.d("ISizzle", e.toString(), e); > > > } > > > > // Display the response details. > > > List list = myContentHandler.getRating(); > > > String[] items = new String[list.size()]; > > > for (int i = 0; i < list.size(); i++) > > > { > > > MyContentHandler.GetRating rating = (MyContentHandler.GetRating) > > > list.get(i); > > > } > > > // Show the data in the list view > > > ListView listView = (ListView) findViewById(R.id.data); > > > listView.setAdapter(new ArrayAdapter<String>(this, > > > android.R.layout.simple_list_item_1, > > > items)); > > > postMethod.releaseConnection(); > > > } > > > > } > > > > thanks in advance > > > > On Sat, Jun 20, 2009 at 8:08 PM, fifi <fa.alshah...@gmail.com> wrote: > > > > > I would like to parse a soap envelope using KSOAP2 how can I start 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 <http://www.w3.org/%0A2001/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); > > > > } > > > > } > > > > -- > > > Regards > > > ------------------- > > > Desu Vinod Kumar > > > vinny.s...@gmail.com > > > 09916009493 > > -- > Eng. Feda AlShahwan > College of Technology Studies > Puplic Authority for Applied Education & Training --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---