AnsweredAssumed Answered

Failed to send SOAP Message

Question asked by MichelleSergeant82220975 on Jun 27, 2016
Latest reply on Jul 4, 2016 by gcubed

Hi All,

 

I am new to gel scripting in a cloud environment and am trying to set up script that will copy data from the project object to a custom object.

I have a gel script which contains the sql to pull together the data I need between the project object and our custom object (funding).. The process is kicked off via an action but fails with the following message..

 

BPM-0704: An error occurred while executing custom script: org.apache.commons.jelly.JellyTagException: null:170:66: <soap:invoke> Failed to send a SOAP message generated to 'https://cppm6124-dev.ondemand.ca.com:14001/niku/xog'.No route to host at com.niku.union.gel.tags.soap.InvokeTag.doTag(InvokeTag.java:76) 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.IfTag.doTag(IfTag.java:42) 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.IfTag.doTag(IfTag.java:42) 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:67) 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:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.NoRouteToHostException: No route to host at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1282) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1257) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) at com.niku.union.xml.SimpleSOAPMessage.processRequest(SimpleSOAPMessage.java:306) at com.niku.union.xml.SimpleSOAPMessage.send(SimpleSOAPMessage.java:88) at com.niku.union.xml.SimpleSOAPMessage.send(SimpleSOAPMessage.java:63) at com.niku.union.gel.tags.soap.InvokeTag.doTag(InvokeTag.java:72) ... 19 more Root cause java.net.NoRouteToHostException: No route to host at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Soc...

 

I have been using a template gel script provided by CA, which is below.. I have commented out the section on port number as per advice from CA, as I was receiving a similar error when this was in place..

 

<gel:script 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: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">

<gel:setDataSource dbId="Niku"/>
   
<!-- Initialise Variables -->
    <core:set var="v_errorFlag">false</core:set>

    <!-- Retrieve the username of the XOG user from the Code Constants table -->
    <core:catch var="v_exception">
        <sql:query var="v_queryXogUserId">
            SELECT d_value
            FROM odf_ca_d_code_const
            WHERE code ='xoguser'
         </sql:query>
    </core:catch>
    <core:if test="${v_exception != null and v_queryXogUserId.rowCount == 0}">
        <core:set value="true" var="v_errorFlag"/>
        <gel:out>[SQL] Unable to retrieve XOG USER ID from the Database: ${v_exception}</gel:out>
        <gel:log category="SQL" level="ERROR">Unable to retrieve XOG USER ID from the database: ${v_exception}</gel:log>
    </core:if>
    <core:if test="${v_errorFlag==false}">
        <core:set var="v_xogUserId">${v_queryXogUserId.rows[0].d_value}</core:set>
    </core:if>

    <!-- Retrieve a Session ID to be sent with the XOG package as authentication -->
    <core:if test="${v_errorFlag == false}">
        <core:catch var="v_exception">
           
   <!--Invoke class instances-->
            <core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="v_secId"/>
            <core:invokeStatic className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" var="userSessionCtrl"/>
            <!--Log into clarity by initialising class instance-->
            <core:set value="${userSessionCtrl.init(v_xogUserId, v_secId)}" var="v_secId"/>
            <core:set value="${v_secId.getSessionId()}" var="v_thisSessionId"/>
        </core:catch>
        <core:if test="${v_exception!=null}">
            <core:set value="true" var="v_errorFlag"/>
            <gel:out>[GEL] Unable to retrieve a Session ID: ${v_exception}</gel:out>
            <gel:log category="GEL" level="ERROR">Unable to retrieve a Session ID: ${v_exception}</gel:log>
        </core:if>
    </core:if>
   
<!--Retrieve the clarity application server URL-->
    <core:if test="${v_errorFlag == false}">
        <core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="v_config"/>
        <!--Always use Scheduler URL first-->
        <core:set value="${v_config.getProperties().getWebServer().getSchedulerUrl()}" var="v_clarityURL"/>
        <!--If Scheduler URL is not set use the Application Server Entry URL-->
        <core:if test="${v_clarityURL == ''}">
            <core:switch on="${v_config.getProperties().getWebServer().getWebServerInstance(0).getId()}">
                <core:case value="nsa">
                    <core:set
                        value="${v_config.getProperties().getWebServer().getWebServerInstance(1).getEntryUrl()}" var="v_entryURL"/>
                </core:case>
                <core:default>
                    <core:set
                        value="${v_config.getProperties().getWebServer().getWebServerInstance(0).getEntryUrl()}" var="v_entryURL"/>
                </core:default>
            </core:switch>
            <core:set value="${v_entryURL}" var="v_clarityURL"/>
        </core:if>
        <util:tokenize delim=":" var="v_urlComponents">${v_clarityURL}</util:tokenize>
        <core:set value="${v_urlComponents.get(0)}://" var="v_httpMethod"/>
        <core:set value="${v_urlComponents.get(1)}" var="v_serverName"/>
        <util:tokenize delim="/" var="v_serverName">${v_serverName}</util:tokenize>
        <core:set value="${v_serverName.get(0)}" var="v_serverName"/>
        <core:set value="${v_urlComponents.get(2)}" var="v_portNumber"/>
        <!--Determine if port number is present in entry URL. If not use App Server Entry port.-->
        <!-- <core:choose>
            <core:when test="${v_portNumber == null}">
                <core:set
                    value="${v_config.getProperties().getWebServer().getWebServerInstance(0).getPort()}" var="v_portNumber"/>
            </core:when>
            <core:otherwise>
                <util:tokenize delim="/" var="v_portNumber">${v_portNumber}</util:tokenize>
                <core:set value="${v_portNumber.get(0)}" var="v_portNumber"/>
            </core:otherwise>
        </core:choose>
        <core:set
            value="${v_httpMethod}${v_serverName}:${v_portNumber}/niku/xog" var="v_clarityURL"/>
    </core:if> -->

    <!-- SQL Query to get Required Attributes for the XOG -->
    <core:if test="${v_errorFlag == false}">
        <core:catch var="v_exception">
            <sql:query var="v_query_result" escapeText="0">  
                SELECT   fu.code,                                       
                F.PLANNED_CST_START, 
                F.PLANNED_CST_CAPITAL_TOTAL,
                F.PLANNED_CST_OPERATING_TOTAL,
                F.PLANNED_CST_TOTAL,
                F.PLANNED_CST_FINISH,
                F.PLANNED_BEN_TOTAL,
                F.PLANNED_NPV,
                F.PLANNED_PAYBACK_PERIOD,
                F.PLANNED_ROI
                FROM niku.FIN_FINANCIALS F,
                niku.INV_INVESTMENTS I,
                niku.odf_ca_f_funding fu
                where i.id = f.id
                and i.id = fu.odf_parent_id                                               
                WHERE fu.id = ${gel_objectInstanceId}     
            </sql:query>
        </core:catch>
        <core:if test="${v_exception != null}">
            <core:set value="true" var="v_errorFlag"/>
            <gel:log category="Select Key Indicators" level="ERROR">Query for Key Indicators attributes failed. Report ${gel_objectInstanceId} Exception: ${v_exception.getMessage()}</gel:log>
        </core:if>
 
    <!-- Store the results of the query into variables --> 
        <core:if test="${v_exception eq null}">
            <core:forEach items="${v_query_result.rowsByIndex}" trim="true" var="row">
                <core:set var="v_fundingID">${row[0]}</core:set>
                <core:set var="v_planned_cst_start">${row[1]}</core:set>
    <core:set var="v_planned_cst_cap_tot">${row[2]}</core:set>
    <core:set var="v_planned_cst_op_tot">${row[3]}</core:set>
    <core:set var="v_planned_cst_tot">${row[4]}</core:set>
    <core:set var="v_planned_cst_finish">${row[5]}</core:set>   
    <core:set var="v_planned_ben_tot">${row[6]}</core:set>
    <core:set var="v_planned_npv">${row[7]}</core:set>
    <core:set var="v_planned_payback_per">${row[8]}</core:set>
    <core:set var="v_planned_roi">${row[9]}</core:set>
            </core:forEach>          
    <!-- Create the XOG Write XML using the variables -->
        <gel:parse var="v_xml_root">
                     
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
     <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="14.4.0.234"/>   
      <customObjectInstances objectCode="f_funding">
       <instance instanceCode="${v_fundingID}" objectCode="f_funding">
        <CustomInformation>
         <ColumnValue name="f_plnd_cost_st">${v_planned_cst_start}</ColumnValue>
         <ColumnValue name="f_pland_cap">${v_planned_cst_cap_tot}</ColumnValue>
         <ColumnValue name="f_plnd_op">${v_planned_cst_op_tot}</ColumnValue>
         <ColumnValue name="f_plnd_cst">${v_planned_cst_tot}</ColumnValue>
         <ColumnValue name="f_pln_cst_fin">${v_planned_cst_finish}</ColumnValue>
         <ColumnValue name="f_pr_fin_be">${v_planned_ben_tot}</ColumnValue>
         <ColumnValue name="f_plnd_npv">${v_planned_npv}</ColumnValue>
         <ColumnValue name="f_plnd_pback_per">${v_planned_payback_per}</ColumnValue>
         <ColumnValue name="f_plnd_roi">${v_planned_roi}</ColumnValue>
        </CustomInformation>
       </instance>
      </customObjectInstances>
    </NikuDataBus>
        </gel:parse>
           
<!-- XOG into Clarity -->
            <core:catch var="v_xog_exception">
                <soap:invoke endpoint="${v_clarityURL}" var="runresult">
                    <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>${v_thisSessionId}</xog:SessionID>
                                </xog:Auth>
                            </soapenv:Header>
                            <soapenv:Body>
                                <gel:include select="$v_xml_root/NikuDataBus"/>
                            </soapenv:Body>
                        </soapenv:Envelope>
                    </soap:message>
                </soap:invoke>
            </core:catch>
            <core:choose>
                <core:when test="${v_xog_exception != null}">
                    <gel:log category="XOG" level="WARNING">XOG to calculate Overall Status failed.</gel:log>
                </core:when>
                <core:otherwise>
                    <!--  Check the XOG result  -->
                    <gel:set
                        select="$runresult/soapenv:Envelope/soapenv:Body/XOGOutput" var="writeOutputRoot"/>
                    <gel:set asString="true"
                        select="$writeOutputRoot/Status/@state" var="XOGoutcome"/>
                    <gel:set asString="true"
                        select="$writeOutputRoot/Records/Record" var="XOGoutputrecords"/>
                    <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 category="Overall Status" level="INFO">Overall Status is: ${v_overallStatus}]</gel:log>
                    <gel:log category="XOG" level="INFO">XOG operation completed [Total ${XOGtotalrecords}, Inserted ${XOGinsertedrecords}, Updated ${XOGupdatedrecords}, Failed ${XOGfailurerecords}]</gel:log>
                </core:otherwise>
            </core:choose>
   
<!--  CLOSE DOWN THE SESSION -->
            <soap:invoke endpoint="${v_clarityURL}" var="logoutresult">
                <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>${v_thisSessionId}</xog:SessionID>
                            </xog:Auth>
                        </soapenv:Header>
                        <soapenv:Body>
                            <xog:Logout/>
                        </soapenv:Body>
                    </soapenv:Envelope>
                </soap:message>
            </soap:invoke>
     <!-- End of XOG Update Code -->
        </core:if>
    </core:if>
</gel:script>

 

 

Any ideas where I might be going wrong? All suggestions would be most appreciated.

Thanks

Michelle

Outcomes