Hi,
I'm not sure where to start with this. Upon execution of my script, I get the following error in the output file:
--Internal error: file:C:/xog/astmis/test02.xml:24:56 <soap:invoke> Failed to send a SOAP message generated to 'http://localhost/niku/xog'. HTTP Error: Status-Code: 500: Internal Server Error
I have provided a modified (for security reasons) version of the code
I am trying to extract data from an input file and import it into clarity. We are running v13.2. Previously, there was a working code that we used to import data into v12.1, but that obviously does not work with v13.2. Currently my code is a combination of the new 13.2 code found in the clarity documentation, and the old v12 code that must be reused. I am not very familiar with XML, as this is my first time having to construct code.
<?xml version="1.0" encoding="utf-8"?>
<gel:script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xog="http://www.niku.com/xog" xmlns:sql="jelly:sql" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:core="jelly:core" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<!-- XOG URL INPUT -->
<gel:parameter var="XOGURL" default="http://localhost"/>
<!-- XOG USERNAME INPUT -->
<gel:parameter var="XOGUsername" default="***"/>
<!-- XOG PASSWORD INPUT -->
<gel:parameter var="XOGPassword" default="***" secure="true"/>
<!-- Log into XOG and get a session ID -->
-<soap:invoke var="auth" endpoint="${XOGURL}/niku/xog">
-<soap:message>
-<soapenv:Envelope xmlns:xog="http://www.niku.com/xog" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<!-- START SOAP-ENV BODY -->
-<soapenv:Body>
-<xog:Login>
<xog:Username>${XOGUsername}</xog:Username>
<xog:Password>${XOGPassword}</xog:Password>
</xog:Login>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
<!-- Checking whether a sessionID is returned. If not, it means that Login was unsuccessful -->
<gel:set var="sessionID" select="$auth/SOAP-ENV:Envelope/SOAP-ENV:Body/xog:SessionID/text()" asString="true"/>
-<core:choose>
-<core:when test="${sessionID == null}">
<gel:out>Couldn't Log in. Check the username/password.</gel:out>
</core:when>
<core:otherwise/>
</core:choose>
<!--Run XOG and attach an input file...alternatively the Body section can be the NikuDatabus section of an input file-->
-<soap:invoke var="runresult" endpoint="${XOGURL}/niku/xog">
-<soap:message>
-<soapenv:Envelope xmlns:xog="http://www.niku.com/xog" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
-<soapenv:Header>
-<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
-<soapenv:Body>
<gel:parse var="xmlindoc" file="C:\xog\astmis\20130805.txt"/>
<gel:include select="$xmlindoc"/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
<!--THIS IS THE ORIGINAL CODE -->
<!-- <gel:forEach select="$runresult/SOAP-ENV:Envelope/SOAP-ENV:Body/NikuDataBus/Resources/Resource" var="outputnode"> <gel:out><gel:expr select="$outputnode/PersonalInformation/@displayName"/></gel:out> </gel:forEach> -->
<!-- THIS IS THE INTEGRATED CODE -->
-<core:forEach var="col" step="1" begin="1" indexVar="i" items="${infileParsed.rows}">
<core:set var="PE" value="${col[1]}"/>
<core:set var="PROJECT" value="${col[2]}"/>
<core:set var="TASK" value="${col[3]}"/>
-
-<soap:invoke var="XOG_result" endpoint="${XOGURL}/niku/xog">
-
-<soap:message>
<!-- ERROR: Cannot view XML input using XSL style sheet. - <soap-env: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>
-
<!-- ================================================= -->
-
<!-- Insert your XOG out format for your custom object -->
-
<!-- ================================================= -->
-
<!-- 04/17/2012 NikuDataBus -->
-
-<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
<Header version="12.1.1.1208" objectType="customObjectInstance" externalSource="NIKU" action="write"/>
-
-<customObjectInstances objectCode="r_astmis">
-
-<instance objectCode="r_astmis" instanceCode="${PE}.${PROJECT}.${TASK}">
-
-<CustomInformation>
<ColumnValue name="code">${PE}.${PROJECT}.${TASK}</ColumnValue>
<ColumnValue name="name">${PE}.${PROJECT}.${TASK}</ColumnValue>
<ColumnValue name="pe">${PE}</ColumnValue>
<ColumnValue name="project">${PROJECT}</ColumnValue>
<ColumnValue name="task">${TASK}</ColumnValue>
</CustomInformation>
<OBSAssocs completed="false"/>
-
-<Security>
<UserSecurity userName="***" rightCode="odf_cst_r_astmis_edit"/>
</Security>
</instance>
</customObjectInstances>
</NikuDataBus>
</soapenv:Body>
</soap:message>
</soap:invoke>
<!-- END INTEGRATED CODE -->
<!-- Read the output and extract some information from it -->
<gel:set var="XOGoutcome" select="$runresult/SOAP-ENV:Envelope/SOAP-ENV:Body/NikuDataBus/XOGOutput/Status/@state" asString="true"/>
-<core:switch on="${XOGoutcome}">
-<core:case value="SUCCESS">
<gel:set var="stats" select="$runresult/SOAP-ENV:Envelope/SOAP-ENV:Body/NikuDataBus/XOGOutput/Statistics" asString="false"/>
-<gel:out>
Success! Total number of records:
<gel:expr select="$stats/@totalNumberOfRecords"/>
</gel:out>
</core:case>
-<core:case value="FAILURE">
<gel:set var="stats" select="$runresult/SOAP-ENV:Envelope/SOAP-ENV:Body/NikuDataBus/XOGOutput/Statistics" asString="false"/>
-<gel:out>
XOG failed. Out of
<gel:expr select="$stats/@totalNumberOfRecords"/>
records,
<gel:expr select="$stats/@failureRecords"/>
failed.
</gel:out>
</core:case>
-<core:default>
<gel:out>Couldn't find XOG output summary. Please check the output file manually.</gel:out>
</core:default>
</core:switch>
</core:forEach>
<!-- Log out of the XOG -->
-<soap:invoke var="logoutresult" endpoint="${XOGURL}/niku/xog">
-<soap:message>
-<soapenv:Envelope xmlns:xog="http://www.niku.com/xog" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
-<soapenv:Header>
-<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
-<soapenv:Body>
<xog:Logout/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</gel:script>