CentraSite Documentation : Runtime Governance with CentraSite : Important Considerations when Configuring REST or XML Virtual Services : Changing the HTTP Method of a REST or XML Request : Sample XSLT Transformation for GET-to-POST or GET-to-PUT
Sample XSLT Transformation for GET-to-POST or GET-to-PUT
As stated in the above table, depending on the structure of the native service, the native service might not be expecting the same payload structure that is being sent. In this case, you would need to transform the request message into the format required by the native service before Mediator sends the requests to the native service. To do this, you invoke an XSLT file at run time.
Assume that:
*The native service name is "authors".
*The virtual REST service or virtual XML service for "authors" is named "vs-authors" and is made available in Mediator at this endpoint: http://localhost:5555/ws/vs-authors/Invoke. The targetNamespace of the virtual REST service or virtual XML service is "http://example.com/authors".
Following is a sample XSLT transformation file for the GET-to-POST or GET-to-PUT scenario.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://example.com/authors"
version="1.0">
 
<xsl:output method="xml" omit-xml-declaration="no" standalone="yes"
indent="yes"/>
 
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
 
<xsl:template match="//ns:invoke/node()">
<xsl:element name="{local-name(.)}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
 
<xsl:template match="//ns:invoke">
<xsl:element name="authors">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Copyright © 2005-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback