Ryan
Ryan

Reputation: 68

WCF - Object losing it's values when passed to WCF Service

I am new to using WCF Services but have began writing a new project and have ran into this problem. I am also new to programming, so forgive me if wording is incorrect!

I have an object called Profile that I can retrieve on my client from WCF, and that works without problems - using a GetProfile method.

I then wanted to make modifications to the object on the client side and send it back through the WCF service using an UpdateProfile method. At this point, the object always seems to be reinstantiated (therefore overwriting all values to null).

Any help is appreciated.

So the GetProfile method works beautifully. Make changes to the RAIS_Profile on my client works beautifully Send the RAIS_Profile back using UpdateProfile and every value in the object is blank once in that method.

Public Function GetProfile(ByVal DocumentNumber As Integer) As RAIS_Profile Implements IRAISAPI.GetProfile
        Dim Doc As New RAIS_Profile
        'blah
        'blah
        Return Doc
    End Function

    Public Function UpdateProfile(ByVal pDoc As RAIS_Profile) As String Implements IRAISAPI.UpdateProfile
        Return pDoc.DocumentNumber
    End Function

Any help is appreciated!

Upvotes: 1

Views: 1668

Answers (1)

Tecknoth
Tecknoth

Reputation: 21

Look at the service contracts you have, both on client and server. If the parameters aren't precisely named the same way, then you'll encounter this kind of behaviour.

See Here

Upvotes: 2

Related Questions