Hey guys... so I turn to the wealth of knowledge that you have once again.
I have a silverlight application that I am developing, and it is pulling data from a SQL Server database using a WCF webservice...
Now after battling to get this working for 3 days, I am just about ready to give up.
Basically, I am doing the following (all code is in VB as that is all I know
)
The code for IService1.vb
The code for service1.vb:
I have tested the service using WcfTestClient and it works perfectly, returning the data that is needed...
The code for MainPage.xaml.vb:
Now, I have published the Webservice to my local IIS server, and added it as a service reference to the silverlight project under address http://localhost/Service1/Service1.svc. It was discovered and there seemed to be no issues with that part.
When I click the button nothing happens. When looking through the IIS logs, I do not see any requested (I am not sure whether they should be there or not). Basically, I dont see the datagrid populated, nor the rest of the code that is meant to be executed by the app (have some animation type stuff).
Any help would be greatly appreciated.
Cheers,
Michael
I have a silverlight application that I am developing, and it is pulling data from a SQL Server database using a WCF webservice...
Now after battling to get this working for 3 days, I am just about ready to give up.
Basically, I am doing the following (all code is in VB as that is all I know
The code for IService1.vb
Code:
' NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
<ServiceContract()> Public Interface IService1
<OperationContract()> Function GetFinesByStudentNo(ByVal strStudentNo As String) As List(Of WebFine)
End Interface
<DataContract()> Public Class WebFine
Private _FineNo As String
Private _VehReg As String
Private _FineDate As Date
Private _FineStatus As String
Private _FineTotal As Double
<DataMember()> Public Property FineNo() As String
Get
Return _FineNo
End Get
Set(ByVal Value As String)
_FineNo = Value
End Set
End Property
<DataMember()> Public Property VehReg() As String
Get
Return _VehReg
End Get
Set(ByVal Value As String)
_VehReg = Value
End Set
End Property
<DataMember()> Public Property FineDate() As Date
Get
Return _FineDate
End Get
Set(ByVal Value As Date)
_FineDate = Value
End Set
End Property
<DataMember()> Public Property FineStatus() As String
Get
Return _FineStatus
End Get
Set(ByVal Value As String)
_FineStatus = Value
End Set
End Property
<DataMember()> Public Property FineTotal() As Double
Get
Return _FineTotal
End Get
Set(ByVal value As Double)
_FineTotal = value
End Set
End Property
End Class
The code for service1.vb:
Code:
Imports WITS.Kaleidoscope.ParkingLogic
Imports WITS.Kaleidoscope.BusinessEntity
' NOTE: If you change the class name "Service1" here, you must also update the reference to "Service1" in Web.config and in the associated .svc file.
Public Class Service1
Implements IService1
Public Function GetFinesByStudentNo(ByVal strStudentNo As String) As List(Of WebFine) Implements IService1.GetFinesByStudentNo
Dim perPermitHolder As PermitHolder
perPermitHolder = ParkingLogic.GetPermitHolderByCriteria("Student_StaffNo = '" & strStudentNo & "'", "")(0)
If perPermitHolder Is Nothing Then
perPermitHolder = ParkingLogic.GetPermitHolderByCriteria("IDNumber= '" & strStudentNo & "'", "")(0)
End If
Dim result As EntityCollection(Of Fine)
result = ParkingLogic.GetRelevantFines(perPermitHolder)
Dim x As New List(Of WebFine)
For Each theFine As Fine In result
Dim aFine As New WebFine
With aFine
.FineNo = theFine.FineNo
.FineStatus = theFine.FineStatus
.FineTotal = theFine.FineTotal
.VehReg = theFine.VehRegistration
.FineDate = theFine.FineDate
End With
x.Add(aFine)
Next
Return x
End Function
End Class
I have tested the service using WcfTestClient and it works perfectly, returning the data that is needed...
The code for MainPage.xaml.vb:
Code:
Private Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
Dim WebSerivce As ServiceReference1.Service1Client = New ServiceReference1.Service1Client
AddHandler WebSerivce.GetFinesByStudentNoCompleted, AddressOf WebSerivce_GetFinesByStudentNoCompleted
WebSerivce.GetFinesByStudentNoAsync(txtUserID.Text)
End Sub
Private Sub WebSerivce_GetFinesByStudentNoCompleted(ByVal sender As Object, ByVal e As ParkingFinesSilverlight.ServiceReference1.GetFinesByStudentNoCompletedEventArgs)
dgFines.ItemsSource = e.Result
... ETC do other stuff...
Now, I have published the Webservice to my local IIS server, and added it as a service reference to the silverlight project under address http://localhost/Service1/Service1.svc. It was discovered and there seemed to be no issues with that part.
When I click the button nothing happens. When looking through the IIS logs, I do not see any requested (I am not sure whether they should be there or not). Basically, I dont see the datagrid populated, nor the rest of the code that is meant to be executed by the app (have some animation type stuff).
Any help would be greatly appreciated.
Cheers,
Michael