增加/修改WCF BasicHttpBinding SOAP调用查询字符串参数

本文关键字:调用 查询 字符串 参数 SOAP BasicHttpBinding 修改 WCF 增加 | 更新日期: 2023-09-27 18:16:44

我想为我的SOAP请求添加一个跟踪标识符(例如GUID)。此跟踪标识符将为每个请求更改。然后我可以将日志从客户机关联到服务器。

我知道如何将其添加为每个请求的SOAP标头。

我知道如何将此添加为每个请求的HTTP头。

是否有一种方法可以将此添加为HTTP请求中的QueryString参数?它不会被WCF服务器使用,它只会被用来关联负载均衡器和web服务器日志。

请注意,这不是WebBinding,这是一个通过HTTP使用post的SOAP。

增加/修改WCF BasicHttpBinding SOAP调用查询字符串参数

考虑使用一个UriTemplate。

示例(简单接口):

  [ServiceContract]
  interface ISomeInterface
  {
     [OperationContract]
     [WebInvoke(Method="POST", UriTemplate="params?n={name}&q={quantity}")]
     void SomeMethod(string name, string quantity);
  }