【问题标题】:Suppressing verbs in Outbound Message in WCF-WebHttp Transport在 WCF-WebHttp 传输中抑制出站消息中的动词
【发布时间】:2015-04-29 19:35:18
【问题描述】:

我正在这里练习教程 - Invoking REST Interface using BizTalk Server

在该页面中,步骤 3(e) 指示提供 GET 作为要在属性的出站消息中抑制的动词 - Suppress Body for Verbs。给出的解释对我来说不是很清楚。

作为一个实验,我删除了 GET 动词并删除了一个输入文件。应用程序因以下错误而暂停:

System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.

Server stack trace: 
at System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream)
at System.Net.HttpWebRequest.BeginGetRequestStream(AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStreamAsyncResult..ctor(HttpWebRequest httpWebRequest, HttpOutput httpOutput, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.BeginGetOutputStream(AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpOutput.SendAsyncResult.SendWithoutChannelBindingToken()
at System.ServiceModel.Channels.HttpOutput.SendAsyncResult.Send()
at System.ServiceModel.Channels.HttpOutput.SendAsyncResult..ctor(HttpOutput httpOutput, HttpResponseMessage httpResponseMessage, Boolean suppressEntityBody, TimeSpan timeout, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartSend(Boolean completedSynchronously)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin()
at System.ServiceModel.Channels.ServiceChannel.BeginCall(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, TimeSpan timeout, AsyncCallback callback, Object asyncState)
at System.ServiceModel.Channels.ServiceChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.ServiceChannel.BeginRequest(Message message, AsyncCallback callback, Object state)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.Channels.IRequestChannel.BeginRequest(Message message, AsyncCallback callback, Object state)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage) 
MessageId:  {9FA7042A-0391-4AAF-946F-FE9C5516ABFD}
InstanceID: {4C29E43D-278A-4615-8A30-4ED1B1CBC2AD}

为什么需要这样做?当我不抑制它时会发生什么?

【问题讨论】:

    标签: rest biztalk msdn biztalk-2013


    【解决方案1】:

    默认情况下,BizTalk 在发送时会发送消息负载(内容主体)。

    当您尝试使用 RESTful 服务并想要执行 GET 时,您通常不想发送消息负载,您也只是从 URL 获取内容,因此您想要禁止发送内容主体.

    查看相关问题Cannot send a content-body with this verb-type

    如果您使用 GET 请求发送内容主体会发生什么变化。 一些代理可能会在请求上出错或出错,或者最终服务器可能会抛出异常,因为它不期望内容主体。

    【讨论】:

      【解决方案2】:

      你需要压制身体,而不是动词。这里有一个已构建并可用的自定义管道组件:https://code.msdn.microsoft.com/biztalk-2010-r2-rest-wcf-fdb2e91f 为您执行此操作。

      【讨论】:

        猜你喜欢
        • 2011-10-23
        • 2018-08-23
        • 1970-01-01
        • 2018-02-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多