API / APIGEE Gateway Interview Questions
How do the JSONToXML and XMLToJSON policies work in Apigee?
The JSONToXML and XMLToJSON policies enable Apigee to act as a protocol bridge between clients and backends that use different message formats. This is common in enterprise environments where legacy backends speak SOAP/XML but modern clients expect JSON REST APIs.
<!-- Client sends JSON; SOAP backend expects XML --> <!-- Step 1: Convert incoming JSON request to XML --> <JSONToXML name="JSON2XML.Request"> <Options> <RootElement>root</RootElement> <NullValue>NULL</NullValue> </Options> <OutputVariable>request</OutputVariable> <Source>request</Source> </JSONToXML> <!-- Step 2: Route to SOAP backend (via TargetEndpoint) --> <!-- Step 3: Convert XML response from SOAP backend to JSON --> <XMLToJSON name="XML2JSON.Response"> <Options> <RecognizeNull>true</RecognizeNull> <NamespaceSeparator>_</NamespaceSeparator> <TextAlwaysAsProperty>false</TextAlwaysAsProperty> </Options> <OutputVariable>response</OutputVariable> <Source>response</Source> </XMLToJSON> <!-- Flow placement: JSONToXML -> TargetEndpoint PreFlow Request (transform before backend) XMLToJSON -> TargetEndpoint PostFlow Response (transform after backend) Full bridge pattern: Client (JSON) -> [JSONToXML] -> Backend (XML/SOAP) Client (JSON) <- [XMLToJSON] <- Backend (XML/SOAP) -->
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
