I have an error:
Type 'MyAppApp.Web.MyAppWebService.NotifierAuthHeader' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base type 'System.Web.Services.Protocols.SoapHeader' with DataContractAttribute or SerializableAttribute, or removing them from the derived type.
while executing this wcf method:
<OperationContract()> <WebMethod(Description:="Gets details about selected PDF document")> _
Public Function GetPdfDetails(ByVal pdfName As String) As String
I couldn’t change SoapHeader because it’s framework class
Public MustInherit Class SoapHeader
Inherits System.Object
Member of System.Web.Services.Protocols
and I use this class in NotifierAuthHeader class
Imports System.Web.Services.Protocols
Imports System.Runtime.Serialization
Public Class NotifierAuthHeader
Inherits SoapHeader
Public HandlerId As Integer
Public Guid As Byte()
End Class
I’m confused a bit. How can I have that working?
Were you deliberately trying to mix two technologies?
SoapHeaderis from the legacy ASMX technology, butOperationContractis from WCF.To use headers in WCF, you need to use a Message Contract, which can contain header parts as well as body parts.