Pepper
Pepper

Reputation: 97

Issue with sending data to a webservice, with ksoap

Good evening,

I need your help.

Until now, using my webservice to withdraw data, there was no problem. Even to receive the data, I have to send some. Example: Login.

However, now I want to send data to the webservice, and it will only return "true or false".

I know I have the necessary data, but does not do what is supposed to do. That is, the method I am invoking, it needs to receive data, and with these data it does the update in the database. I know which works manually, directly on webservice.

what might be wrong?

Below is the code:

After insert the data on the app on android, when i click on a button, do this:

The message on the end, is the way that i know that i send real data:

try
{
    newpassword = newPass;
    Abreviatura = (EditText)findViewById(R.id.txtAbreviatura);
    newabreviatura = Abreviatura.getText().toString();

    Nome = (EditText)findViewById(R.id.txtNome);
    newnome = Nome.getText().toString();

    User = (EditText)findViewById(R.id.txtUsername);
    newusername = User.getText().toString();

    rslt="START"; 
    Caller c=new Caller(); c.newNome = newnome;
    c.newUser = newusername; c.newPass = newpassword;
    c.newAbrev = newabreviatura; c.oldusername = oldusername;
    c.ad=ad;
    c.join(); c.start();

    while(rslt=="START") {
        try {
            Thread.sleep(10); 
        }catch(Exception ex) {
        }
    }

    ad.setTitle("Alteração:");
    ad.setMessage(BIQActivity.comando + ";" + newnome + ";" + newpassword + ";" + newabreviatura + ";" + newusername + ";" + oldusername);
    ad.show();
}catch(Exception ex)
{

}

That function, uses this peace of code, to send data to the next code:

    csup=new CallSoapUpdatePerfil();
    String resp=csup.CallUpdatePerfil(newUser, newNome, newPass, newAbrev, ldusername);
    Perfil.rslt = resp; 

Finally, this is the code that send's the data to the webservice:

public class CallSoapUpdatePerfil { 

public final String SOAP_ACTION = "http://tempuri.org/UpdatePerfil";

public  final String OPERATION_NAME = "UpdatePerfil"; 

public  final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";

public  final String SOAP_ADDRESS = "http://10.0.2.2:80/BIQAndroid/BIQAndroid.asmx";

public String CallUpdatePerfil(String User, String Pass, String Nome, String Abrev, String oldusername)
{
    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
    PropertyInfo pi=new PropertyInfo();
    pi.setName("User");
    pi.setValue(User);
    pi.setType(String.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("Pass");
    pi.setValue(Pass);
    pi.setType(String.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("Abrev");
    pi.setValue(Abrev);
    pi.setType(String.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("Nome");
    pi.setValue(Nome);
    pi.setType(String.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("oldusername");
    pi.setValue(oldusername);
    pi.setType(String.class);
    request.addProperty(pi);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
    SoapEnvelope.VER11);
    envelope.dotNet = true;

    envelope.setOutputSoapObject(request);

    HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
    Object response=null;
    try
    {
        httpTransport.call(SOAP_ACTION, envelope);
        response = envelope.getResponse();
    }
    catch (Exception exception)
    {
        response=exception.toString();
    }
    return response.toString();
}
}

If anyone can help... Regards.

Upvotes: -1

Views: 1247

Answers (1)

Pepper
Pepper

Reputation: 97

I already find the error. The error is about the name of parameter of webservice. :s

Done.

Thanks anyway.

Upvotes: 0

Related Questions