Consume Rest Service without parameter

We gets following exception when BizTalk consume REST service which doesn’t require parameter or message body. But BizTalk always sends some message.

Error: A message sent to adapter “WCF-WebHttp” on send port with URI is suspended.

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

Solution:

Sometime when there is requirement in BizTalk to consume REST service with GET or DELETE method without parameters (when there is no parameter require in web URL) and without message. In this scenario we need to add method Name Suppress Body for Verbs in Messages section of send port WCF-WebHttp configuration as below.

Through setting this property BizTalk removes the message body from the REST service request.

Please refer here for more details about how to consume REST Service from BizTalk

In the Messages tab, specify how the message is sent to the REST interface.

Properties Description
Outbound HTTP Headers Specifies the HTTP headers that are stamped on the response message, if any.
Suppress Body for Verbs Based on the verb you use to invoke a REST endpoint, you may or may not require a message payload. For example, you may not need a message payload while using the GET or DELETE verbs. However, to trigger a call to the REST endpoint using the send port, you may use a dummy message that includes a message payload. Before the message is sent to the REST endpoint, the message payload from the dummy message must be removed. You can specify the verbs for which the message payload must be removed using the Suppress Body for Verbs property.

For example, if you want to remove the message payload while using a GET verb, specify the value for this property as GET.

Reference: https://docs.microsoft.com/en-us/biztalk/core/wcf-webhttp-adapter

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s