2012-05-20 54 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

完成。

無論如何。

相關問題