Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8170085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:03:50+00:00 2026-06-06T21:03:50+00:00

I created a web service using visual studio and tested it, it works fine.

  • 0

I created a web service using visual studio and tested it, it works fine. I am trying to call a web method from eclipse. I don’t get any errors but the problem is nothing happens. It is supposed to insert values taken from the user into the database. I have given the java class and web method below. What am I doing wrong? Please help

////Java Class to call web method passing in values/////

public class Registration extends Activity{
private static final String SOAP_ACTION = "http://tempuri.org/register";
private static final String OPERATION_NAME = "register";
private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
private static final String SOAP_ADDRESS = "http://10.0.2.2:54714/WebSite1/Service.asmx";

Button sqlRegister;
EditText  sqlFirstName,sqlLastName,sqlEmail,sqlMobileNumber,sqlCurrentLocation,sqlUsername,sqlPassword;

@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.registration);
sqlFirstName = (EditText) findViewById(R.id.etFname);
sqlLastName = (EditText) findViewById(R.id.etLname);
sqlEmail = (EditText) findViewById(R.id.etEmail);
sqlMobileNumber = (EditText) findViewById(R.id.etPhone);
sqlCurrentLocation = (EditText) findViewById(R.id.etCurrentLoc);

sqlUsername = (EditText) findViewById(R.id.etUsername);
sqlPassword = (EditText) findViewById(R.id.etPwd);

sqlRegister = (Button) findViewById(R.id.bRegister);
sqlRegister.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        switch (v.getId()){
        case R.id.bRegister:
             try{
                String firstname = sqlFirstName.getText().toString();
                String lastname = sqlLastName.getText().toString();
                String emailadd = sqlEmail.getText().toString();
                String number = sqlMobileNumber.getText().toString();
                String loc = sqlCurrentLocation.getText().toString();
                String uname = sqlUsername.getText().toString();
                String pwd = sqlPassword.getText().toString();

                SoapObject Request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);

                PropertyInfo pi = new PropertyInfo();
                pi.setName("fname");
                pi.setValue(firstname);
                pi.setType(int.class);
                Request.addProperty(pi);

                PropertyInfo pi2 = new PropertyInfo();
                pi2.setName("lname");
                pi2.setValue(lastname);
                pi2.setType(int.class);
                Request.addProperty(pi2);

                PropertyInfo pi3 = new PropertyInfo();
                pi2.setName("email");
                pi2.setValue(emailadd);
                pi2.setType(int.class);
                Request.addProperty(pi3);

                PropertyInfo pi4 = new PropertyInfo();
                pi2.setName("num");
                pi2.setValue(number);
                pi2.setType(int.class);
                Request.addProperty(pi4);

                PropertyInfo pi5 = new PropertyInfo();
                pi2.setName("locID");
                pi2.setValue(loc);
                pi2.setType(int.class);
                Request.addProperty(pi5);

                PropertyInfo pi6 = new PropertyInfo();
                pi2.setName("username");
                pi2.setValue(uname);
                pi2.setType(int.class);
                Request.addProperty(pi6);

                PropertyInfo pi7 = new PropertyInfo();
                pi2.setName("password");
                pi2.setValue(pwd);
                pi2.setType(int.class);
                Request.addProperty(pi7);

                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet = true;
                envelope.setOutputSoapObject(Request);
                AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(SOAP_ADDRESS);
                try
                {
                    androidHttpTransport.call(SOAP_ACTION, envelope);
                    SoapObject response = (SoapObject)envelope.getResponse();
                    int result =  Integer.parseInt(response.getProperty(0).toString());
                    if(result ==1){
                        Toast.makeText(Registration.this, "You have been registered Successfully", Toast.LENGTH_LONG).show();
                    }
                    else
                    {
                        Toast.makeText(Registration.this, "Try Again", Toast.LENGTH_LONG).show();
                    }
                }
                catch(Exception e)
                {
                   e.printStackTrace();
                }
            break;
        }
      }
    });
}

}

///Web Method in visual Studio////

    [WebMethod]
    public int register(string fname, string lname, string email, string num, int locID,string username,string password)
{
    SqlConnection conn;
    conn = ConnectionManager.GetConnection();
    conn.Open();
    string cmdregister = "INSERT into [User] values(@fname,@lname,@email,@num,@locID)";
    SqlCommand sqlCommand = new SqlCommand(cmdregister, conn);
    sqlCommand.CommandType = CommandType.Text;

    sqlCommand.Parameters.Add("@fname", SqlDbType.Text).Value = fname;
    sqlCommand.Parameters.Add("@lname", SqlDbType.Text).Value = lname;
    sqlCommand.Parameters.Add("@email", SqlDbType.Text).Value = email;
    sqlCommand.Parameters.Add("@num", SqlDbType.Text).Value = num;
    sqlCommand.Parameters.Add("@locID", SqlDbType.Int).Value = locID;
    sqlCommand.ExecuteNonQuery();

    string cmdlogin = "INSERT into [Login] values(@username,@id,@password)";
    SqlCommand sqllogin = new SqlCommand(cmdlogin, conn);
    sqllogin.CommandType = CommandType.Text;

    sqllogin.Parameters.Add("@username", SqlDbType.Text).Value = username;
    sqllogin.Parameters.Add("@password", SqlDbType.Text).Value = password;
    sqllogin.ExecuteNonQuery();
    conn.Close();
    return 1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:03:52+00:00Added an answer on June 6, 2026 at 9:03 pm

    I found what was wrong, thanks to someone.

    1) I have used:

    AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(SOAP_ADDRESS); 
    

    Instead it should be:

    HttpTransportSE httptransport = new HttpTransportSE(SOAP_ADDRESS);
    

    2) I have used:

                PropertyInfo pi = new PropertyInfo();
                pi.setName("fname");
                pi.setValue(firstname);
                pi.setType(int.class);
                Request.addProperty(pi);
    

    Instead it should be:

    request.addProperty("fname", String.valueOf(firstname));
    

    For the other text fields as well

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to do basic SSL-authenticated Web Service using Visual Studio 2008 .NET 3.5 Service
I have created a C# web service using visual studio to stop the windows
I have created a Web Service in Visual Studio 2005, using VB .NET language.
Every new web service you create using visual studio comes with a predefined namespace
I created a web service using Apache cfx and spring, it works, but I
I'm using Visual Studio 2010, and I've got a service reference to a web
I'm trying to do web service using android. I created the web service using
Using Visual Studio 2010, I developed a WCF service hosted on a web application
I created client from wsdl file using visual studio 2010 Pro, created new project,
I have tried to create a hello world Web Service using visual studio 2008,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.