AnsweredAssumed Answered

Read XML from Databse in GEL Script

Question asked by Rob-BBT on Oct 14, 2014
Latest reply on Nov 3, 2014 by Rob-BBT

I think I've seen a similar issue posted but wasn't sure if a resolution has ever been found.

 

Basically, I'm trying to create a process that has a GEL script that XOG's in a Resource Management OBS.

 

There is a stored procedure that we wrote that builds the OBS based on the current resource management hierarchy and stores the complete XOG XML in a database field.   I have tried setting the type on this field to both nvarchar and xml.

 

I want the GEL script to read the value from the DB and insert it as XML within the SOAP Body.

 

Essentially I want to do this:

 

<soap:invoke endpoint="internal" var="result">

  <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>

       ${resOBSXOGFile}     

      </soapenv:Body>

    </soapenv:Envelope>

  </soap:message>

</soap:invoke>

 

OR

 

<soap:invoke endpoint="internal" var="result">

  <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="$resOBSXOGFile" /> 

      </soapenv:Body>

    </soapenv:Envelope>

  </soap:message>

</soap:invoke>

 

But it apparently treats $resOBSXOGFile as a string and generates the error: java.lang.String cannot be cast to org.w3c.dom.Node

 

I've also tried just iterating through the records from a sql query within the gel script within a gel:parse, but it doesn't like that becasue the OBS code gets generated dynamically so it complains that the <obs> tag doesn't match the ending </unit> tag becasue of the dynamic nature of it.

 

So I feel like the best bet is the above solution if there is some way for the the gel script to recognize the value as XML and not string.

Outcomes