Layer7 API Management

 View Only
  • 1.  SOAP XML XPath

    Posted Mar 25, 2020 11:15 AM
    I am currently trying to use the 'Evaluate Request XPath' policy fragment to setup a context variable given a SOAP XML input:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http:=//tews6/wsdl">
       <soapenv:Header/>
       <soapenv:Body>
          <wsdl:TaskContext>
             ...
          </wsdl:TaskContext>
    </soapenv:Body>
    </soapenv:Envelope>

    Getting to the SOAP Body works just fine (/s:Envelope/s:Body), but when I try to get to the <wsdl:TaskContext> tag using '/s:Envelope/s:Body/wsdl:TaskContext', it fails with the standard soapenv:Server response.  When I attempt to do use the same XPath outside of Policy Manager, it works just fine.  My question is: what is the proper way to get to the <wsdl:TaskContext> value using XPath inside of the Policy Manager.


  • 2.  RE: SOAP XML XPath

    Broadcom Employee
    Posted Mar 25, 2020 12:11 PM
    Hi Edward,

    You can try using this xpath expression:

    /soapenv:Envelope/soapenv:Body/wsdl:TaskContext

    xpath





  • 3.  RE: SOAP XML XPath
    Best Answer

    Broadcom Employee
    Posted Mar 25, 2020 12:18 PM
    Have you confirmed that the wsdl namespace is defined in the assertion? Click the "Edit Namespace" button and confirm wsdl is listed. If not you'll need to add it. This is easily done by creating a sample message in the assertion and using the UI to create the XPath.

    ------------------------------
    Jay MacDonald - Adoption Architect - Broadcom API Management (Layer 7)
    ------------------------------



  • 4.  RE: SOAP XML XPath

    Posted Mar 26, 2020 11:44 AM
    I have one entry in my namespaces, which is "s" => "http://schemas.xmlsoap.org/soap/envelope/".  I tried some different URLs and did some Googling and could not find a matching URL for <wsdl:TaskContext>.

    Summary: What is the namespace URI like  http://schemas.xmlsoap.org/soap/envelope/ for wsdl: as opposed to soapenv:



  • 5.  RE: SOAP XML XPath

    Broadcom Employee
    Posted Mar 26, 2020 12:19 PM
    It is defined in the sample message: xmlns:wsdl=http:=//tews6/wsdl, which is a very odd looking namespace declaration.

    As I mentioned, if you create a sample message and use it to define the XPath it will automatically add the namespace.


    ------------------------------
    Jay MacDonald - Adoption Architect - Broadcom API Management (Layer 7)
    ------------------------------



  • 6.  RE: SOAP XML XPath

    Posted Mar 26, 2020 12:38 PM
      |   view attached
    Adding the http:=//tews6/wsdl namespace worked!  Thank you so much - been struggling with this for days.  When I tried to add the Sample Message, I get a privilege error.  Is that really a privilege error or is something else going on? (but the namespace worked so I'm good - thanks again):


  • 7.  RE: SOAP XML XPath

    Broadcom Employee
    Posted Mar 26, 2020 12:42 PM
    I'm glad it worked.

    I'm concerned about the "privilege" error. Are you logged in as an administrative user, or a user limited by RBAC? Can you provide a screenshot of the error and the steps you took to get there?

    ------------------------------
    Jay MacDonald - Adoption Architect - Broadcom API Management (Layer 7)
    ------------------------------



  • 8.  RE: SOAP XML XPath

    Posted Mar 26, 2020 12:50 PM
      |   view attached
    I may have limited privileges.  I've only recently started this new position.  I have attached an image that shows how I am getting to the privilege error.


  • 9.  RE: SOAP XML XPath

    Broadcom Employee
    Posted Mar 26, 2020 01:02 PM
    Yep, that's an RBAC permission block. An administrator will need to add you to a role that includes read/write access to Sample Messages. I don't think any of the stock roles have that rule, so a custom one would need to be made if you want to head down this path. But, since you now have it working I guess that doesn't really matter :)

    ------------------------------
    Jay MacDonald - Adoption Architect - Broadcom API Management (Layer 7)
    ------------------------------