2011-12-20 25 views
0

如何將自定義SOAP頭文件添加到Mono中的Web服務中?我使用了以下代碼:在C#單聲道中定製SOAP頭文件

[System.CodeDom.Compiler.GeneratedCodeAttribute("MonoDevelop", "2.6.0.0")] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.ComponentModel.DesignerCategoryAttribute("code")] 
[System.Web.Services.WebServiceBindingAttribute 
    (Name="CommonWebServicePortBinding", Namespace="http://mynamespace.com")] 
public class CWebService : CommonWebService 
{ 
    public CWebService() 
    { 
     try 
     { 
      this.Url = "Url to wsdl";    
     } 
     catch (Exception ex) 
     { 
      Console.WriteLine(ex.ToString()); 
     } 
    }  

    protected override System.Xml.XmlWriter GetWriterForMessage (
     SoapClientMessage message, int bufferSize) 
    { 
     message.Headers.Add(My Custom Header goes here); 
     return base.GetWriterForMessage(message, bufferSize); 
    } 
} 

GetWriterForMessage尚未在單聲道中實現。有沒有其他方法?

回答

0

顯然沒有辦法在Mono中自定義肥皂標題,而GetWriterForMessage則拋出NotImplementedException。