Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old January 16th, 2012, 04:14 AM   #1 (permalink)
New Member
 
Join Date: May 2011
Posts: 5
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default ksoap2 passed null value to .net service

I was wondering my ksoap2 works well without parameters, but with few parameters, my .net service received null value when my android app is trying to access the .net service.

Below are my codes:
String username = usernameTB.getText().toString();
String password = passwordTB.getText().toString();
String ic = ICTB.getText().toString();
String phone = phoneTB.getText().toString();
String email = emailTB.getText().toString();



SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
PropertyInfo name = new PropertyInfo();
name.setName("username");
name.setValue(username);

PropertyInfo pass = new PropertyInfo();
pass.setName("userpassword");
pass.setValue(password);

PropertyInfo uic = new PropertyInfo();
uic.setName("useric");
uic.setValue(ic);

PropertyInfo uphone = new PropertyInfo();
uphone.setName("userphone");
uphone.setValue(phone);

PropertyInfo uemail = new PropertyInfo();
uemail.setName("useremail");
uemail.setValue(email);

request.addProperty(name);
request.addProperty(pass);
request.addProperty(uic);
request.addProperty(uphone);
request.addProperty(uemail);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);

}
catch(Exception e)
{

e.printStackTrace();
}

private static String NAMESPACE = "http://tempuri.org";
private static String URL = "http://10.0.2.2:31520/testservie/WebService.asmx";
private static String SOAP_ACTION = "http://tempuri.org/teaRegister";
private static String METHOD_NAME = "teaRegister";

And the service code:
public void teaRegister(String username, String userpassword, String useric, String userphone, String useremail)
{
String conn = ConfigurationManager.ConnectionStrings["SQCon"].ConnectionString;
MySqlConnection con = new MySqlConnection(conn);
con.Open();

String register = "Insert Into teausers VALUES(?name,?pass, ?ic,?phone, ?email)";
MySqlCommand insertcmd = new MySqlCommand(register, con);

insertcmd.Parameters.AddWithValue("?name", username);
insertcmd.Parameters.AddWithValue("?pass", userpassword);
insertcmd.Parameters.AddWithValue("?ic", useric);
insertcmd.Parameters.AddWithValue("?phone", userphone);
insertcmd.Parameters.AddWithValue("?email", useremail);
insertcmd.ExecuteNonQuery();

con.Close();



}

Please help me I'm kind of urgent now.

thenicholas is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 12:07 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo