我无法将值保存到我在.net中的webserver。我已经使用下面的代码,但我在emulator..ie得到了跟随误差,如何在android中将值保存到webservice中?
Server was unable to process request---> cannot insert the value null into column 'Name', table 'MyWorldApp.dbo.tbl_UserRegistration';column doesnot allow nulls.INSERT fails. The Statement has been terminated.
我有使用下面的链接:http://113.193.181.53/MyWorldApp/Service1.asmx?op=InsertUsertRegistrationDetails
我的代码是:
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.*;
import android.os.*;
import android.util.Log;
import android.widget.TextView;
public class MyworldActivity extends Activity {
/** Called when the activity is first created. */
private static final String SOAP_ACTION = "http://localhost/service1/InsertUsertRegistrationDetails";
private static final String METHOD_NAME = "POST";
private static final String NAMESPACE = "http://localhost/service1";
private static final String URL = "http://113.193.181.53/MyWorldApp/Service1.asmx";
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv=(TextView)findViewById(R.id.text1);
call();
}
public void call()
{
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Name", "'Rajapandian'");
request.addProperty("UserName", "Rajapandian");
request.addProperty("Password", "123");
request.addProperty("MobileNumber", "456");
request.addProperty("EmailID", "[email protected]");
request.addProperty("image", "http://www.thehindu.com/multimedia/dynamic/00880/INDIA_CORRUPTION_PR_880168f.jpg");
Log.e("success","success");
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();
tv.setText(result.toString());
} catch (Exception e) {
tv.setText(e.getMessage());
}
}
}
谁能告诉我哪里做错了..提前
感谢..
ķ感谢ü...我怎么能retrive从http://113.193.181.53/MyWorldApp/Service1.asmx?op=getUserDetailsByUserName我存储的值 – NareshRavva 2012-01-11 10:38:55
我无法做到这一点,因为它轮到你做一些事情......如果你有任何问题,然后告诉我 – 2012-01-11 12:27:24