WCF Service Returning Object with no properties

I'm learning how to access data on a DB using a WCF web service. My main issue I've run into is that when making a call for the result from the service, the return value is of type UniversityClass but no properties are available and I believe its real type is simply an object, therefore I have no access to any of its 'real' properties.

Heres a snippet of the class in my interface called 'Service1'

<ServiceContract()>
Public Interface IService1

    <OperationContract()>
    Function GetUniversity(ByVal universityID As Integer) As UniversityClass

End Interface

<DataContract()>
Public Class UniversityClass

    Private _universityId As Integer

    Public Property UniversityID As Integer
        Get
            Return _universityId
        End Get
        Set(value As Integer)
            _universityId = value
        End Set
    End Property

and heres a preview of me making the call to the service to get the data

    Dim client As New ServiceReference1.Service1Client
        Dim result As New ServiceReference1.UniversityClass

        Dim x = client.GetUniversityAsync(Integer.Parse(tbUniversityID.Text))
        Dim r As WCFServiceExample.ServiceReference1.UniversityClass = Await x
        If x.IsCompleted Then
            result = x.Result
        End If

        tbResult.Text = result. _ _ _ _

'// ^ No properties accessible here even though it recognizes that result is of type UniversityClass

Upon inspecting ServiceReference1.UniversityClass I get taken to Referece.vb and notice that there is Partial Class UniversityClass which inherits object. I think perhaps that may be the reason why I don't have any access to the properties defined in my Service1 class because it thinks UniversityClass is an object with no type.

I've tried rebuilding all projects individually, rebuilding the solution and still nothing.

Would love some assistance with how to actually get an object of type UniversityClass to return from my service.

Recognizes the type: http://i50.tinypic.com/e5mhvk.jpg No properties available: http://i50.tinypic.com/wmjui9.jpg

Any help would be greatly greatly appreciated!

Answers


Your client can't see the UniversityID because you haven't marked it as a data member:

<DataContract()>
Public Class UniversityClass

    Private _universityId As Integer

    <DataMember()>
    Public Property UniversityID As Integer
        Get
            Return _universityId
        End Get
        Set(value As Integer)
            _universityId = value
        End Set
    End Property

Need Your Help

akamai redirects to origin server 302 redirects

akamai

I have a jsp (test1.jsp) which has a code response.sendRedirect("xxx/jsp/test2.jsp");

Reading data from excel into a vector

arrays excel clojure

How do i read in data from csv files into a vector of vectors.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.