2011-10-21 7 views
1

У меня есть классне удается получить доступ к Class от ASMX службы

Public Class NotifierAuthHeader 
    Inherits SoapHeader 

    Public HandlerId As Integer 
    Public Guid As Byte() 
End Class 

, который я использую в WebService в следующих методов:

<OperationContract()><WebMethod()> _ 
public Function GetTestNotifierAuthHeader() 
    Dim testNotifierAuthHeader as NotifierAuthHeader=new NotifierAuthHeader() 

    return testNotifierAuthHeader 

и

<SoapHeader("auth", GetType(NotifierAuthHeader), Direction:=SoapHeaderDirection.In)> _ 
    <OperationContract()> <WebMethod()> _ 
    Public Function GetUnreadInboxMessages(ByVal handlerId As Integer, ByVal customerGuid As String) As String 

Проблема заключается в том, Я не могу скомпилировать клиентское приложение WPF, которое имеет этот веб-сервис как servicereference, потому что он говорит мне, что он не kno w любой NotifierAuthHeader класс.

private ServiceReference1.Service1SoapClient _ws = new ServiceReference1.Service1SoapClient(); 

//Here it says about this error 

private ServiceReference1.NotifierAuthHeader _authHdr; 

Забавно, что я могу использовать GetTestNotifierAuthHeader метод на клиенте, но тип возвращаемого объекта is..object, не NotifierAuthHeader

Что может быть не так с моим кодом?

asmx service is 3.5 и wpf приложение 4.0 C#.

ответ

1

попробовать сделать свой свой NotifierAuthHeader сериализуемая

<Serializable()>Public Class NotifierAuthHeader 
    Inherits SoapHeader 

    Public HandlerId As Integer 
    Public Guid As Byte() 
End Class 
Смежные вопросы