How to prevent BizTalk 2013/R2 WCF-WebHttp Rest SendPort from Suspending on Http Status=400

瘦欲@ 提交于 2019-12-11 05:13:13

问题


I'm calling a vendor's REST service from a BizTalk orchestration using a WCF-WebHttp SendPort.

Even though I capture this System.Exception in an orchestration with a scope.exception, the SendPort remains suspended. Is there anyway to prevent the Susepend (WCF-CustomBehavior or Binding?) How do most BizTalk consumers of external REST services deal with this?

There are many different errors, some for security, some for data/configuration that might be returned with a 400 status, here is one example:

A message sent to adapter "WCF-WebHttp" on send port "spP44WebHttp" with URI "https://test.abc.com/api/v3" is suspended. Error details: System.Net.WebException: The remote server returned an unexpected response: (400) Bad Request. {"httpStatusCode":400,"httpMessage":"Bad Request","errorMessage":"Unable to handle shipment request","errors":[{"severity":"ERROR","message":"Customer-X does not support these accessorials: AIRPU","source":"SYSTEM"}],"supportReferenceId":"e0117674-9f83-4b42-b861-2e9b9f636323"}

When you have a Scope/Exception around any other two-way WCF send, such as WCF-SQL, it doesn't leave the SendPort suspended when you catch the error, does it?

Related: BizTalk Catch Http Response Code

Update 1: I found this TechNet Post which seems to be on target: https://social.technet.microsoft.com/wiki/contents/articles/33238.biztalk-server-2013-r2-handle-exceptions-from-rest-services-in-orchestration.aspx However, it states they could not catch the errors. I can catch the 400 errors, but what I don't like is the Suspended SendPort.

Update 2: I'm trying a custom behavior, where I was going to reset the status code in the BeforeSendReply. But using the debugger, I see the following methods run: Validate(), AddBindingParameters(), ApplyClientBehaviors(), BeforeSendRequest(), BUT - I never see the BeforeSendReply() run. So if BizTalk adapter doesn't like the 400 status, does that stop it from getting back into the Custom Behavior?

来源:https://stackoverflow.com/questions/49617062/how-to-prevent-biztalk-2013-r2-wcf-webhttp-rest-sendport-from-suspending-on-http

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