I'm practicing the tutorial here - Invoking REST Interface using BizTalk Server
In that page, the step 3(e) indicates to provide GET as the verb to be suppressed in the outbound message for the property - Suppress Body for Verbs
. The explanation given is not clear to me.
As an experiment, I removed the GET verb and dropped an input file. The application got suspended with the following error:
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}
Why is this required and what exactly happens when I don't suppress it?
By default BizTalk sends a message payload (content-body) when it sends.
When you are trying to use a RESTful service and want to do a GET you usually don't want to send a message payload, you just too fetch the contents from a URL, hence you want to suppress sending a content-body.
See related question Cannot send a content-body with this verb-type
What will happen if you send a content-body with a GET request varies. Some proxies might mangle or error on the request or the end server may throw and exception as it was not expecting a content-body.