AZ-204 Connect to and consume services

Your API Management instance fronts a legacy service that returns XML. Modern clients expect JSON responses, so the gateway must convert the backend's XML output. Which policy and section should you use?

Show answer and explanation

Answer: C

The xml-to-json policy converts an XML response body into JSON, so it belongs in the outbound section, where it processes the backend's response before it returns to the client. The inbound section handles requests, so a json-to-xml policy there would convert in the wrong direction. A set-body template could produce JSON, but it means writing a template for each response shape. Rewrite-uri only changes the request URL.

Why the other options are wrong

  • A. json-to-xml converts JSON request bodies into XML. It works in the opposite direction, so it would not transform the legacy XML responses for clients.
  • B. set-body can build a JSON body from an expression, but it requires hand-written templates for every response shape. The built-in conversion policy handles XML to JSON without custom code.
  • D. rewrite-uri changes the URL path or query string sent to the backend. It does not convert a response body, so changing the Content-Type header alone would leave XML in the payload.

Keep going. 230 AZ-204 questions, answers explained after each one.

Practise this domain

Reviewed November 2026. Spotted a problem with this question? Report it from the practice tool.