Clarity

 View Only
  • 1.  Can CA PPM invoke a JSON WebService? How?

    Posted Dec 19, 2018 03:35 PM

    Hi. There is a JSON web service which provides usefull information for CA PPM users.

    Is it possible to invoke it from CA PPM via GEL Script?

     

    Which additional configurarions or libraries does it require?

    Which limitations does it have?

     

     

    Thank you in advance.



  • 2.  Re: Can CA PPM invoke a JSON WebService? How?

    Posted Dec 19, 2018 07:58 PM

    Yes, parsing JSON file/data should be possible. CA PPM lib has json.jar file. You should be able to utilize the classes/methods from that package to parse JSON data in GEL code.

     

    * No additional library files required.

     

    Regards,

    Praneeth



  • 3.  Re: Can CA PPM invoke a JSON WebService? How?

    Posted Jan 04, 2019 03:39 AM

    You can refer to GEL Script consuming CA PPM REST API  where CA PPM REST api is consumed and extracted values by converting connection response to JSON. 



  • 4.  Re: Can CA PPM invoke a JSON WebService? How?

    Posted Jan 07, 2019 07:49 AM

    Thank you Prashank! Very useful.

    I see that tha article is only for self-consuming the CA PPM RESTful WebServices.

     

    Could you provide a general guideline for adapting this to an external RESTful WebService ?

    Is as simple as changing the httpRESTURL  / remoteURL ?

    Or do you need more variables to take into consideration?

     

     

    Regards



  • 5.  Re: Can CA PPM invoke a JSON WebService? How?

    Posted Jan 08, 2019 02:37 AM

    You just need to change httpRESTURL value and it will work for external web services as well. Try hard coding the url and then set property accordingly. let me know if you need any help with that.

     

     



  • 6.  RE: Re: Can CA PPM invoke a JSON WebService? How?

    Posted Jun 27, 2019 05:07 PM

    Hi @Prashank Singh​,
    I cannot access the link to the blog post. I believe it was not migrated to this new platform. Is there anyway you can recreate the blog post here?

    Regards,
    Gustavo




  • 7.  RE: Re: Can CA PPM invoke a JSON WebService? How?
    Best Answer

    Posted Jun 28, 2019 04:07 AM
    Hi @Gustavo de Almeida / DATAPREV,

    My Blogs were not migrated, however i have received a backup copy of these and will be creating blogs in PPM community.
    Meanwhile if you are looking for Blog to use REST API or consuming REST API in GEL then you can visit site: ​Pemari Blog
      1) GEL Script consuming CA PPM REST API
      2) CA PPM REST API

    Regards,
    Prashank Singh

    ------------------------------
    Lead Consultant
    Pemari Technology
    ------------------------------



  • 8.  RE: Re: Can CA PPM invoke a JSON WebService? How?

    Posted Jan 31, 2022 04:53 PM
    Please help me on converting the response in to XML

    <gel:script xmlns:core="jelly:core" xmlns:file="jelly:com.niku.union.gel.FileTagLibrary" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:jelly="jelly:core" xmlns:nikuq="http://www.niku.com/xog/Query" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="jelly:sql"
    xmlns:util="jelly:util" xmlns:wss="http://www.boomi.com/connector/wss" xmlns:x="jelly:org.apache.commons.jelly.tags.xml.XMLTagLibrary"
    xmlns:xog="http://www.niku.com/xog" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!--***************************************Get the session from the system Start ***********************************-->
    <gel:parameter default="" var="APIToken"/>
    <gel:parameter default="https://xxxenv.xxxapp.com/rest/align/api/2" var="baseURL1"/>
    <gel:parameter default="/Themes?$filter=developmentalStepId%20eq%2016" var="baseURL2"/>
    <gel:setDataSource dbId="niku"/>
    <!--Set parameter here End -->
    <!--***************************************Get the session from the system End ***********************************-->
    <!-- StringBuilder for the output -->
    <core:set var='baseURL' value='https://xxxtest.xxxapp.com/rest/align/api/2/Themes?filter=developmentalStepId%20eq%2016&amp;lastUpdatedDate%3E2022-01-25T12%3A35%3A27Z' />

    <core:new className="java.lang.StringBuilder" var="stringBuilder"/>
    <gel:log level="INFO">APIToken : ${APIToken} </gel:log>
    <core:new className="org.apache.http.client.methods.HttpGet" var="patch">
    <core:arg type="java.lang.String" value="${baseURL}"/>
    </core:new>
    <core:invoke method="setHeader" on="${patch}">
    <core:arg type="java.lang.String" value="Authorization"/>
    <core:arg type="java.lang.String" value="${APIToken}"/>
    </core:invoke>
    <core:invoke method="setHeader" on="${patch}">
    <core:arg type="java.lang.String" value="Content-Type"/>
    <core:arg type="java.lang.String" value="application/json"/>
    </core:invoke>
    <core:invoke method="setHeader" on="${patch}">
    <core:arg type="java.lang.String" value="Accept"/>
    <core:arg type="java.lang.String" value="application/json"/>
    </core:invoke>
    <core:invoke method="setHeader" on="${patch}">
    <core:arg type="java.lang.String" value="setRequestMethod"/>
    <core:arg type="java.lang.String" value="GET"/>
    </core:invoke>
    <core:invokeStatic className="org.apache.http.impl.client.HttpClients" method="createDefault" var="httpclient"/>
    <core:invoke method="execute" on="${httpclient}" var="response">
    <core:arg type="org.apache.http.client.methods.HttpGet" value="${patch}"/>
    </core:invoke>
    <gel:log>response: ${response}</gel:log>

    <core:invoke method="getEntity" on="${response}" var="entityResponse"/>
    <gel:log>entityResponse: ${entityResponse.getContent()}</gel:log>
    <core:invoke method="getContent" on="${entityResponse}" var="responsebody"/>
    <gel:log>responsebody: ${responsebody}</gel:log>
    <core:invoke method="getStatusLine" on="${response}" var="ResponseStatus"/>
    <gel:log>ResponseStatus getProtocolVersion: ${ResponseStatus.getProtocolVersion()}</gel:log>
    <gel:log>ResponseStatus getReasonPhrase: ${ResponseStatus.getReasonPhrase()}</gel:log>
    <gel:log>ResponseStatus getStatusCode: ${ResponseStatus.getStatusCode()}</gel:log>
    <gel:log>entityResponse: ${entityResponse.getContent()}</gel:log>


    <core:set value="${responsebody}" var="httpInputStream1"/>
    <core:new className="java.io.InputStreamReader" var="v_Input1">
    <core:arg type="java.io.InputStream" value="${httpInputStream1}"/>
    </core:new>
    <core:new className="java.io.BufferedReader" var="v_InputData1">
    <core:arg type="java.io.Reader" value="${v_Input1}"/>
    </core:new>
    <core:set value="${v_InputData1.readLine()}" var="ClarityProjectInfo"/>
    <gel:log>httpData: ${ClarityProjectInfo}</gel:log>

    </gel:script>