How can I return HTTP-400 from a BizTalk Rest serv

2020-04-17 06:12发布

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

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

2条回答
姐就是有狂的资本
2楼-- · 2020-04-17 06:21

Set WCF.OutboundHttpStatusCode property in message assignment shape:

MyResponseMessage(WCF.OutboundHttpStatusCode) = "400";
查看更多
爱情/是我丢掉的垃圾
3楼-- · 2020-04-17 06:24

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.

查看更多
登录 后发表回答