AnsweredAssumed Answered

Gel Scripting Documents

Question asked by JorgeMedina4201248 on Feb 22, 2012
Latest reply on Feb 22, 2012 by fpena
Dear Support

I need to execute a XOG:Write from gel, But always retuns me an error: document null. I dont understand and I really need help. I have this XOG:Write and this Gel

Anyone please I need help!

XOG:WRITE
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_document.xsd">
<Header action="write" externalSource="OS" objectType="document" version="12.1.0.5840" />
<Documents>
<Parent parentObjectId="5015306" parentObjectType="NAME" documentLocation="C:\une">
<General addedBy="admin" addedDate="2012-01-01" />

<Folder name="Project Management" hasAllParticipants="0" allowNonParticipants="1"/>
</Parent>
</Documents>
</NikuDataBus>

GEL SCRIPT
<gel:script
xmlns:x="jelly:xml"
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:quer="http://www.niku.com/xog/Query"
xmlns:sql="jelly:sql"
xmlns:util="jelly:util"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary">

<gel:log level="DEBUG">


<![CDATA[EMPIEZAAA]]>


<![CDATA[OJALA SALGA!!!]]>
</gel:log>
<gel:parameter var="hostname" default="https://cppm2040.ondemand.ca.com/niku/xog"/>
<gel:parameter var="username" default="admin"/>
<gel:parameter var="password" default="ITsg2080" secure="false"/>
<gel:parameter var="cod_query" default="query_wsdl"/>
<gel:parameter var="XOGURL" default="http://localhost:8093/niku/xog"/>
<gel:parameter var="input" default="D:\Clients\xog\xml\documents_write_ext.xml"/>
<gel:parameter var="Filestore" default="D:\une"/>


<gel:log level="DEBUG">
<![CDATA[*************Atributos*************]]>
</gel:log>


<gel:log level="DEBUG">
<![CDATA[Webservice : ${hostname}]]>
</gel:log>
<gel:log level="DEBUG">
<![CDATA[User       : ${username}]]>
</gel:log>

<gel:log level="DEBUG">



<![CDATA[Password   : ${password}]]>
</gel:log>
<gel:log level="DEBUG">



<![CDATA[********LOGIN********]]>
</gel:log>
<soap:invoke endpoint="${hostname}" var="auth">


<soap:message>



<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<quer:Login>
<quer:Username>${username}</quer:Username>
<quer:Password>${password}</quer:Password>
</quer:Login>
</soapenv:Body>
</soapenv:Envelope>


</soap:message>

</soap:invoke>

<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/xog:SessionID/text()" var="sessionID"/>

<gel:out>SessionID = ${sessionID}</gel:out>


<gel:log level="DEBUG">
<![CDATA[Atributos...]]>

</gel:log>


<gel:log level="DEBUG">


<![CDATA[Session ID = ${sessionID}]]>

</gel:log>


<gel:log level="DEBUG">


<![CDATA[*************Llamar query WSDL*************]]>

</gel:log>


<soap:invoke endpoint="${hostname}" var="auth">


<soap:message>



<soapenv:Envelope>
<soapenv:Header>
<quer:Auth>
<quer:SessionID>${sessionID}</quer:SessionID>
<quer:Username>${username}</quer:Username>
<quer:Password>${password}</quer:Password>
</quer:Auth>
</soapenv:Header>
<soapenv:Body>
<quer:Query>
<quer:Code>${cod_query}</quer:Code>
</quer:Query>
</soapenv:Body>
</soapenv:Envelope>


</soap:message>


</soap:invoke>

<gel:log level="DEBUG">
<![CDATA[*************Atributos del webservice*************]]>



</gel:log>


<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/quer:QueryResult/quer:Records/quer:Record/quer:id/text()" var="query_id"/>
<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/quer:QueryResult/quer:Records/quer:Record/quer:description/text()" var="query_des"/>
<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/quer:QueryResult/quer:Records/quer:Record/quer:name/text()" var="query_name"/>

<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/quer:QueryResult/quer:Records/quer:Record/quer:code/text()" var="query_code"/>



<gel:log level="DEBUG">


<![CDATA[********************************************************]]>

</gel:log>

<gel:log level="DEBUG">
<![CDATA[Atributos...]]>


<![CDATA[Query ID   = ${query_id}]]>
<![CDATA[Query Des  = ${query_des}]]>

<![CDATA[Query Name = ${query_name}]]>

<![CDATA[Query Code = ${query_code}]]>



</gel:log>



<gel:log level="DEBUG">


<![CDATA[********************************************************]]>

</gel:log>



<gel:log level="DEBUG">


<![CDATA[***************SQL***************]]>

</gel:log>



<gel:setDataSource dbId="niku" var="dataSource"/>
<!-- get the handler ID for the action item -->

<!-- update the value for the approver ID -->
<sql:update dataSource="${dataSource}">

UPDATE niku.ODF_CA_PROJECT
SET QUERY_ID = ?,
DES = ?,
NOMBRE = ?,
CODIGO = ?
WHERE ID = 5005052

<sql:param value="${query_id}"/>
<sql:param value="${query_des}"/>

<sql:param value="${query_name}"/>

<sql:param value="${query_code}"/>

</sql:update>

<!-- Saco el ID de la carpeta -->

<sql:query var="var" dataSource="${dataSource}">

SELECT fld.id id
FROM niku.CLB_DMS_FOLDERS FLD
WHERE FLD.NAME = 'Project Management' --Nombre del folder
AND fld.parent_folder_id = (SELECT fol.id ID
FROM niku.SRM_PROJECTS PRJ, niku.CLB_DMS_FOLDERS FOL
WHERE PRJ.ID = FOL.ASSOC_OBJ_ID
AND FOL.ASSOC_OBJ_ID = 5005052 -- ID del proyecto
AND fol.assoc_obj_type = 'Projects')

</sql:query>



<core:forEach items="${var.rows}" trim="true" var="data">
<gel:parameter var="folderID" default="${data.id}"/>
</core:forEach>



<gel:log level="DEBUG">


<![CDATA[folderID = ${folderID}]]>

</gel:log>



<gel:log level="DEBUG">


<![CDATA[***************SQL***************]]>

</gel:log>



<util:available uri="file:///C:/une/ejemplo2.docx">
<gel:log level="DEBUG">


<![CDATA[***************Archivo Existe***************]]>

</gel:log>


</util:available>



<gel:log level="DEBUG">


<![CDATA[***************FILE***************]]>

</gel:log>


<soap:invoke endpoint="${XOGURL}" var="result">
<soap:message>
<soapenv:Envelope>
<soapenv:Body>
<xog:Login>
<xog:Username>${username}</xog:Username>
<xog:Password>${password}</xog:Password>
</xog:Login>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_document.xsd">
<Header action="write" externalSource="OS" objectType="document" version="12.1.0.5840" />
<Documents>
<Parent parentObjectId="${folderID}" parentObjectType="NAME" documentLocation="C:\une">
<General addedBy="admin" addedDate="2012-01-01" />

<Folder name="Project Management" hasAllParticipants="0" allowNonParticipants="1"/>
</Parent>
</Documents>
</NikuDataBus>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>



<gel:log level="DEBUG">


<![CDATA[XOG_Result = ${result}]]>

</gel:log>[color]



<gel:log level="DEBUG">


<![CDATA[***************FILE***************]]>

</gel:log>



<gel:log level="DEBUG">


<![CDATA[********************************************************]]>

</gel:log>



<sql:update dataSource="${dataSource}">

commit

</sql:update>


<gel:log level="DEBUG">


<![CDATA[******************LOGOUT************************]]>

</gel:log>
<soap:invoke endpoint="${hostname}" var="logout">


<soap:message>



<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<quer:Logout>
<quer:SessionID>${sessionID}</quer:SessionID>
</quer:Logout>
</soapenv:Body>
</soapenv:Envelope>


</soap:message>

</soap:invoke>

<gel:log level="DEBUG">


<![CDATA[********************************************************]]>

</gel:log>

<gel:log level="DEBUG">
<![CDATA[LOGOUT...]]>
</gel:log>

<gel:log level="DEBUG">


<![CDATA[********************************************************]]>

</gel:log>
</gel:script>

Outcomes