package com.example.splashscreentest; import java.util.List; import java.util.Vector;
import org.json.JSONObject; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.AttributeInfo; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Service; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.IBinder; public class LoginService extends Service { String url="http://demo3.idhasoft.us/iloyal/api/iloyal/customer.php"; String NAME_SPACE="http://demo3.idhasoft.us/iLoyal"; String SOAP_METHOD="customer.login"; String SOAP_ACTION=" http://demo3.idhasoft.us/iloyal/api/iloyal/customer.php/customer.login"; // String url="http://demo3.idhasoft.us/iloyal/api/iloyal/customer.php"; // String NAME_SPACE="iLoyal"; // String SOAP_METHOD="customer.login"; // String SOAP_ACTION=" http://demo3.idhasoft.us/iloyal/api/iloyal/customer.php/customer.login"; //String SOAP_ACTION="iLoyal/customer.login"; // String url="http://demo3.idhasoft.us/iloyal/api/iloyal/customer.php?wsdl "; // String NAME_SPACE="iLoyal"; // String SOAP_METHOD="customer.login"; // String SOAP_ACTION="iLoyal/customer.login"; String parameter="\"email\""+":"+"\"sac...@idhasoft.com\""+"," +"\"password\""+":"+"\"12345678\""+"," +"\"website\""+":"+"\"base\""; @Override public IBinder onBind(Intent intent) { //TODO Auto-generated method stub return null; } @Override public void onStart(Intent intent, int startId) { // TODO Auto-generated method stub try{ SoapObject result=(SoapObject)getWeather(); System.out.println("result "+result.toString()); } catch(Exception e) { System.out.println("exp in soap "+e); } //System.out.println("value is"+result.toString()); stopService(intent); } public SoapObject getWeather() throws Exception { SoapObject request = new SoapObject(NAME_SPACE , SOAP_METHOD); System.out.println(""+request.getNamespace().toString()); System.out.println(""+request.getName().toString()); // System.out.println(parameter.charAt(1)); // System.out.println(parameter.charAt(parameter.length()-2)); // PropertyInfo p=new PropertyInfo(); // p.setName(""); // p.setValue(parameter); // request.addProperty(p); // JSONObject json=new JSONObject(); // json.put("website", "base"); // json.put("password", "12345678"); // json.put("email", "sachin.si...@idhasoft.com"); //request.addProperty("", json); //this is working PropertyInfo id=new PropertyInfo(); id.setName("email"); id.setValue("sachin.si...@idhasoft.com"); id.setType(String.class); request.addProperty(id); PropertyInfo pass=new PropertyInfo(); pass.setName("password"); pass.setValue("12345678"); pass.setType(String.class); request.addProperty(pass); PropertyInfo website=new PropertyInfo(); website.setName("website"); website.setValue("base"); website.setType(String.class); request.addProperty(website); //end // PropertyInfo id=new PropertyInfo(); // id.setName("\"email\""); // id.setValue("\"sachin.si...@idhasoft.com\""); // id.setType(String.class); // request.addProperty(id); // // // PropertyInfo pass=new PropertyInfo(); // pass.setName("\"password\""); // pass.setValue("\"12345678\""); // pass.setType(String.class); // request.addProperty(pass); // // // PropertyInfo website=new PropertyInfo(); // website.setName("\"website\""); // website.setValue("\"base\""); // website.setType(String.class); // request.addProperty(website); // AttributeInfo id=new AttributeInfo(); // id.setName("email"); // id.setName("sachin.si...@idhasoft.com"); // id.setType(String.class); // request.addProperty(id); // // AttributeInfo pass=new AttributeInfo(); // pass.setName("password"); // pass.setName("12345678"); // pass.setType(String.class); // request.addProperty(pass); // AttributeInfo website=new AttributeInfo(); // website.setName("website"); // website.setName("base"); // website.setType(String.class); // request.addProperty(website); //System.out.println("request "+request); // String s=request.toString().replace('=', ' '); // String s1=s.toString().replace(';', ' '); // Object obj=s1; // SoapObject request1=(SoapObject)(obj); // System.out.println("request is "+request1); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //envelope.setOutputSoapObject(request); //envelope.setOutputSoapObject(request); System.out.println(request); envelope.setOutputSoapObject(request); //envelope.dotNet = true; HttpTransportSE transport = new HttpTransportSE(url); //transport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); //AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(url); //androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding= \"UTF-8\"?>"); ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) { System.out.println("connected: "+netInfo.getExtraInfo()); } else { System.out.println("not connected"); } //System.out.println("1================================="); //transport.call(SOAP_ACTION, envelope); transport.call(SOAP_ACTION, envelope); //androidHttpTransport.call(SOAP_ACTION, envelope); System.out.println("2================================="); //System.out.println("response is+"+(String)envelope.getResult()); return (SoapObject) envelope.getResponse(); //return envelope.getResponse().toString(); } @Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); System.out.println("destroy me aaya"); } } i am troubling with above code , proper response is not coming can you please help me to short out it Thanks On Fri, Sep 7, 2012 at 7:40 PM, Justin Anderson <magouyaw...@gmail.com>wrote: > Yeah... it is called "Google" > > - > > http://android-dev-tips-and-tricks.blogspot.com/2012/08/so-you-need-help.html > - http://lmgtfy.com/?q=android+soap+request > > > Thanks, > Justin Anderson > MagouyaWare Developer > http://sites.google.com/site/magouyaware > > > On Fri, Sep 7, 2012 at 7:38 AM, rauf qureshi <qureshira...@gmail.com>wrote: > >> can any body tell me how to send soap request in json format >> >> please reply >> 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 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 > > > -- > 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 -- 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