Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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>
1 REPLY 1

former_member34
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're new in asking questions here, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question now by selecting Actions, then Edit.

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS . By personalizing your profile with a photo of you, you encourage readers to respond.

Best regards

Jennifer

SAP Community moderator