2012-05-20 37 views
-1

晚上好,将数据发送到web服务的问题,使用kso​​ap

我需要你的帮助。

到现在为止,使用我的web服务来提取数据,没有问题。 即使收到数据,我也要发一些。例如:登录。

但是,现在我想发送数据到web服务,它只会返回“true或false”。

我知道我有必要的数据,但没有做应该做的事情。 也就是说,我调用的方法,它需要接收数据,并用这些数据在数据库中进行更新。 我知道哪些手动工作,直接在web服务上。

什么可能是错误的?

下面是代码:

插入数据在Android上的应用程序后,当我点击一个按钮,这样做:

上年底的消息,是我知道的方式我发送真正的数据:

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) 
{ 

} 

该函数,使用这个代码的和平,将数据发送到下一个代码:

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

最后,这是发送的数据到web服务的代码:

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(); 
} 
} 

如果任何人都可以帮助...关心。

回答

0

我已经找到了错误。错误是关于webservice的参数的名称。 :s

完成。

无论如何。

相关问题