简体   繁体   English

WCF BasicHttpBinding SOAP调用中的添加/更改查询字符串参数

[英]Add/Change query string parameter in WCF BasicHttpBinding SOAP Call

I want to add a tracking identifier to my SOAP requests (for example a GUID). 我想向我的SOAP请求中添加跟踪标识符(例如GUID)。 This tracking identifier will change for each request. 该跟踪标识符将针对每个请求而更改。 I can then relate logs from the client to the server. 然后,我可以将日志从客户端关联到服务器。

I know how to add this as a SOAP Header for every request . 我知道如何为每个请求将其添加为SOAP Header

I know how to add this as an HTTP Header for every request . 我知道如何将其添加为每个请求的HTTP标头

Is there a way to add this as a QueryString parameter in the HTTP request? 有没有一种方法可以将其添加为HTTP请求中的QueryString参数? It won't be used by the WCF Server, it will only be used to correlate the load balancer and web server logs. WCF服务器将不会使用它,它将仅用于关联负载平衡器和Web服务器日志。

Please note, this isn't a WebBinding, it's a SOAP via HTTP using a post. 请注意,这不是WebBinding,而是通过HTTP通过帖子使用的SOAP。

Look into using a UriTemplate . 研究使用UriTemplate

Example (simple interface): 示例(简单界面):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM