HI everyone, I got a problem. I am on a school project which uses a PDA to connect to the webservice. The PDA will uses the web service to retrieve values from SAP. I tried my webservice for a simple function like Login it is successful. But when i run my PDA emulator on visual studio it is unable to work. I am unable to solve this error, can anyone help me pls. Thank you:)
The following is my webservice coding
<WebMethod(EnableSession:=True, Description:="This method is used to verify and retrieve a user info upon logging in")> _ Public Function Login(ByVal Email As String, _ ByVal Password As String) As String Dim oCompany As SAPbobsCOM.Company Dim oRecSet As SAPbobsCOM.Recordset Dim LoginExist As String 'Dim oDocument As SAPbobsCOM.Documents = Nothing 'oDocument = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes) 'oDocument. = SAPbobsCOM.BoDocumentTypes.dDocument_Items Try SetConnectionParam("S10036633", "SBODemo_SG", "manager", "manager", "sa", "P@ssw0rd") If ConnectToDatabase() Then oCompany = Session("g_CompanyConnection") oRecSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset) oRecSet.DoQuery("SELECT T0.[firstName] FROM OHEM T0 WHERE T0.[email]='" & Email & "' AND T0.[homeTel]='" & Password & "' AND T0.[position] IN (3,5)") If Not oRecSet.EoF Then LoginExist = "True" Else LoginExist = "False" End If End If Catch ex As Exception Session("g_LastErrorMsg") = ex.Message End Try Return LoginExist End Function
The following is my coding in visual studio 2005, where this method is to consume ( or use) the webservice method.
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click Dim localhost As New localhost.Service Dim dtLogin As String = "" Dim Username As String = "" Dim Password As String = "" Username = CType(txtUsername.Text, String) Password = CType(txtPassword.Text, String) dtLogin = localhost.Login(Username, Password) If dtLogin = "True" Then Dim form As New frmHome form.Show() Else MessageBox.Show("Invalid Username / Password") End If End Sub
The following is the simple design for my PDA.