0

サービスに接続するアプリケーションがあります。Soap ヘッダーに追加のパラメーターを追加したいのですが、これを正確にどこに追加すればよいですか?

    protected override WebRequest GetWebRequest(Uri uri)
    {
        //apptoken name to be sent instead of caller app name - 10.1
        this.RequestSoapContext.Addressing.From = new Uri(ServiceConfiguration.APPTOKEN, UriKind.Relative);

        WebRequest req = base.GetWebRequest(uri);

        req.Headers.Add(ServiceConfiguration.HEADER_COOKIE_NAME_C, ServiceConfiguration.HEADER_COOKIE_VALUE);
        req.Method = ServiceConfiguration.REQUEST_METHOD;
        req.ContentType = ServiceConfiguration.REQUEST_CONTENT_TYPE;

        string smsession = GetSMSessionCookie();
        if (smsession != "")
        {
            req.Headers.Add(ServiceConfiguration.HEADER_COOKIE_NAME_C, smsession);
        }

        m_webRequest = req;
        return req;


    }

私はこれをWebサービスクラスの1つに持っています。しかし、これは Http ヘッダーのようです。

これは別のクラスにもあり、定数が指定されています。

    public const string REQUEST_METHOD = "POST";
    public const string REQUEST_CONTENT_TYPE = "text/xml";

    public const string HEADER_SOAP_ACTION_NAME = "SOAPAction";
    public const string HEADER_SOAP_ACTION_VALUE = "/";

    public const string HEADER_COOKIE_VALUE = "SMCHALLENGE=YES";

    public const string HEADER_APPLICATION_NAME = "APPLICATION_NAME";
    public const string HEADER_APPLICATION_VALUE = "XLS";

    public const string COOKIE_SMSESSION = "SMSESSION=";
    public const string HEADER_COOKIE_NAME_C = "Cookie";
    public const string HEADER_COOKIE_NAME_SETC = "Set-Cookie";
    public const string HEADER_COOKIE_SEPARATOR = ";";

SOAP REQUEST ヘッダーに独自のパラメーターを追加する方法を教えてもらえますか?

私はwinforms .net 4.0 c#を使用しています。

4

1 に答える 1