Note that there are some explanatory texts on larger screens.

plurals
  1. POCall WebService Asp.Net sending a parameter JSON
    primarykey
    data
    text
    <p>I'm trying to send a json String but when I call the WebService he send a null parameter instead of my string. When I go to Debug I can see on the soapObject Propertis my json. but in my webService i've put and when I call from my andoid app he always return null</p> <pre><code>if (json.Equals(null)) { return "null"; } try { return json; root = JObject.Parse(json); } catch (Exception e) { return e.StackTrace; } return "parseok"; </code></pre> <p>Here is the code that I'm using.</p> <pre><code> public class OpcoesActivity extends Activity implements OnClickListener { private String cpf; private String senha; private PontosUsuarioDAO pdao = new PontosUsuarioDAO(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.opcoeslayout); cpf = getIntent().getStringExtra("cpf"); senha = getIntent().getStringExtra("senha"); Button importar = (Button) findViewById(R.id.bt_importar); importar.setOnClickListener(this); Button exportar = (Button) findViewById(R.id.bt_exportar); exportar.setOnClickListener(this); } public void onClick(View v) { switch (v.getId()) { case R.id.bt_importar: Intent i = new Intent(this, SincronizarActivity.class); i.putExtra("cpf", cpf); i.putExtra("senha", senha); startActivity(i); break; case R.id.bt_exportar: new Thread(new Runnable() { public void run() { Gson gson = new Gson(); final String json = gson.toJson(pdao.exportaPontosUsuario(cpf)); ExportarDados exp = new ExportarDados("{\"teste\":\"java\"}"); String b = exp.ExportaDadosUser(); } }).start(); break; } } } </code></pre> <p>And here is the class to Export </p> <pre><code> public class ExportarDados { private static final String SOAP_ACTION = "http://serv.lageo.ufpr.br/EnviaPontosUsuario"; private static final String METHOD_NAME = "EnviaPontosUsuario"; private static final String NAMESPACE = "http://serv.lageo.ufpr.br/"; private static final String URL = "http://200.17.203.150/Caderneta/Sincronizar.asmx"; private String json; private SoapObject soapObject; private String result = ""; public ExportarDados(String json) { this.json = json; } public String ExportaDadosUser() { String e2; try { soapObject = new SoapObject(NAMESPACE, METHOD_NAME); soapObject.addProperty("json", json); SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); soapEnvelope.dotNet = true; soapEnvelope.setOutputSoapObject(soapObject); HttpTransportSE ht = new HttpTransportSE(URL); ht.call(SOAP_ACTION, soapEnvelope); SoapPrimitive resultString = (SoapPrimitive) soapEnvelope.getResponse(); result = resultString.toString(); } catch(Exception e) { e.printStackTrace(); } return result; } } </code></pre>
    singulars
    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