Note that there are some explanatory texts on larger screens.

plurals
  1. POKSoap2 + Android + .net Ws = Null
    primarykey
    data
    text
    <p>i'm having some issues using Ksoap2 in an android project while conecting to a .net Webservice. As long as i call the Ws witouth parameters everything works just fine, but when i try to add parameters, the servers never gets them. here's my code</p> <pre><code>import java.util.Vector; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.AndroidHttpTransport; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class ServicioWeb extends Activity { SoapObject response; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // String NAMESPACE = "http://tempuri.org/"; String NAMESPACE = "IDBN.WS"; String METHOD_NAME = "getClientesByName"; //String SOAP_ACTION = "http://tempuri.org/getClientesByName"; String SOAP_ACTION = "IDBN.WS/getClientesByName"; //String URL = "http://www.ws.idbnar2.com.ar/wsClientes.asmx"; String URL = "http://www.ws.idbnar2.com.ar/wsClientes.asmx"; SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo pi = new PropertyInfo(); pi.setName("Nombre"); pi.setValue("RIQUELME"); pi.setType(int.class); Request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(Request); AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL); ListView Lista = (ListView)findViewById(R.id.Lista); try { androidHttpTransport.call(SOAP_ACTION, envelope); response = (SoapObject)envelope.getResponse(); String[] Clientes = getStringArrayResponse(response, null); Lista.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,Clientes)); } catch(Exception e) { Toast toast = Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG); toast.show(); } } public String[] getStringArrayResponse(SoapObject node, Vector&lt;String&gt; strings) { boolean isFirstCall = false; if (strings == null) { isFirstCall = true; strings = new Vector&lt;String&gt;(); } int count = response.getPropertyCount(); for (int i = 0; i &lt; count; i++) { Object obj1 = node.getProperty(i); if (obj1 instanceof SoapObject) { // don't recurse empty objects if (((SoapObject)obj1).getPropertyCount() &gt; 0) { // recurse into another node to process its nodes/primitives getStringArrayResponse((SoapObject)obj1, strings); } } else if (obj1 instanceof SoapPrimitive) { strings.add(((SoapPrimitive)obj1).toString()); } } // only make this for the original caller if (isFirstCall) { return (String[])strings.toArray(new String[strings.size()]); } return null; } } </code></pre> <p>I harcode the server side, to return a string + the parameters i send it.. and now all i get it's the hardcoded part, seems like the parameters i add to the soap objets are never receives by the server.</p> <p>Allready try : -) removing the "http://" from the namespace on the Webservice -) not using the "envelope.dotNet = true;" -) adding the Property directly into the Request</p> <p>Any idea wha'ts wrong???</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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