在C#mono中自定义SOAP标头 [英] customizing SOAP headers in C# mono

查看:68
本文介绍了在C#mono中自定义SOAP标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Mono中将自定义SOAP标头添加到Web服务?我使用了以下代码:

How can I add custom SOAP headers to a webservice in Mono? I've used the following code:

[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尚未在mono中实现.还有其他办法吗?

but GetWriterForMessage hasn't been implemented in mono. Is there any other way?

推荐答案

显然,无法在Mono中自定义Soap Headers,并且GetWriterForMessage会引发NotImplementedException.

Apparently there's no way to customize Soap Headers in Mono and GetWriterForMessage throws NotImplementedException.

这篇关于在C#mono中自定义SOAP标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆