Clarity

  • 1.  GEL: XOG error message

    Posted Oct 15, 2015 12:26 PM

    I have a GEL script that issues a XOG command to update a custom project attribute on "Project Create".  I get the error message listed after the script.  Do you see what I'm missing?

    <gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
      xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="jelly:sql"
      xmlns:xog="http://www.niku.com/xog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <!--Parameters section-->
      <!--    <gel:parameter default="http://vmslcniku01.regence.com:80" var="XOGURL"/>-->
      <!--    <gel:parameter default="http://vmslcclarity02.regence.com:80" var="XOGURLSANDBOX"/>-->
      <!--    <gel:parameter default="http://vmslcniku01.regence.com:80" var="XOGURLTEST"/>-->
      <!--    <gel:parameter default="http://mslcclarity04.regence.com:80" var="XOGURLQA"/>-->
      <!--    <gel:parameter default="http://mslcclarity02.regence.com:80" var="XOGURLPROD"/>-->
      <gel:parameter default="admin" var="XOGUsername"/>
      <gel:parameter default="admin" secure="true" var="XOGPassword"/>
      <!--End Parameters Section-->
      <!-- Only used with GEL Serialize command at end -->
      <gel:parameter default="./outputfiles" var="PLocalDirectory"/>
      <!--vnow used for output file-->


    <!--  <core:set var="vnow">
        <gel:formatDate format="MMddyy"/>
      </core:set>-->
      <!-- Only used with GEL Serialize command at end -->

      <!--
      Update Project (ODF_CA_PROJECT.trg_itinitialest) from (RITS Total Hours: ODF_CA_INV.trg_rits_hours) on Project Create
     
     
     
      -->
     
     
      <!-- ****************************************GET THE XOG URL FROM THE APPLICATION **********************************************-->
      <gel:parse file="../config/properties.xml" var="properties"/>
      <gel:set asString="true" select="$properties/properties/webServer/@schedulerUrl" var="EntryURL"/>
      <core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="config"/>
      <core:set value="0" var="v_IsLocal"/>
      <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getId()}" var="WebServerid"/>
      <core:if test="${WebServerid == 'app'}">
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getAddress()}" var="AddressIp"/>
        <!-- Replaced "EntryURL" from the Properties.xml file with "scheduler entry url" from Properties.xml file -->
        <!--      <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getEntryUrl()}" var="EntryURL"/>-->
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getPort()}" var="Port"/>
        <core:if test="${EntryURL == 'http://localhost'}">
          <gel:log level="INFO" message="NULL ADDRESS IS LOCAL... "/>
          <core:set value="1" var="v_IsLocal"/>
          <core:set value="${EntryURL}" var="AddressIp"/>
        </core:if>
      </core:if>
      <core:if test="${WebServerid == 'nsa'}">
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getAddress()}" var="AddressIp"/>
        <!-- Replaced "EntryURL" from the Properties.xml file with "scheduler entry url" from Properties.xml file -->
        <!--      <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getEntryUrl()}" var="EntryURL"/>-->
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getPort()}" var="Port"/>
        <core:if test="${EntryURL == 'http://localhost' }">
          <gel:log level="INFO" message="NULL ADDRESS IS LOCAL... "/>
          <core:set value="1" var="v_IsLocal"/>
          <core:set value="${EntryURL}" var="AddressIp"/>
        </core:if>
      </core:if>
      <core:if test="${Port != null }">
        <core:set value="${EntryURL}:${Port}" var="EntryURL"/>
      </core:if>
      <core:if test="${v_IsLocal == 0 }">
        <core:if test="${AddressIp != '' }">
          <core:set value="http://${AddressIp}" var="EntryURL"/>
        </core:if>
      </core:if>
      <gel:log level="INFO">EntryURL: "${EntryURL}"</gel:log>
      <!--Set value for XOGURLAUTO (auto detected using above code)-->
      <core:set value="${EntryURL}/niku/xog" var="XOGURLAUTO"/>
      <!-- ***************************************END GET XOG URL ***********************************-->
      <gel:log level="INFO">Make sure environment is correct: XOGURLAUTO: "${XOGURLAUTO}"</gel:log>
      <!-- Log into XOG first. -->
      <!--original    <soap:invoke endpoint="${XOGURL}/niku/xog" var="auth">-->
      <soap:invoke endpoint="${XOGURLAUTO}" var="auth">
        <soap:message>
          <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
            <soap-env:Header/>
            <soap-env:Body>
              <xog:Login>
                <xog:Username>${XOGUsername}</xog:Username>
                <xog:Password>${XOGPassword}</xog:Password>
              </xog:Login>
            </soap-env:Body>
          </soap-env:Envelope>
        </soap:message>
      </soap:invoke>
      <!-- Checking whether a sessionID is returned.  If not, it means that Login was not successful. -->
      <gel:set asString="true" select="$auth/SOAP-ENV:Envelope/SOAP-ENV:Body/xog:SessionID/text()" var="sessionID"/>
      <core:choose>
        <core:when test="${sessionID == null}">
          <gel:log level="ERROR">Cannot login to Clarity XOG. Check username and password.</gel:log>
          <gel:log level="INFO">Department XOG not Completed. </gel:log>
        </core:when>
        <core:otherwise>

       <gel:setDataSource dbId="niku"/>

    <!--  <core:set var="vnow">
        <gel:formatDate format="MMddyy"/>
      </core:set>-->
      <!-- Only used with GEL Serialize command at end -->

      <core:set value="${gel_objectInstanceId}" var="v_proj_id"/>
      <gel:log level="INFO">v_proj_id ${v_proj_id}</gel:log>


    <!--  Your Code Here -->
    <!-- Query-->
    <!--Query to pull Change Request and ID for Change Request -->

    <!-- v_data for XOG data -->
    <sql:query var="v_data">
    SELECT
    P.PRID,
    P.PRUID,
    I.CODE,
    I.NAME

    , NVL(CP.TRG_ITINITIALEST,0) ITINITIALEST
    , NVL(OCI.TRG_RITS_HOURS,0) RITS_HOURS
    --, OCI.TRG_APP_NT_ST_DT
    --, OCI.TRG_WIP_DATE
    --, OCI.TRG_IN_TEAM_REVDT
    --, OCI.TRG_EST_IN_PROC
    FROM
    PRJ_PROJECTS P
    INNER JOIN SRM_PROJECTS SP ON P.PRID = SP.ID
    INNER JOIN ODF_CA_PROJECT CP ON P.PRID = CP.ID
    INNER JOIN INV_INVESTMENTS I ON P.PRID = I.ID
    INNER JOIN ODF_CA_INV OCI ON I.ID = OCI.ID

    where I.ID = ${v_proj_id}

    </sql:query>

    <core:choose>
    <gel:log level="INFO">PRID ${v_data.rows[0].PRID}</gel:log>
    <gel:log level="INFO">PRUID ${v_data.rows[0].TRG_ITINITIALEST}</gel:log>
    <gel:log level="INFO">CODE ${v_data.rows[0].I.CODE}</gel:log>
    <gel:log level="INFO">NAME ${v_data.rows[0].I.NAME}</gel:log>
    <gel:log level="INFO">TRG_ITINITIALEST ${v_data.rows[0].ITINITIALEST}</gel:log>
    <gel:log level="INFO">TRG_RITS_HOURS ${v_data.rows[0].RITS_HOURS}</gel:log>
    <gel:log level="INFO">TRG_APP_NT_ST_DT ${v_data.rows[0].TRG_APP_NT_ST_DT}</gel:log>
    <gel:log level="INFO">TRG_WIP_DATE ${v_data.rows[0].TRG_WIP_DATE}</gel:log>
    <gel:log level="INFO">TRG_IN_TEAM_REVDT ${v_data.rows[0].TRG_IN_TEAM_REVDT}</gel:log>
    <gel:log level="INFO">TRG_EST_IN_PROC ${v_data.rows[0].TRG_EST_IN_PROC}</gel:log>

    <core:when test="${v_data.rows[0].TRG_ITINITIALEST != v_data.rows[0].TRG_RITS_HOURS}">

                <gel:parse var="xogBody">
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="13.3.0.286"/>
    <Projects>
      <Project entityCode="Regence" name="${v_data.rows[0].I.NAME}" projectID="${v_data.rows[0].I.CODE}">
      <CustomInformation>
    <ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>

    <!-- <ColumnValue name="trg_app_nt_st_dt">2015-01-01T00:00:00</ColumnValue>-->
    <!-- <ColumnValue name="trg_wip_date">2015-01-01T00:00:00</ColumnValue>-->
    <!-- <ColumnValue name="trg_in_team_revdt">2015-01-01T00:00:00</ColumnValue>-->
    <!-- <ColumnValue name="trg_est_in_proc">2015-01-01T00:00:00</ColumnValue>-->

    <!-- <ColumnValue name="trg_rits_hours">10</ColumnValue>-->
    <ColumnValue name="trg_itinitialest">${v_data.rows[0].ITINITIALEST}</ColumnValue>
    </CustomInformation>
    </Project>
    </Projects>
    </NikuDataBus>
                </gel:parse>

     


    </core:when>
    </core:choose>

        </core:otherwise>

        <!--<gel:serialize fileName="${PLocalDirectory}/XOG_Department_${vnow}.xml" var="${xogBody}"/>-->
        <!--<<<<<<<<<<<<<< XOG VALUES>>>>>>>>>>>>>>>>>>>-->
        <!-- Send a XOG request. -->
        <gel:log level="INFO">Sending XOG Request.</gel:log>
        <soap:invoke endpoint="${XOGURLAUTO}" var="result">
          <soap:message>
            <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
              <soap-env:Header>
                <xog:Auth>
                  <xog:SessionID>${sessionID}</xog:SessionID>
                </xog:Auth>
              </soap-env:Header>
              <soap-env:Body>
                <gel:include select="$xogBody"/>
              </soap-env:Body>
            </soap-env:Envelope>
          </soap:message>
        </soap:invoke>
        <gel:set asString="true" select="$result/SOAP-ENV:Envelope/SOAP-ENV:Body/XOGOutput/Status/@state" var="xogStatus"/>
        <gel:set asString="true" select="$result/SOAP-ENV:Envelope/SOAP-ENV:Body/XOGOutput/Statistics/@insertedRecords" var="inserted"/>
        <gel:set asString="true" select="$result/SOAP-ENV:Envelope/SOAP-ENV:Body/XOGOutput/Statistics/@updatedRecords" var="updated"/>
        <gel:log level="INFO">XOG status is "${xogStatus}". </gel:log>
        <gel:log level="INFO">XOG Inserted:  "${inserted}". </gel:log>
        <gel:log level="INFO">XOG Updated:  "${updated}". </gel:log>
        <!-- Logout XOG -->
        <soap:invoke endpoint="${XOGURLAUTO}" var="result">
          <soap:message>
            <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
              <soap-env:Header>
                <xog:Auth>
                  <xog:SessionID>${sessionID}</xog:SessionID>
                </xog:Auth>
              </soap-env:Header>
              <soap-env:Body>
                <xog:Logout/>
              </soap-env:Body>
            </soap-env:Envelope>
          </soap:message>
        </soap:invoke>
      </core:choose>
      <gel:log level="INFO">Number of rows to process is -- ${v_toprocess.rows[0].num}</gel:log>
      <gel:log level="INFO">ITINITIALEST xog: Finished</gel:log>
    </gel:script>

     

     

     

     

    Error message:

    BPM-0704: An error occurred while executing custom script: org.apache.commons.jelly.JellyTagException: null:184:45: <gel:include> java.lang.NullPointerException at org.apache.commons.jelly.impl.TagScript.handleException(TagScript.java:671) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:259) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:102) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:102) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at com.niku.union.gel.tags.soap.SOAPTagSupport.parseBody(SOAPTagSupport.java:68) at com.niku.union.gel.tags.soap.MessageTag.doTag(MessageTag.java:38) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at com.niku.union.gel.tags.soap.InvokeTag.doTag(InvokeTag.java:65) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:38) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) at com.niku.union.gel.GELScript.run(GELScript.java:48) at com.niku.union.gel.GELController.invoke(GELController.java:74) at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:207) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.NullPointerException at com.niku.union.gel.tags.IncludeTag.doTag(IncludeTag.java:49) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) ... 31 more Root cause java.lang.NullPointerException at com.niku.union.gel.tags.IncludeTag.doTag(IncludeTag.java:49) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:102) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:102) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at com.niku.union.gel.tags.soap.SOAPTagSupport.parseBody(SOAPTagSupport.java:68) at com.niku.union.gel.tags.soap.MessageTag.doTag(MessageTag.java:38) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186) at com.niku.union.gel.tags.soap.Invoke...



  • 2.  Re: GEL: XOG error message

    Posted Oct 15, 2015 10:58 PM

    This looks familiar!

     

    Try replacing your:

     

    <gel:include select="$xogBody"/>
    
    

     

    With

     

    <gel:include select="$xogBody/NikuDataBus"/>
    
    

     

     

    $xogBody is the document and the select is looking for an xPath.

     

    V/r,

    Gene



  • 3.  Re: GEL: XOG error message
    Best Answer

    Posted Oct 16, 2015 12:29 PM

    Hi Gene,

    Oh man, I totally missed my Query results in the XOG.

     

    <Project entityCode="Regence" name="${v_data.rows[0].I.NAME}" projectID="${v_data.rows[0]I.CODE}">

     

     

     

     

    The results of the "rows" doesn't need the Alias for the tables.  Once I changed the above references to fields with this:

     

    <Project entityCode="Regence" name="${v_data.rows[0].NAME}" projectID="${v_data.rows[0].CODE}">

     

    This was the cause of the problem.



  • 4.  Re: GEL: XOG error message

     
    Posted Oct 16, 2015 01:23 PM

    Hi Lowell - So was this the Correct Answer to you problem? Thanks, Chris

    Lowell Wetzel wrote:

     

    Hi Gene,

    Oh man, I totally missed my Query results in the XOG.

     

    <Project entityCode="Regence" name="${v_data.rows[0].I.NAME}" projectID="${v_data.rows[0]I.CODE}">

     

     

     

     

    The results of the "rows" doesn't need the Alias for the tables.  Once I changed the above references to fields with this:

     

    <Project entityCode="Regence" name="${v_data.rows[0].NAME}" projectID="${v_data.rows[0].CODE}">

     

    This was the cause of the problem.



  • 5.  Re: GEL: XOG error message

    Posted Oct 16, 2015 04:14 PM

    I'm glad Lowell spotted his problem, but just on the gel:include usage, a variable with an XML document is a valid input also.  You don't have to select a nodeset for it (unless you want to for some other reason).



  • 6.  Re: GEL: XOG error message

    Posted May 03, 2018 12:36 PM

    Hi Nick,

    Could you give an example of a variable with an XML document? I'm always willing to try different approaches.

    Thanks,

    Lowell



  • 7.  Re: GEL: XOG error message

    Posted May 09, 2018 11:41 AM

    Hi Lowell,

     

    What I was saying back then is that your original gel include tag was fine, it did not need to be changed.  Yours was valid as it was without needing or adding the additional selector Gene suggested in this case.

     

    There may be use cases where you do want to select more specifically or deeply into an XML document variable, but if you just want 'everything' then you can just leave it at the variable name (as you had it).

     

    -Nick



  • 8.  Re: GEL: XOG error message

    Posted May 03, 2018 06:12 AM

    <!-- Create Application Project -->
    <soap:invoke endpoint="${XOGURL}/niku/xog" var="xog_out_xml">
    <soap:message>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
    <soapenv:Header>
    <xog:Auth>
    <xog:SessionID>${sessionID}</xog:SessionID>
    </xog:Auth>
    </soapenv:Header>
    <soapenv:Body>
    <gel:include select="$xog_write_xml"/>
    </soapenv:Body>
    </soapenv:Envelope>
    </soap:message>
    </soap:invoke>
    <!-- Check the XOG Result -->
    <core:set value="0" var="v_xog_exception_count"/>
    <gel:set select="$xog_out_xml/soapenv:Envelope/soapenv:Body/XOGOutput" var="writeOutputRoot"/>
    <gel:set asString="true" select="$writeOutputRoot/Status/@state" var="XOGoutcome"/>
    <gel:set asString="true" select="$writeOutputRoot/Records" var="XOGoutputrecords"/>
    <gel:set asString="true" select="$writeOutputRoot/Statistics" var="XOGstats"/>
    <gel:set asString="true" select="$writeOutputRoot/Statistics/@totalNumberOfRecords" var="XOGtotalrecords"/>
    <gel:set asString="true" select="$writeOutputRoot/Statistics/@insertedRecords" var="XOGinsertedrecords"/>
    <gel:set asString="true" select="$writeOutputRoot/Statistics/@updatedRecords" var="XOGupdatedrecords"/>
    <gel:set asString="true" select="$writeOutputRoot/Statistics/@failureRecords" var="XOGfailurerecords"/>
    <gel:log trim="false">XOG Status: ${XOGoutcome} || Total: ${XOGtotalrecords} || Inserted: ${XOGinsertedrecords} || Updated: ${XOGupdatedrecords} || Failed: ${XOGfailurerecords}</gel:log>
    <core:switch on="${XOGoutcome}">
    <core:case value="SUCCESS">
    <gel:log level="INFO">Project Create Successfully from Template: ${PrjTemplate}</gel:log>
    <gel:forEach select="$xog_out_xml//XOGOutput//Record//ErrorInformation[Severity='WARNING']/parent::node()" var="xml_warning">
    <gel:log level="WARN" trim="true">XOG Output - WARNING: <gel:expr select="$xml_warning/ErrorInformation/Description/text()"/>
    </gel:log>
    <core:set value="${v_xog_exception_count+1}" var="v_xog_exception_count"/>
    </gel:forEach>
    <core:if test="${v_xog_exception_count != '0'}">
    <gel:log level="INFO">XOG Input: <gel:expr select="$xog_write_xml"/>
    </gel:log>
    </core:if>