[英]SOAPAction header on Outgoing message with WebHttpBinding
我試圖發出一個http標頭,但是wcf卻以某種方式對其進行了過濾。
[ServiceContract()]
public interface IHelloWorld
{
[OperationContract(Action = "*", IsOneWay = false, ReplyAction = "*")]
void Hello(string text);
}
var channel = new ChannelFactory<IHelloWorld>(new WebHttpBinding(), "http://some.where");
channel.Endpoint.Behaviors.Add(new WebHttpBehavior());
var proxy = channel.CreateChannel();
using (OperationContextScope scope = new OperationContextScope((IContextChannel)proxy))
{
MessageProperties messageProperties = OperationContext.Current.OutgoingMessageProperties;
var requestMessageProperty = new HttpRequestMessageProperty();
messageProperties.Add(HttpRequestMessageProperty.Name, requestMessageProperty);
requestMessageProperty.Headers.Add("SOAPAction", "test");
requestMessageProperty.Headers.Add("Test", "test2");
proxy.Hello("test");
}
測試此代碼時,標頭Test在請求中,而SOAPAction沒有。 我嘗試了使用IClientMessageInspector,但是它也不起作用。 我不能使用其他綁定(基本綁定或更多Soap專用綁定)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.