Courseiva

AZ-204 Practice Question: Connect to and consume Azure services and third-party services

You are using Azure API Management to expose a legacy SOAP API as a RESTful API. The SOAP API has complex XML schemas. You need to transform the SOAP response to JSON. Which policy should you use?

⚠ Common exam trap

Test-takers frequently confuse the conceptual need to 'convert to JSON' with a non-existent policy name like `convert-to-json`, or they might think `transform-body` is a real policy, when in fact Azure API Management uses `set-body` for all body transformations.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

set-body

The `set-body` policy is correct because it allows you to replace the body of the SOAP response with a JSON representation. In Azure API Management, you can use the `set-body` policy with a Liquid template or a .NET expression to transform the incoming XML SOAP response into JSON, effectively converting the complex XML schemas to a RESTful JSON output.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • transform-body

    Why it's wrong here

    The `transform-body` policy does not exist within Azure API Management's standard policy set. Policy names are strictly defined, and attempting to use a non-existent policy will result in a deployment error during configuration. For modifying the request or response body, the correct and recognized policy is `set-body`, which provides the necessary capabilities for content transformation.

  • return-response

    Why it's wrong here

    The `return-response` policy is designed to immediately terminate policy execution and send a custom response back to the client, bypassing any further processing or calls to the backend service. While it can construct a response body, its primary function is not to *transform* an existing backend response, but rather to *generate* a new, independent response, often used for mocking or error handling scenarios.

  • convert-to-json

    Why it's wrong here

    The `convert-to-json` policy is not a recognized or available policy in Azure API Management. While the goal might be to convert content to JSON, this specific policy name does not exist within the platform's policy schema. Content transformation, such as converting SOAP XML to JSON, is achieved through the `set-body` policy, which uses expressions, Liquid templates, or XSLT to perform the actual data manipulation.

  • set-body

    Why this is correct

    The `set-body` policy is the correct and most versatile policy for transforming the request or response body in Azure API Management. It allows developers to programmatically modify the content using C# expressions, Liquid templates, or XSLT, enabling complex transformations like converting a SOAP XML response into a modern JSON format. This policy can access context variables and apply sophisticated logic to reshape the data before it reaches the client.

About these practice questions

This AZ-204 question is part of Courseiva's 881-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.