Skip to Content
0
Oct 29, 2020 at 04:47 PM

How to route my input request using xslt and get Soap Response ?

150 Views Last edit Oct 29, 2020 at 04:46 PM 2 rev

Hi,

I have searched many blogs for sample XSLT. Hope I get help from here. I'm trying to route to the destination, if it's successful it should display success response in soap format otherwise failure response but my xslt is not working as expected.

Here is my input request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://host:port/" xmlns:ees="http://www.siebel.com/xml/EESFA%20Order%20Submittion%20IO">  <soapenv:Header/>  <soapenv:Body>  <ord:Input>  <ees:List>  <ees:Entry>  <ees:Id>123</ees:Id>  <ees:Number>G1</ees:Number>  </ees:Entry>  </ees:List>  </ord:Input>  </soapenv:Body></soapenv:Envelope>

Here is my XSLT:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    xmlns:dp="http://www.datapower.com/extensions"   extension-element-prefixes="dp"    exclude-result-prefixes="xsl dp">   <xsl:template match="/">     <xsl:variable name="uriIn" select="dp:variable('var://service/URL-in')"/>     <xsl:choose>       <xsl:when test="contains($uriIn,'/IDEV/')">         <dp:set-variable name="'var://service/routing-url'" value="concat('http://http://host:port/',substring-after($uriIn,'/IDEV/'))"/>       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://host:port/">  <soapenv:Header/>  <soapenv:Body>  <ord:Output>     <ord:faultactor>Success</ord:faultactor>     <ord:Resp>     <ord:IntegrationStatus>Success1</ord:IntegrationStatus>     <ord:ErrorDescription>Description</ord:ErrorDescription>       </ord:Resp>     <ord:faultcode>200</ord:faultcode>     <ord:faultstring>Success2</ord:faultstring>  </ord:Output>  </soapenv:Body></soapenv:Envelope></xsl:when>       <xsl:otherwise>         <dp:set-variable name="'var://context/envRouter/reject'" value="'Connection Failed to the Backend'"/>        <dp:reject override="true | false ">        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://host:port">  <soapenv:Header/>  <soapenv:Body>  <ord:Output>     <ord:faultactor>Connection Failed</ord:faultactor>     <ord:Resp>     <ord:IntegrationStatus>Failed</ord:IntegrationStatus>     <ord:ErrorDescription>Connection error</ord:ErrorDescription>       </ord:Resp>     <ord:faultcode>500</ord:faultcode>     <ord:faultstring>Failed</ord:faultstring>  </ord:Output>  </soapenv:Body></soapenv:Envelope>        </dp:reject>                </xsl:otherwise>            </xsl:choose>   </xsl:template></xsl:stylesheet>

In my output I'm getting the same input as response. But not the success SOAP message as response. Where have I gone wrong in my XSLT ? can someone please help on this.

Expected Output If success:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://host:port"><br>  <soapenv:Header/><br>  <soapenv:Body><br>  <ord:Output>   <br>  <ord:faultactor>Success</ord:faultactor>   <br>  <ord:Resp>   <br>  <ord:IntegrationStatus>Success1</ord:IntegrationStatus>   <br>  <ord:ErrorDescription>Description</ord:ErrorDescription><br>  </ord:Resp>   <br>  <ord:faultcode>200</ord:faultcode>   <br>  <ord:faultstring>Success2</ord:faultstring><br>  </ord:Output><br>  </soapenv:Body><br>  </soapenv:Envelope>