Layer7 API Management

Expand all | Collapse all

Request.mainpart assignment

Jump to Best Answer
  • 1.  Request.mainpart assignment

    Posted 08-07-2018 03:42 AM

    Dear Admin,


    I have a requirement to assign dynamic message body for a empty soap request basically null request body. When I set Apply XSLT Transformation assertion to the request message with desired xslt transformation, getting error like below.


    Request Headers: Content-Type text/xml

    Request Body: empty

    Transform Assertion: XSLT Transformation assertion (backend service is SOAP)


    Request: {}



    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="">
                <faultstring>Policy Falsified</faultstring>
                    <l7:policyResult status="Bad Request" xmlns:l7=""/>


    20180807 17:18:30.809INFO5900

    Message not XML; cannot perform XSL transformation


    Intention is request is empty body, and backend routing service has fixed body. So when API is invoked client won't pass any body (basically null value in request.main part) however he suppose to get the desired response.

  • 2.  Re: Request.mainpart assignment

    Posted 08-09-2018 02:12 AM

    Dear Kirankumar_Konchada,


    Apply XSLT Transformation assertion requires any XML input. It doesn't accept empty value as XML and an error response is returned. (It is what you've seen.)
    If you'd like to pass through the empty request.mainpart to the backend, how about removing the Apply XSLT Transformation assertion from your policy?



  • 3.  Re: Request.mainpart assignment
    Best Answer

    Posted 10-25-2018 06:30 PM

    As the XSLT will not allow adding to an empty XML message you can create a new message context variable that can have the XML built in using some static and some dynamic values or dynamic values. The message context variable can then be assigned to the HTTP Routing assertion to be passed to the backend system.

    Sample variable (Note: dynamicValue2=<item2>1235</item2>):









    Stephen Hughes

    CA Support

  • 4.  Re: Request.mainpart assignment

    Posted 11-01-2018 04:13 AM


    Did the answer from Stephen Hughes answered your question? If it did please mark it as the right answer. When your question is not answered or you still have additional questions please let us know.


    With Kind Regards