如何从BizTalk Orchestration中的Rest Service中捕获http 400状态 [英] How catch http 400 Status from Rest Service in BizTalk Orchestration

查看:89
本文介绍了如何从BizTalk Orchestration中的Rest Service中捕获http 400状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在BizTalk 2013/R2(CU6)上,我在当前的客户端中看到了另一个正在执行此操作的应用程序/编排,但未在执行此操作.

On BizTalk 2013/R2 (CU6), I have seen another app/orchestration in my current client that seems to be doing this, but my app/orchestration is not.

我通过导出,编辑然后导入,仅更改名称和操作/方法绑定来克隆了它们的发送端口.它具有启用检查失败消息的路由".

I cloned their send port by doing export, editing, and then importing, changing only name, and operation/method binding. It has the "enable routing for failed messages checked".

好像我在用System.Exception在业务流程中捕获它一样, 但我仍然看到SendPort已暂停(可恢复)和路由错误(不可恢复).

Looks like I am catching it in the orchestration with a System.Exception, but I still see the SendPort suspended (resumable), and a routing error (nonresumeable).

我正在捕获的示例错误(我故意强行执行该错误以测试错误处理).

Sample error that I'm catching (I'm forcing the error on purpose to test the error handling).

System.Net.WebException:远程服务器返回了意外的消息 响应:(400)错误的请求. {"httpStatusCode":400,"httpMessage":错误 请求","errorMessage":无法处理发货 request," errors:[{" severity:" ERROR," message:"没有凭据 为该供应商找到.您是否将它们添加到ABC中 仪表板?",源":"SYSTEM"}],"supportReferenceId":"31eee61a-8770-4524-bada-2d906a53ab48"}

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":"No credentials were found for this vendor. Did you add them to ABC dashboard?","source":"SYSTEM"}],"supportReferenceId":"31eee61a-8770-4524-bada-2d906a53ab48"}

我看过其他一些博客,问题表明未返回500个错误,并且未设置http状态.但是我没有看到有关挂起的SendPort"的任何信息.好像今天早些时候一样,我的System.Exception没有捕获到它,但是我无法及时返回来确定.

I've seen some other blogs and questions indicate that 500 errors are not returned, and that the http status is not set. But I haven't seen anything about the Suspended SendPorts. Also seems like earlier today, my System.Exception was not catching it, but I cannot go back in time to be sure.

我在SendPort上的重试计数为0.

I have retry count on the SendPort to 0.

此外,实际上确定哪些HTTP状态可以返回到业务流程的是什么?我同事的代码也检查了400、401和403.

Also, what actually determines which http statuses can get back to the orchestration? My colleague's code checked for 400, 401, and 403 as well.

相关问题: BizTalk捕获Http响应代码

更新:我的同事在另一个团队中,但我收到了她的回音.她的另一个业务流程只是吃掉"错误消息以避免错误.

Update: My colleague is on another team, but I heard back from her. She had another orchestration that just "eats" the error message to avoid errors.

推荐答案

关于Http错误和任何其他硬错误,应该没有什么特别的.他们同样被提升回编排.

There shouldn't be anything special about Http errors vs any other hard fault. They're raised back to the Orchestration just the same.

这是一篇有关通过一些有用的技巧处理业务流程中的错误的文章.

Here's an article on handling errors in Orchestrations with some useful techniques.

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆