Clarity

 View Only
  • 1.  Passing Parameters when Invoking a Process via SOAP

    Posted Apr 26, 2019 12:26 AM

    Is there a way to pass parameters when invoking a process via a SOAP call?

     

    I have a Clarity process that runs a gel script and it takes the project ID as a parameter called p_projectID.

     

    At the moment, when I pass the SOAP call below, the process is successfully triggered in Clarity, but it does not use the value provided for p_projectID. My guess it I'm using the <request> tag incorrectly, but I haven't found a guide yet.

     

    Any tips would be appreciated!

     

    SOAP SAMPLE:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:obj="http://wwws.niku.com/xog/Object" xmlns:tns="http://www.niku.com/xog/InvokeAction">;
          <soapenv:Header>
             <obj:Auth>
                <obj:SessionID>************************</obj:SessionID>
             </obj:Auth>
          </soapenv:Header>

          

          <soapenv:Body>
             <tns:Process>
                   <code>mgl_process_name</code>
             <request>
                   <p_projectID="PR12345" />
             </request>
             </tns:Process>
          </soapenv:Body>

     

    </soapenv:Envelope>



  • 2.  Re: Passing Parameters when Invoking a Process via SOAP

    Posted Apr 28, 2019 02:35 AM

    You could create a custom attribute - Run Process X, and have Process X to automatically start using the new custom attribute.  You would then use SOAP to updated Project PR12345, setting the new attribute to be 1 (for example), which will then start Process X.

     

    I don't think you can use SOAP to run a process in the way you have described.



  • 3.  Re: Passing Parameters when Invoking a Process via SOAP
    Best Answer

    Posted Apr 28, 2019 07:49 PM

    Managed to make this work. Two things were needed to allow a process to accept a parameter from a SOAP call:

     

    The format for the request node should be similar to below:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:obj="http://wwws.niku.com/xog/Object" xmlns:tns="http://www.niku.com/xog/InvokeAction">; \

     

    <soapenv:Header>
       <obj:Auth>
          <obj:SessionID>************************</obj:SessionID>
       </obj:Auth>
     </soapenv:Header>

     

    <soapenv:Body>
       <tns:Process>
          <code>mgl_process_name</code>
          <request>
             <objparam objType="projectID">PR12345</objparam>
          </request>
       </tns:Process>
    </soapenv:Body>
    </soapenv:Envelope>

     

    The process GEL also needs to grab the XML and pull off the parameter from it:

    <!-- Grab the xml passed in via the webService -->
    <gel:getDocument var="requestXml"/>
    <gel:set select="$requestXml" var="request" asString="true"/>
    <gel:log>"entire xml in start =" ${request}</gel:log>

     

    <!-- Pull off the objparam -->
    <gel:set select="$requestXml//request/objparam" var="objNode" asString="false"/>

     

    <!-- Pull off the objCode and objId -->
    <gel:set select="$objNode//@objCode" var="objCode" asString="true"/>
    <gel:set select="$objNode//text()" var="p_projectID" asString="true"/>
    <gel:log>"Object Id in start = ${p_projectID}"</gel:log>

    <gel:log category="OUTPUT" level="INFO">VARIABLE VALUE: ${p_projectID}</gel:log>

    I got the above code from scouring through posts from here. I'd love to link it, but for some reason I can't find it again!