Wednesday, February 13, 2013

Connecting CA Clarity PPM Through Visual Studio 2010

There is a requirement where we need to access clarity data through web service using Visual Studio 2010.

I have connected successfully using below code and steps and hope it helps

Steps In Clarity 

http://serverlocation/niku/wsdl/Query

The above path you can find the list of N-SQL query created in Clarity. If you want to your own customization query, go to clarity and click there is a menu list called Query.
Using N-SQL language you can create the query. after creation you find the query name using the above link.

For example : 
In clarity, i am going to create Query name called "Resource_data", once created  you can access through
this URL : http://serverlocation/niku/wsdl/Query/Resource_data


Steps in Visual Studio 2010

http://serverlocation/niku/wsdl/Query/Resource_data

This is the link we are going to use for accessing the clarity data from Visual Studio 2010.

Step1:

Create one new Web Application/Stand alone project

Step2:

Go To Solution explorer. --> Using Service Reference -- Connect Above mentioned URL.

Step3:

After successful completion of above step, please declare the service name in the top of page.
and start accessing all the classes and method.

Sample Source code based on URL mentioned.


            string sessionId = string.Empty;
            Auth objAuth = new Auth();
            objAuth.Username = "XOG_USER";
            objAuth.Password = "test";


           
         
           Resource_dataFilter objFilter = new Resource_dataFilter();
            objFilter.res_id = "5015283";
            Resource_dataQuery objResourcequery = new Resource_dataQuery();
            objResourcequery.Code = "Resource_data";
            objResourcequery.Filter = objFilter;

            Resource_dataQueryResult objectresult = new Resource_dataQueryResult();
                   
            Resource_dataQueryPortClient objClient = new Resource_dataQueryPortClient();
            sessionId = objClient.WrappedLogin("XOG_USER", "test");
         
            objectresult = objClient.Query(objAuth, objResourcequery);

This example based on the resource id will receive all the respective data through WSDL.
Note: In the source code, highlighted one vary based your URL and query name.

Happy Coding 
Bala