using webservice in my application(how to access the webservice) [Resolved]

Posted by Jerome under VB.NET on 4/12/2012 | Points: 10 | Views : 1319 | Status : [Member] | Replies : 7
Public Function loanDisbursement(ByVal kyc As String) As clsloan

Dim firstname As String = ""
Dim lastname As String = ""

If GetINI() = False Then
MsgBox("Unable to read serverEly.INI", "System Message")
Else

Dim dal As New DAL.DataAccess
Dim dr As MySqlDataReader

dal.ConnectionString = ls_connectionString
dal.Provider = EnumProviders.MySQL

Dim str As String = "select kycno, dateapplied, Llname, Lmname, Lfname, LoanApplied, tbranch, opname, depedregion, status, remarks from ncltrans where kycno = " & kyc & ""
dr = dal.ExecReader(str, CommandType.Text)
While dr.Read
Dim kycnum As String = dr("kycno").ToString
Dim dateapplied As String = dr("dateapplied").ToString
lastname = dr("Llname").ToString
Dim middlename As String = dr("Lmname").ToString
firstname = dr("Lfname").ToString
Dim loanapplied As String = dr("LoanApplied").ToString
Dim tbranch As String = dr("tbranch").ToString
Dim opname As String = dr("opname").ToString
Dim depedregion As String = dr("depedregion").ToString
Dim status As String = dr("status").ToString
Dim remarks As String = dr("remarks").ToString

End While

End If

Return New clsloan(firstname, lastname)
End Function

Public Class clsloan
Public fname As String
Public lname As String

Public Sub New()

End Sub

Public Sub New(ByVal param_fname As String, ByVal param_lname As String)
fname = param_fname
lname = param_lname
End Sub
End Class

-----------------code in my application---------------
Public Class Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim webserv As New webService.NCLservice
webserv.loanDisbursement("12030000000001")
Dim cls As New webService.clsloan
TextBox2.Text = cls.fname
TextBox3.Text = cls.lname
End Sub
End Class

** my problem ( cls.fname and cls.lname) returns nothing..I dont' know why because in my webservice it works fine.Kindly help me about this..Thanks!




Responses

Posted by: Leila on: 4/13/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
in you application code, you call the function and then initialize cls object and use it.
you should assign cls to the function. Try the code below

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim webserv As New webService.NCLservice
Dim cls As New webService.clsloan
cls = webserv.loanDisbursement("12030000000001")
TextBox2.Text = cls.fname
TextBox3.Text = cls.lname
End Sub
End Class


Thanks,
Leila

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Leila on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Check the path of the webservice in the application, may be it is not correct

Thanks,
Leila

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jerome on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
what do you by path?the url?

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Leila on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
yes, I meants url

Thanks,
Leila

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jerome on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Leila,

I think the url is ok because I test it as I add a web reference in my application..
Do you have other idea?

Jerome
thanks

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jerome on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Leila,

Thanks,,,It works!

Cheers;
Jerome

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jerome on: 4/13/2012 [Member] Starter | Points: 25

Up
0
Down
Leila,

Do you have facebook?So that I chat you directly if I have a problem.If you don't mind.

jerome
thanks

Jerome, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response