Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Thursday, November 27, 2008

[8] CA World 2008

   Thanks for Attending my Session on "Integration with Clarity using Web Services" at CA World 08 at Las Vegas.  

   For those who attended, Here is the code that I used in Live Demo. This basically tells the steps to follow if you want to call an External Web Service from Clarity (Say Google's Search Web Service ) using GEL Scripts. 

   In this Example, A Custom Object instance is created and any google Search string is provided in "Name" field of the instance. When Save/Submit is clicked, a Process runs which calls a Gel script. Gel Script then calls Google Web Service and gets the data in XML format. Gel Script breaks the XML, Loops through, extracts required data elements, stores them in variables and then finally Inserts them into a Custom Table. Portlet is created and NSQL query based on that Custom Table displays the Google Search Result data. 

     In this Example, for simplicity Google Search Web Service is used, but in Real life scenarios you can pull Stock/Currency Exchange etc information on Periodic basis through Clarity job. Likewise you can also pull and use other Web Services provided by Internal applications like SAP, .NET/Java Applications, CA Service Desk, HR/Asset Management applications or product Suites.  

    In similar fashion, Other Internal Apps can also access Clarity's data through Web service. Clarity exposes it's Web Services at http://clarity-server-name/niku/xog that others can use. 

    Post a comment or mail me if you need some other/related  examples or have any specific query. 

    

Friday, August 29, 2008

[7] ASP.NET Calling Clarity Web Services - Code Example

Here is an Example of ASP.NET calling Clarity Web Services ( Here ASP.NET Calls Project XOG to get properties of a Particular Project )

Steps :-

1. Add Web reference http://localhost/niku/wsdl/Object/Projects and name it as PRJ


2. Create a New "ASP.NET Web application Project". Create a Multiline Textbox in it say Textbox1 ( To display XOG output )

3. On the PageLoad event add following :-

Dim PS As New PRJ.ProjectsService
Dim Log As New PRJ.Login
Dim Auth As New PRJ.Auth

Dim SoapXML As New System.Xml.XmlDocument
Dim DataBus As System.Xml.XmlElement
Dim XOGOutput As System.Xml.XmlElement
Dim sessionId As String

Log.Password = "admin"
Log.Username = "admin"
sessionId = PS.Login(Log)
Auth.SessionID = sessionId
PS.AuthValue = Auth

SoapXML.Load("c:\xog\Read_project.xml")

XOGOutput = PS.ReadProject(SoapXML.DocumentElement)
TextBox1.Text = XOGOutput.InnerXml

PS.Logout(sessionId)

4. Read_Project.xml looks like as below :-
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- you change the order by simply swap 1 and 2 number in the name attribute -->
<args name="order_by_1" value="name"/>
<args name="order_by_2" value="projectID"/>
<args name="include_tasks" value="false"/>
<args name="include_resources" value="false"/>
<args name="include_custom" value="false"/>
<args name="include_dependencies" value="false"/>
</Header>
<Query>
<Filter name="projectID" criteria="EQUALS">Clarity_test</Filter>
</Query>
</NikuDataBus>

------------------------------------------------------------------------------

* This was tested on Clarity 7.5.3.