The problema is that The web service don't recognize any parameter, I don't know if the code is correct,
but the web service ever answer me " - False", How can I pass parameters to my web service correctly?
This is the code of the web service and the J2ME code:
<WebMethod()> _
Public Function Validarusuario(ByVal usuario As String, ByVal password As String) As String
Dim ConSQL As System.Data.OleDb.OleDbConnection, cmd_tmp As System.Data.OleDb.OleDbCommand
Dim sql As String
Try
ConSQL = New System.Data.OleDb.OleDbConnection(CadenaConexion)
ConSQL.Open()
sql = "SELECT COUNT(*) FROM VALIDACION WHERE USUARIO = '" & usuario & "' AND PASSWORD = '" & password & "'"
cmd_tmp = New System.Data.OleDb.OleDbCommand(sql, ConSQL)
If cmd_tmp.ExecuteScalar > 0 Then Return usuario + " - True" Else Return usuario + " - False"
ConSQL.Close()
Catch ex As Exception
Return "False"
End Try
End Function
public void ProcesarRespuesta() {
try {
String soapAction = "http://tempuri.org/Validarusuario";
String serviceUrl = "http://192.168.0.3/Web_Service/service.asmx";
String serviceNamespace ="http://tempuri.org/Web_Service/Validarusuario";
HttpTransport transport = null;
//SoapObject soap = new SoapObject(serviceNamespace, "HelloWorld");
SoapObject soap = new SoapObject(serviceNamespace, "Validarusuario");
soap.addProperty("usuario", "1");
soap.addProperty("password", "1");
transport = new HttpTransport(serviceUrl, soapAction);
transport.debug = true;
Object result = transport.call(soap);
StringItem item = new StringItem("Resultado: ", result.toString());
formulario.append(item);
} catch (Exception e) {
formulario.append(e.toString());
e.printStackTrace();
}
}

Reply With Quote

