BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-14-2008, 04:43 AM   #1
racsus
Thumbs Must Hurt
 
Join Date: Feb 2008
Model: 8310
PIN: N/A
Carrier: Informatico
Posts: 56
Default parameters web service ksoap

Please Login to Remove!

Hi

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();
}
}
Offline  
Old 04-14-2008, 02:45 PM   #2
alzzz
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: o2
Posts: 25
Default

i also have this problem - has anybody successfully implemented this?

The web service does get called but the parameters are received as 'void'.
My web service is programmed in .net(c#) with the KSOAP calling it.

Any help, much appreciated and i apologise for hijacking racsus's thread

Thanks,
Alex


KSOAP code

Code:
HttpTransport transport=null;
        System.err.println("2"+ url);
        //error =error +"****" +"2";
                try{
            //create soap object
            SoapObject SO = new SoapObject("http://www.rim.net/",this.method);
            //add properties
            SO.addProperty("Lat",this.lat);
             SO.addProperty("Lon",this.lon);
             SO.addProperty("Radius",this.prop1);
             SO.addProperty("Pin",this.prop2);
 
            System.out.println(SO.toString());
            //create soap envelope
            SoapSerializationEnvelope en = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            //add soapobject to envelope
            System.err.println("3");
           // error =error +"****" +"3";
            en.setOutputSoapObject(SO);
            en.dotNet = true;
            en.encodingStyle = SoapSerializationEnvelope.ENC;
            System.err.println("4" + en.toString());
            
            //error =error + "****" +en.getResponse();
            //create transport to server    
            //transport = new HttpTransport(_resources.getString(SERVER_URL));
            transport = new HttpTransport(url);
            transport.debug = true;
            System.err.println("5");
           // error =error +"****" +"5";
           // error =error +"****" + transport.requestDump;
            //use the transport to call a web service method and pass in the enveople
            transport.call("http://rim.net/"+this.method, en);   //format to call web service - uurn:PriceService#getPrice
            System.err.println("6"+en.getResponse());
           // error =error + "****" +transport.responseDump;
            responseContent = transport.responseDump.toString();
web service sample soap request

Code:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetClientData xmlns="http://rim.net/">
      <Lat>string</Lat>
      <Lon>string</Lon>
      <Radius>string</Radius>
      <Pin>string</Pin>
    </GetClientData>
  </soap:Body>
</soap:Envelope>

Last edited by alzzz; 04-14-2008 at 02:54 PM.. Reason: added code
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Nextiva X-835 SIP Color Deskset VoIP Phone Black New In Box picture

Nextiva X-835 SIP Color Deskset VoIP Phone Black New In Box

$44.99



Polycom Vvx 601 VoIP 16 Line Business Phone 4.3

Polycom Vvx 601 VoIP 16 Line Business Phone 4.3" HD Touchscreen PoE With Stand

$28.95



Allworx 9212 VoIP IP Phone with Stand Warranty Paetec 9212P Business Office picture

Allworx 9212 VoIP IP Phone with Stand Warranty Paetec 9212P Business Office

$17.98



Polycom VVX 411 VoIP IP Phone & Stand Warranty Reset VVX411 2201-48450-001 picture

Polycom VVX 411 VoIP IP Phone & Stand Warranty Reset VVX411 2201-48450-001

$19.98



GAI-Tronics 276-002BH Behavioral Health VoIP phone -Volume Control, Indoor, PSTN picture

GAI-Tronics 276-002BH Behavioral Health VoIP phone -Volume Control, Indoor, PSTN

$179.99



Vtech ErisTerminal VSP861 Touchscreen Color Desktop - Voice-Over-IP VOIP Phone picture

Vtech ErisTerminal VSP861 Touchscreen Color Desktop - Voice-Over-IP VOIP Phone

$14.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.