Kenank
Kenank

Reputation: 366

How can I return HTTP-400 from a BizTalk Rest service?

I am using BizTalk 2013 R2 and I have a RESTFUL service.

How can I return a HTTP-400 response to a client?

Upvotes: 2

Views: 614

Answers (2)

Dijkgraaf
Dijkgraaf

Reputation: 11527

Oleg's answer will work if you have an Orchestration

If you want a messaging only solution you will have to have a Pipeline Component set the same context property.

For this we tend to use the BizTalk Business Rules Engine Pipeline Framework

In your Business Rule policy, use the SetCustomContextProperty from the BREPipelineFramework.SampleInstructions.ContextInstructions in your Actions and set the context name of OutboundHttpStatusCode and a namespace of http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties and set the value to 400

The picture below show what it looks like, but with a 404

enter image description here

Disclosure: This framework was written by someone I have worked with.

Upvotes: 3

oderibas
oderibas

Reputation: 2104

Set WCF.OutboundHttpStatusCode property in message assignment shape:

MyResponseMessage(WCF.OutboundHttpStatusCode) = "400";

Upvotes: 1

Related Questions