1

I have problem in BizTalk 2020 a receive location that configured with BasicHTTP WCF Adapter is returning 500 internal server error when it should be returning 400 bad request. The receive location is functioning correctly the receive location has a JSON decoder pipeline component that serializes the inbound JSON message to XML.

Is there some simple way to configure BizTalk to send a 400 bad request when validation fails instead of a 500 internal server error?

Online documentation difficult to comprehend.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
CmC
  • 11
  • 2
  • What is the error message? Because the JSON decoder doesn't really do any validation, it just converts it from JSON to XML. So if that is failing, the payload must not even be valid JSON. (Note: BizTalk always needs a root node in the JSON Payload, so some valid JSON payload will not be valid in BizTalk, e.g. an array at the root, but there are workarounds for that) – Dijkgraaf Nov 13 '22 at 20:03
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 14 '22 at 05:00
  • Understand that the decoder converts the inbound json to xml. But once it been converted we've turned on validation to validat the xml against the its corrresponding xsd If validation fails . BTS produces a error message notifying admin that validation has failed and the node that it has cause the error .....Is there a way to return that message as 400 bad request without writing custom code. now it sending a standard 500 internal service error (sorry don't currently have access to error mess) – CmC Nov 15 '22 at 19:22

1 Answers1

1

No, there isn't any configuration in BizTalk to change what error code it throws if you use the out of the box validator.

So you would either have to write a custom pipeline component, or execute a pipeline in an Orchestration and catch the exception there and then craft a response with the HTTP status of 400.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54