Web service doesnt take in the value passed from the android app.. Any suggestions?

xnetterx

New Member
Im trying to pass in an int value to the web service and expecting for a reply. But im only getting the value on the web service instead. I mean it doesn't take in my input value.The android code is as follows:\[code\] package com.example.fp1_webservicedropdown;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;import org.ksoap2.*;import org.ksoap2.serialization.SoapObject;import org.ksoap2.serialization.SoapPrimitive;import org.ksoap2.serialization.SoapSerializationEnvelope;import org.ksoap2.transport.*;public class MainActivity extends Activity { TextView result; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); result = (TextView) findViewById(R.id.textView2); final String NAMESPACE = "http://sample.com/"; final String METHOD_NAME = "SayHello"; final String SOAP_ACTION = "http://sample.com/SayHello"; final String URL = "http://localip/HellowWorld/Service1.asmx"; SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME); Request.addProperty("SayHello", "32"); SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); soapEnvelope.dotNet = true; soapEnvelope.setOutputSoapObject(Request); AndroidHttpTransport aht = new AndroidHttpTransport(URL); try { aht.call(SOAP_ACTION, soapEnvelope); SoapPrimitive resultString = (SoapPrimitive) soapEnvelope .getResponse(); result.setText("The web service returned " + resultString); System.out.println(resultString); } catch (Exception e) { e.printStackTrace(); } }}\[/code\]The web service code is as follows:\[code\]using System;using System.Collections.Generic;using System.Web;using System.Web.Services;namespace HellowWorld{ [WebService(Namespace = "http://sample.com/")] public class Service1 : System.Web.Services.WebService { [WebMethod] public int SayHello(int a) { int t = 8 + a; return t; } }}\[/code\]it simply returns The web service returned 8 when i run through android. Insted of giving The web service returned 40.Any help is greatly appreciated.
 
Back
Top