Clarity

 View Only
  • 1.  Remove Progress Output From XOG Client

    Posted Apr 22, 2017 10:32 PM

    Hello,

     

    I am running the XOG client from a Groovy script that runs the following command line argument:

     

    /tmp/xogclient/bin/xog -propertyfile /tmp/xogclient/bin/test.properties -input /tmp/xogclient/xml/prj_projects_read.xml

     

    I want to be able to parse the XML output, but the problem is the XOG client prints out progress as it's printing the output, such as " *********** 52.0% Completed [ 28 of 54 ] ***********"  Sometimes this progress output happens in the middle of an XML tag, like

    <scenariodependenci ***********="" 80.0%="" completed="" [="" 43="" of="" 54="" ]="" es=""></scenariodependenci>.

     

    This throws off the XML parser.  Is there a way to turn off progress output when running the XOG client via command line?



  • 2.  Re: Remove Progress Output From XOG Client

    Posted Apr 23, 2017 10:09 PM

    Instead of shelling out to run the XOG client, you could just call the OBJECT web service passing it your /tmp/xogclient/xml/prj_projects_read.xml request payload.

     

    Not done any Groovy scripts but a quick search found this: Groovy Goodness: Use GroovyWS to Access SOAP Web Services - Messages from mrhaki 

     

    The other option if you need to shell out is to wrap you prj_projects_read.xml request payload into a GEL script using SOAP to get your response payload.  Using a GEL wrapper would eliminate the printing the output.

     

    V/r,

    Gene



  • 3.  Re: Remove Progress Output From XOG Client

    Posted May 01, 2017 12:26 PM

    Thanks Gene.  I am looking into running the XOG client through a SOAP request using the Groovy WSLite library (GitHub - jwagenleitner/groovy-wslite: Lightweight SOAP and REST webservice clients for Groovy).

     

    Currently, I am trying to perform a Login operation using the following script:

     

    @Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')
    import wslite.soap.*


    def loginRequest = """
    <?xml version='1.0' encoding='UTF-8'?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <Login xmlns="http://www.niku.com/xog">
    <Username>USERNAME</Username>
    <Password>PASSWORD</Password>
    </Login>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    """

    def client = new SOAPClient("https://SERVER_NAME/niku/wsdl/Object")
    def response = client.send(loginRequest)

     

    I am getting a 405 Method Not Allowed response.  Is my endpoint URL correct?  Is my request header and body correct?

    EDIT: I've found that the wslite package automatically uses POST for all SOAP requests.  Do I need to change it to GET for the XOG SOAP API?



  • 4.  Re: Remove Progress Output From XOG Client

    Posted May 01, 2017 02:53 PM

    So to xog out Ideas, I think it is:

     

    Endpoint https://cppm.ondemand.ca.com/niku/xog
    SOAPAction: http://www.niku.com/xog/ReadIdea
    Operation: ReadIdea

     

    SoapPayload:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:obj="http://www.niku.com/xog/Object">
         <soapenv:Header>
              <obj:Auth>
                   <obj:Username>admin</obj:Username>
                   <obj:Password>password</obj:Password>
              </obj:Auth>
         </soapenv:Header>
         <soapenv:Body>
              <obj:ReadIdea>
                   <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
                        <Header version="8.0" action="read" objectType="idea" externalSource="NIKU">
                             <args name="documentLocation" value="D:\niku/xog/test/documentXogLocation"/>
                             <args name="include_resources" value="true"/>
                             <args name="include_tasks" value="true"/>
                             <args name="include_allocations" value="true"/>
                        </Header>
                        <Query>
                             <Filter name="objectID" criteria="EQUALS">admin</Filter>
                        </Query>
                   </NikuDataBus>
              </obj:ReadIdea>
         </soapenv:Body>
    </soapenv:Envelope>

     

    V/r,

    Gene



  • 5.  Re: Remove Progress Output From XOG Client

    Posted May 04, 2017 11:39 AM

    Thank you very much for the help.  I tried running the code above, changing some of the parameters (like username/password) and it gave me a 500 Internal Server error.  I also adjusted the code above to read a list of active projects, here is my code:

     

     

    @Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')
    import wslite.soap.*

    def request = """
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:obj="http://www.niku.com/xog/Object">
         <soapenv:Header>
              <obj:Auth>
                   <obj:Username>username</obj:Username>
                   <obj:Password>password</obj:Password>
              </obj:Auth>
         </soapenv:Header>
         <soapenv:Body>
              <obj:ReadProject>
                   <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
                        <Header version="6.0.11" action="read" objectType="project" externalSource="NIKU">
                            <args name="include_tasks" value="true"/>
                            <args name="include_dependencies" value="false"/>
                            <args name="include_subprojects" value="false"/>
                            <args name="include_resources" value="true"/>
                            <args name="include_baselines" value="false"/>
                            <args name="include_allocations" value="false"/>
                            <args name="include_estimates" value="false"/>
                            <args name="include_actuals" value="false"/>
                            <args name="include_custom" value="false"/>
                            <args name="include_burdening" value="false"/>
                        </Header>
                        <Query>
                             <Filter name="active" criteria="EQUALS">true</Filter>
                        </Query>
                   </NikuDataBus>
              </obj:ReadProject>
         </soapenv:Body>
    </soapenv:Envelope>
    """
    def client = new SOAPClient("https://instance.ondemand.ca.com/niku/xog")
    def response = client.send(SOAPAction: "http://www.niku.com/xog/ReadProject", request)

     It gives me a 500 Internal Error as well.



  • 6.  Re: Remove Progress Output From XOG Client
    Best Answer

    Posted May 04, 2017 01:06 PM

    Finally, after some trial and error and debugging with SoapUI, I was able to get the script working.  This will read a list of companies and print out the result

     

     Thanks for the help, much appreciated!

    @Grab('com.github.groovy-wslite:groovy-wslite:1.1.2')
    import wslite.soap.*

    def request = """
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:obj="http://www.niku.com/xog/Object">
       <soapenv:Header>
          <obj:Auth>
             <obj:Username>username</obj:Username>
             <obj:Password>password</obj:Password>
          </obj:Auth>
       </soapenv:Header>
       <soapenv:Body>
          <obj:ReadCompany>
             <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">

                <Header version="14.4.0.234" externalSource="NIKU"/>
                <Query>
                </Query>
              </NikuDataBus>
          </obj:ReadCompany>
       </soapenv:Body>
    </soapenv:Envelope>
    """
    def client = new SOAPClient("https://instance.ondemand.ca.com/niku/xog")
    def response = client.send(SOAPAction: "ReadCompany", request)

    return response.text