Layer7 API Management

  • 1.  How to convert xml to SOAP format using Apply XSLT transformation?

    Posted Sep 21, 2017 08:00 AM

    How to convert xml to SOAP format using Apply XSLT transformation?



  • 2.  Re: How to convert xml to SOAP format using Apply XSLT transformation?

    Broadcom Employee
    Posted Sep 21, 2017 08:53 AM

    Hello, 

     

    To start, you are using the right assertion to accomplish this; Apply XSLT Transformation. But do you have a specific question regarding it? Are you having trouble converting it? Or just looking for more information?

     

    Apply XSL Transformation Assertion - CA API Gateway - 9.2 - CA Technologies Documentation 

     

    The above documentation will guide you but if something is going wrong, feel free to attach your policy and the xml with it. 

     

    Thanks.

     

    -Alec Daniello

    APIM Support



  • 3.  Re: How to convert xml to SOAP format using Apply XSLT transformation?

    Posted Sep 21, 2017 08:58 AM

    Hi Alec,

    Thanks for your reply. Facing trouble in converting the xml to SOAP message format using  Apply XSLT Transformation. Can you provide the screen shot how to apply xslt transformation to convert xml to SOAP format.

     

     

    Thanks

    Syed Hajir Ali M



  • 4.  Re: How to convert xml to SOAP format using Apply XSLT transformation?
    Best Answer

    Broadcom Employee
    Posted Sep 21, 2017 01:55 PM

    Syed Hajir Ali M,

     

    One thing to note from your policy screen capture is that you need to set the context variable json in the Apply Transformation to section of the Apply XSL Transformation assertion. Below are some basic XSLT for conversion:

     

    SOAP to XML

     

    Use case: an XML over HTTP legacy endpoint expose as a soap service by the SSG. This xslt removes the incoming SOAP envelope and keeps only its contents.

     

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <xsl:template match="soap:Body">
                <xsl:copy-of select="./*[1]" />
        </xsl:template>
    </xsl:stylesheet>

     

    XML to SOAP

     

    Use case: same as above, add the soap envelope to the returning answer.

     

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <xsl:template match="/">
            <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                <soap:Body>
                    <xsl:copy-of select="." />
                </soap:Body>
            </soap:Envelope>            
        </xsl:template>
    </xsl:stylesheet>

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support



  • 5.  Re: How to convert xml to SOAP format using Apply XSLT transformation?

    Posted Sep 22, 2017 02:17 AM

    Thanks Stephen Hughes for your reply.

     

    Now it works and able to convert xml to soap format using Apply XSLT transformation.

     

    Please let me know how to add saml token to this and validate the saml token using Require SAML token profile.

     

    Thanks 

    Syed



  • 6.  Re: How to convert xml to SOAP format using Apply XSLT transformation?

    Broadcom Employee
    Posted Sep 22, 2017 01:26 PM

    Syed,

     

    I've noted that you have opened another post on this topic around SAML (How to create SAML token using SOAP web service and how to validate the SAML token using  Built RST soap assertion? Please tell me with an example. ) so I will look to get that post updated with the required information. Trying to avoid crossover between posts.

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support



  • 7.  Re: How to convert xml to SOAP format using Apply XSLT transformation?

    Posted Sep 27, 2017 01:49 PM

    Hi Stephen,

    Can you please let me know how to pass the saml token and payload in the soap header and soap body(Converting to soap) when using apply xsl transforamtions.

    Thanks



  • 8.  Re: How to convert xml to SOAP format using Apply XSLT transformation?

    Broadcom Employee
    Posted Sep 27, 2017 02:34 PM

    Syed,

     

    In the other post (How to create SAML token using SOAP web service and how to validate the SAML token using  Built RST soap assertion? Please tell me with an example. ), the option shown in the assertion will automatically insert it into the header of a SOAP payload without the need to do it with the XSLT to eliminate a lot of complication. If you convert the message prior to the SAML assertion then it will work. I noted in your attachment the usage of response as the message target which appears to be incorrect.

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support