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

早过忘川 提交于 2020-01-11 11:12:11

问题


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

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


回答1:


Set WCF.OutboundHttpStatusCode property in message assignment shape:

MyResponseMessage(WCF.OutboundHttpStatusCode) = "400";



回答2:


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

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



来源:https://stackoverflow.com/questions/39019243/how-can-i-return-http-400-from-a-biztalk-rest-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!