Clarity

Expand all | Collapse all

How to View XML Built by Custom GEL Script?

  • 1.  How to View XML Built by Custom GEL Script?

    Posted 03-27-2018 11:12 AM

    First, I'm a relative newbie to GEL and building CAPPM Processes, so if this is kind of a dumb question, sorry!

     

    That having been said, I'm trying to build a GEL script (in DEV, I'm not crazy) that builds an XML file and then imports same, and will add Approve Time permissions to a user based upon a recordset generated by an SQL query.  The query is no problem, and I'm able to get the GEL script to validate so I can execute the process.  Problem is, once I execute the process, the permissions aren't added to the intended user.

     

    I'm assuming there's something wrong with the XML content, so I want to debug it.  But I can't see it, because the process completes successfully so there are no messages I can review.  Hopefully there's a setting in the Process definition that I can enable, or a specific log that I can view, to see the XML and try and figure out why it's not working.  (If I manually build the XML file, it imports and achieves the desired result, so I know it's possible -- and that's why I assume that my GEL-built XML is malformed.)

     

    Does anyone know how I can see that XML?  Any advice will be much appreciated!



  • 2.  Re: How to View XML Built by Custom GEL Script?

    Posted 03-28-2018 06:30 AM

    I assume that the Gel script already has the code for logging(gel:log) and yet, the process does not log messages.

    What is the CA PPM Version? I guess the process logs not being available is due to the newly introduced option in v15.3 to restrict Gel Script logs( available in Clarity System Administration(CSA)). You may refer section New CSA Setting for Error Logging at below link and see if that is appropriate for this case.

    Change Impact and Upgrade (On Premise) - CA PPM - 15.3 - CA Technologies Documentation 



  • 3.  Re: How to View XML Built by Custom GEL Script?

    Posted 03-28-2018 06:48 AM

    You can write messages out to the system log in your code (gel:log) or you can write entire XML documents out to the filesystem (gel:serialize).

     

    (filesystem relative to where your GEL is running that is ; i.e. wherever your BG server is assuming you are running the GEL thru that. If you are running the GEL locally then it would be a local filesystem)



  • 4.  Re: How to View XML Built by Custom GEL Script?

    Posted 03-28-2018 08:45 AM

    Hi Alan,

     

    You can use a sample code like this  and see how it works. It helps to get the logs of Xog write file and Xog write output as well.

     

    <gel:parse escapeText="false" var="user_react_xog">
    <NikuDataBus xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd">
    <Header action="write" externalSource="NIKU" objectType="user" version="13.3.0.286"/>
    <Users>
    <User externalId="" userLanguage="English" userName="${username}" userStatus="ACTIVE">
    <PersonalInformation emailAddress="${manager_email_address}" firstName="${first_name}" lastName="${last_name}"/>
    <Resource resourceId="${resource_id}"/>
    <InstanceRights>
    <Right id="ResourceApproveTime">
    <InstanceObject id="${resource_id}" name="${full_name}" type="SRM_RESOURCES"/>
    </Right>
    <Right id="ResourceEnterTime">
    <InstanceObject id="${resource_id}" name="${full_name}" type="SRM_RESOURCES"/>
    </Right>
    </InstanceRights>
    </User>
    </Users>
    </NikuDataBus>
    </gel:parse>
    <gel:log>XML= <gel:expr select="$user_react_xog"/> <!-- in the process log, you can see the xml file created -->
    </gel:log>

    <core:catch var="xog_exception">
    <soap:invoke endpoint="${XOGURL}/niku/xog" var="result1"> <!-- i have hard coded XOGURL in my parameter, you can use it either from properties.xml-->
    <soap:message>
    <soapenv:Envelope>
    <soapenv:Header>
    <xog:Auth>
    <xog:SessionID>${sessionID}</xog:SessionID>
    </xog:Auth>
    </soapenv:Header>
    <soapenv:Body>
    <gel:include select="$user_react_xog/NikuDataBus"/> <!--Xog write -->
    </soapenv:Body>
    </soapenv:Envelope>
    </soap:message>
    </soap:invoke>

    <gel:log>XML1= <gel:expr select="$result1"/> <!-- in the process log, you can see the xml file created after the xog write-->
    </gel:log>

     

    Thanks,

    Agin



  • 5.  Re: How to View XML Built by Custom GEL Script?

    Posted 03-29-2018 01:27 PM

    It will depend on how you're building the XML I suppose, but I've had success with the following while debugging to make it easy to get the exact XML I've built and run it in to XOG manually to see what happens, v_xml_root being the built XML:

         <gel:set var="vs_output" select="$v_xml_root" asString="true"/>
         <core:set var="vd_date">
              <gel:formatDate format="yyyyMMdd'_'HHmm"/>
         </core:set>   
         <file:writeFile fileName="pathtodir_${vd_date}.xml" embedded="false">
              <file:line>
                   <file:column value="${vs_output}"/>
              </file:line>
         </file:writeFile>