Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid app connect to magento via soap webservice
    text
    copied!<p>i am a android app developer. and i want to connect my android with magento with soap web service.</p> <p>i run this code but i can't get the session id. so please help me to how i get the session id and if this code has something wrong then please correct this.</p> <pre><code> public class MainActivity extends Activity { private static final String SOAP_ACTION ="urn:Mage_Api_Model_Server_HandlerAction"; private static final String NAMESPACE = "urn:Magento"; private static final String Method_Name="login"; private static final String URL ="http://abcd.com/api/v2_soap/"; TextView tv; Context mContext; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv=(TextView)findViewById(R.id.tv); } public class getData extends AsyncTask&lt;String, Void, String&gt;{ @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub SoapObject request = new SoapObject(NAMESPACE,Method_Name); request.addProperty("username", "suman"); request.addProperty("apiKey", "suman123"); SoapSerializationEnvelope envelopes = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelopes.dotNet = false; envelopes.setOutputSoapObject(request); try { AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL); androidHttpTransport.debug =true; androidHttpTransport.call(SOAP_ACTION, envelopes);//Getting the Exception here SoapPrimitive resultString=(SoapPrimitive)envelopes.getResponse(); tv.setText("Status "+resultString); new AlertDialog.Builder(mContext).setMessage(""+resultString).show(); } catch (Exception e) {e.printStackTrace(); new AlertDialog.Builder(mContext).setMessage(""+e.toString()).show(); } return null; } } </code></pre> <p>} </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload