I have just create my first WCF service and not surprisingly ran into some trouble. I Cannot see class "FaultException" on client but can see class "Composite Type"
By default whenever i create a new WCF application .net adds its default service to it which has a data contract called "Composite type". Now i have added another datacontract class in it but when i build it and update my client reference i cannot see this new data contract class on my client. althoug i can see composite type data contract.
Please advise. I am posting the code below
Imports System.Runtime.Serialization
Public Interface IDocumentService
Function GetDocument(ByVal data As CompositeType) As Byte()
Function HelloWorld() As String
End Interface
Public Class FaultException
'This will carry any message that i will be hard coding in the code
Private _customErrorMessage As String = String.Empty
'This will carry the asp.net error which is generated from exception class
Private _exceptionErrorMessage As String = String.Empty
Public Property CustomErrorMessage() As String
Get
Return Me._customErrorMessage
End Get
Set(ByVal value As String)
Me._customErrorMessage = value
End Set
End Property
Public Property SystemException() As String
Get
Return Me._exceptionErrorMessage
End Get
Set(ByVal value As String)
Me._exceptionErrorMessage = value
End Set
End Property
End Class
Public Class CompositeType
Private _docID As String = String.Empty
Private _authKeySentByClient As String = String.Empty
Private _authKey As String = System.Configuration.ConfigurationSettings.AppSettings("eDocsSecurekey").ToString()
Dim fault As New FaultException()
Public Property DocumentID() As String
Get
Return Me._docID
End Get
Set(ByVal value As String)
Me._docID = value
End Set
End Property
Public Property AuthenticationKeyByClient() As String
Get
Return Me._authKeySentByClient
End Get
Set(ByVal value As String)
Try
fault.CustomErrorMessage = "Invalid Authentication Key"
If Not value = Me._authKey Then
Throw New FaultException(Of FaultException)(fault)
Else
Me._authKeySentByClient = value
End If
Catch ex As Exception
fault.SystemException = ex.Message.ToString()
Throw New FaultException(Of FaultException)(fault)
End Try
End Set
End Property
End Class
Massive thanks
Replies
Know the answer? Post it — somebody with the same question will find it here.