webMethods CloudStreams 10.3 | webMethods CloudStreams Documentation 10.3 | Virtual Services | Important Considerations for REST Virtual Services | Changing the HTTP Method of a REST Virtual Service | 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 CloudStreams sends the requests to the native service. To do this, you invoke an XSLT file during the "In Sequence" step.
Assume that:
*The native service name is "authors:.
*The REST virtual service for "authors: is named "vs-authors: and is made available in CloudStreams at this endpoint: http://localhost:5555/ws/vs-authors/Invoke. The targetNamespace of the REST virtual 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 © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.