Layer7 API Management

  • 1.  Removing xml node from response

    Posted Jan 24, 2017 01:38 AM

    Good Day,

     

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <ser-root:abc xmlns:ser-root="http://***/abcTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Untitled>
    <val1>2</val1>
    <val2>1</val2>
    <val3>84</val3>
    </Untitled>
    </ser-root:abc>
    </soapenv:Body>
    </soapenv:Envelope>

     

    I have this xml response from a service.

    I would like to remove val1 node from this document. 

     

    I am trying to complete the following steps.

    1) route to server and get response

    2) reponse mutch match xpath -> /soapenv:Envelope/soapenv:Body/ser-abc/Untitled/val1

    3)  set the context variable    and remove xml elements 

    I think I am having problems with step3.

     

    How do I use the variable prefix in step 2 and context variable in step 3?

     

    Any help with the assertions would be appreciated.

    Also is there any documentation about handling assertions with examples?

     

    Warm Regards.



  • 2.  Re: Removing xml node from response

    Posted Jan 24, 2017 04:06 AM

    Hi zifirr,

     

    There are examples and a good description of how to use the Evaluate Response Xpath Assertion in the documentation. 

    Evaluate Response XPath Assertion - CA API Gateway - 9.1 - CA Technologies Documentation 

     

    Here is a sample for you.

     

    EVALUATE XPATH ASSERTION: the xml that is being passed should have a tag of tree and under it should have a tag of fruit. The variable is set to var1 which means that several context variables will be available.

     

     

    Sending XML document with tree and fruit

    Variables being set



  • 3.  Re: Removing xml node from response
    Best Answer

    Posted Jan 24, 2017 04:06 AM

    Hi zifirr,

     

    There are examples and a good description of how to use the Evaluate Response Xpath Assertion in the documentation. 

    Evaluate Response XPath Assertion - CA API Gateway - 9.1 - CA Technologies Documentation 

     

    Here is a sample for you.

     

    EVALUATE XPATH ASSERTION: the xml that is being passed should have a tag of tree and under it should have a tag of fruit. The variable is set to var1 which means that several context variables will be available.

     

     

    Sending XML document with tree and fruit

     

    Variables being set