2011-10-10 30 views
0

我正在使用c#使用wsdl,並且正在回覆以下錯誤 「SOAP頭未被理解」。使用c#消費wsdl,但得到錯誤:「SOAP頭未被理解」

什麼是造成這個問題,我該如何解決它?


感謝您的答覆, 根據您的建議,我想這代碼:

using System; 
using System.Collections.Generic; 
using System.Web; 
using System.Web.Services; 
using System.Web.Services.Protocols; 

[WebService(Namespace = "http://tempuri.org/")] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 

public class MyHeader : SoapHeader 
{ 


public bool _MustUnderstand; 

public MyHeader() { } 

public bool MustUnderstand 
{ 
    get { return _MustUnderstand; } 
    set { _MustUnderstand = value; } 
} 

} 



public class Service : System.Web.Services.WebService 
{ 
public MyHeader MustUnderstand; 
public Service() 
{ 

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
} 

[WebMethod] 
[SoapHeader("MustUnderstand")] 
public void Nokia() 
{ 
    MustUnderstand = new MyHeader(); 
    MustUnderstand.MustUnderstand = true; 

    WebService connect = new WebService(); 

    long publicKeyK ; 
    publicKeyK=  connect.GetPublicKey(out publicKeyK); 
} 

} 

(我也把對的mustUnderstand屬性假的... ...)

我仍然得到相同的錯誤信息。 「SOAP header to not understand」

任何想法? Poli。

回答