De momento el código del WS es muy simple. Recibe un string y lo devuelve junto con la hora. En la app de android sólo recibo la hora y no el parámetro
Código del WS
Código:
Código de mi app android:using System; using System.Web.Services; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class WS_Android : System.Web.Services.WebService { [WebMethod] public string p_MPL_set_id(string v_id_device) { String a_data = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString() + " --> " + v_id_device; return a_data; } }
Código:
try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); String a_id = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID); PropertyInfo pi = new PropertyInfo(); pi.setName("v_id"); pi.setValue(a_id); pi.setType(String.class); request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION, envelope); Object result = (Object) envelope.getResponse(); r_id = result.toString(); androidHttpTransport.reset(); } catch (Exception e) { C_MPL_LOG.p_MPL_log(e.getMessage()); C_MPL_LOG.p_MPL_log(e.toString()); }