This section contains the following topics:
Examples: Microsoft Visual Studio (.NET)
Each XOG service includes a Web Service Description Language (WSDL) file that is downloadable from the installation. The WSDL describes the available XOG services and how to communicate with them.
You can access the XOG WSDL on the CA Clarity PPM application server at the following URL:
http://<servername:port>/niku/wsdl
The WSDL page is an HTML page with a list of XOG service categories.
The XOG services as listed on the WSDL page fall under the following categories:
You can display a list of all included services by clicking a category link.
For example, if you click InvokeAction, you'll see the following services:
Each service includes the following links:
Enables an HTML page that contains the WSDL to display.
Enables the WSDL to download as an XML file so that you can save it to disk.
The following figure shows the links for the services available under InvokeAction.
There are various tools you can use to read and display the WSDL in a more readable format. There are stand-alone viewers and Enterprise Application Integration (EAI) software that map data from one system to another.
Note: Go to http://www.w3.org/TR/wsdl for more information about web services and WSDL.
A client program connecting to the XOG can read the WSDL to determine what functions are available on the server. Any special data types used are embedded in the WSDL file in the form of XML Schema. The XOG WSDL has been validated against the following platforms:
These emitter tools can interpret the XOG WSDL to enable communication with CA Clarity as a web service.
Because the XOG WSDL is compatible with AXIS and .NET these emitter tools generate an accurate and usable proxy API from the XOG WSDL. This facilitates interaction with the XOG services within the context of AXIS or .NET.
To access the Object WSDL
http://<servername:port>/niku/wsdl/Object
To access the InvokeAction WSDL service category
http://<servername:port>/niku/wsdl/InvokeAction
The following example illustrates the WSDL for the Process service:
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.niku.com/xog/InvokeAction" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" name="InvokeActionProcess" targetNamespace="http://www.niku.com/xog/InvokeAction"> <types> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.niku.com/xog/InvokeAction"> <xsd:complexType name="Process"> <xsd:sequence> <xsd:element name="code" type="xsd:string" minOccurs="1" maxOccurs="1"/> <xsd:element name="request" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:any/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:element name="Process" type="tns:Process"/> <xsd:element name="Auth"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" name="SessionID" type="xsd:string"/> <xsd:element minOccurs="0" name="Username" type="xsd:string"/> <xsd:element minOccurs="0" name="Password" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Login"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="1" name="Username" type="xsd:string"/> <xsd:element minOccurs="0" name="Password" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SessionID" type="xsd:string"/> <xsd:element name="Logout"> <xsd:complexType> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="SessionID" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="Process"> <part element="tns:Process" name="body"/> <part element="tns:Auth" name="header"/> </message> <message name="Auth"> <part element="tns:Auth" name="header"/> </message> <message name="Login"> <part element="tns:Login" name="parameters"/> </message> <message name="LoginResponse"> <part element="tns:SessionID" name="body"/> </message> <message name="Logout"> <part element="tns:Logout" name="parameters"/> </message> <portType name="ProcessPort"> <operation name="Process"> <input message="tns:Process"/> </operation> <operation name="Login"> <input message="tns:Login"/> <output message="tns:LoginResponse"/> </operation> <operation name="Logout"> <input message="tns:Logout"/> </operation> </portType> <binding name="ProcessSoapBinding" type="tns:ProcessPort"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Process"> <soap:operation soapAction="http://www.niku.com/xog/InvokeAction/Process" style="document"/> <input> <soap:body parts="body" use="literal"/> <soap:header message="tns:Auth" part="header" use="literal"/> </input> </operation> <operation name="Login"> <soap:operation soapAction="http://www.niku.com/xog/InvokeAction/Login" style="document"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="Logout"> <soap:operation soapAction="http://www.niku.com/xog/InvokeAction/Logout" style="document"/> <input> <soap:body use="literal"/> </input> </operation> </binding> <service name="ProcessService"> <documentation>Invoke Action Process Service </documentation> <port binding="tns:ProcessSoapBinding" name="ProcessService"> <soap:address location="http://<servername:port>//xog"/> </port> </service> </definitions>
The request and response types of the Object WSDL are defined as <xsd:any> as seen in the Process WSDL example. However, the schema of these request/response types needs to be consistent with the corresponding XOG Object schema (as per .xsd file).
The following example shows the SOAP representation of the Project object WSDL for the ReadProject operation. The bolded DataBus document shows the correct representation of the DataBus <xsd:any> type.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Header> <Auth xmlns="http://www.niku.com/xog/Object"> <SessionID>5000156__171120a:10a241ff830:-7f711143139816999</SessionID> </Auth> </soap:Header> <soap:Body> <ReadProject xmlns="http://www.niku.com/xog/Object"> <DataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/xog_read.xsd" xmlns=""> <Header version="12.0.0.5028" externalSource="NIKU" /> <Query> <Filter name="subject" criteria="EQUALS">admin</Filter> </Query> </DataBus> </ReadProject> </soap:Body> </soap:Envelope>
The WSDL for queries is not pre-packaged. A WSDL for a query will exist only if an NSQL query was created in Studio. Depending on the number of NSQL queries already defined in Studio, you will see the corresponding numbers of WSDLs.
To access the Query WSDL
http://<servername:port>/niku/wsdl/Query
The following example displays the WSDL for the Demand for Resource query service:
<definitions xmlns:tns="http://www.niku.com/xog/Query" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" name="DemandforResourceQuery" targetNamespace="http://www.niku.com/xog/Query"> <types> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.niku.com/xog/Query"> <xsd:complexType name="DemandforResourceFilter"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="actual_hours" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="actual_hours_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="actual_hours_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="allocated_hours" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="allocated_hours_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="allocated_hours_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="estimated_effort" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="estimated_effort_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="estimated_effort_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_name" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_name_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_name_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_name_wildcard" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_id" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_id_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="resource_id_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_key" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_key_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_key_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_key_wildcard" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_level" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_level_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_level_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_level_wildcard" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_label" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_label_from" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_label_to" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="calendar_time_label_wildcard" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="DemandforResourceQuery"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" name="Code" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="0" name="Filter" type="tns:DemandforResourceFilter"/> </xsd:sequence> </xsd:complexType> <xsd:element name="Query" type="tns:DemandforResourceQuery"/> <xsd:complexType name="DemandforResourceRecord"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" name="actual_hours" type="xsd:decimal"/> <xsd:element maxOccurs="1" minOccurs="1" name="allocated_hours" type="xsd:decimal"/> <xsd:element maxOccurs="1" minOccurs="1" name="estimated_effort" type="xsd:decimal"/> <xsd:element maxOccurs="1" minOccurs="1" name="resource_name" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="1" name="resource_id" type="xsd:long"/> <xsd:element maxOccurs="1" minOccurs="1" name="calendar_time_key" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="1" name="calendar_time_level" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="1" name="calendar_time_label" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="DemandforResourceRecords"> <xsd:sequence> <xsd:element maxOccurs="unbounded" minOccurs="0" name="Record" type="tns:DemandforResourceRecord"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="DemandforResourceQueryResult"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" name="Code" type="xsd:string"/> <xsd:element maxOccurs="1" minOccurs="1" name="Records" type="tns:DemandforResourceRecords"/> </xsd:sequence> </xsd:complexType> <xsd:element name="QueryResult" type="tns:DemandforResourceQueryResult"/> <xsd:element name="Auth"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" name="SessionID" type="xsd:string"/> <xsd:element minOccurs="0" name="Username" type="xsd:string"/> <xsd:element minOccurs="0" name="Password" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Login"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="1" name="Username" type="xsd:string"/> <xsd:element minOccurs="0" name="Password" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SessionID" type="xsd:string"/> <xsd:element name="Logout"> <xsd:complexType> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="SessionID" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="Query"> <part element="tns:Query" name="body"/> <part element="tns:Auth" name="header"/> </message> <message name="QueryResult"> <part element="tns:QueryResult" name="body"/> </message> <message name="Auth"> <part element="tns:Auth" name="header"/> </message> <message name="Login"> <part element="tns:Login" name="parameters"/> </message> <message name="LoginResult"> <part element="tns:SessionID" name="body"/> </message> <message name="Logout"> <part element="tns:Logout" name="parameters"/> </message> <portType name="DemandforResourceQueryPort"> <operation name="Query"> <input message="tns:Query"/> <output message="tns:QueryResult"/> </operation> <operation name="Login"> <input message="tns:Login"/> <output message="tns:LoginResult"/> </operation> <operation name="Logout"> <input message="tns:Logout"/> </operation> </portType> <binding name="DemandforResourceQuerySoapBinding" type="tns:DemandforResourceQueryPort"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Query"> <soap:operation soapAction="http://www.niku.com/xog/Query/DemandforResource" style="document"/> <input> <soap:body parts="body" use="literal"/> <soap:header message="tns:Auth" part="header" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="Login"> <soap:operation soapAction="http://www.niku.com/xog/Query/Login" style="document"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="Logout"> <soap:operation soapAction="http://www.niku.com/xog/Query/Logout" style="document"/> <input> <soap:body use="literal"/> </input> </operation> </binding> <service name="DemandforResourceQueryService"> <documentation>Demand for Resource Query Service </documentation> <port binding="tns:DemandforResourceQuerySoapBinding" name="DemandforResourceQueryService"> <soap:address location="http://<servername:port>//xog"/> </port> </service> </definitions>
The following example is a client-side Windows Form written in .NET Visual Basic that uses the ClarityDotNetXOG API to invoke the FlushCache XOG service on a Button Click event.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim xog As ClarityDotNetXOG xog = New ClarityDotNetXOG xog.Username = "admin" xog.Password = "admin" Dim ids(0 To 1) As String Dim groups(0 To 1) As String ids(0) = "ConfigurationProperties" groups(0) = "Resources" xog.FlushCache(ids, groups) MessageBox.Show("Flush Cache Complete") End Sub
Both Apache AXIS and Microsoft Visual Studio have emitter tools that generate proxy classes based on service descriptions that conform to the WSDL.
The emitter tool packaged with Apache AXIS is WSDL2Java. The following example shows how to initiate this tool from the command line against the All Objects XOG WSDL.
Important! You must include the -W flag when generating the proxy API from the XOG WSDL definitions. This indicates that the WSDL is of style: document/literal. If you do not include the -W flag, it is assumed that the WSDL is of style: wrapped/literal, which is incorrect. Omitting the flag will not throw an error in the proxy generation, but the resulting API will cause runtime errors when trying to communicate with the XOG interfaces.
The default output location of the proxy files follows the namespace convention defined in the WSDL. Because the targetNamespace defined in the All Object WSDL is http://www.niku.com/xog/Object, the resulting proxy classes from the command-line request reside in D:\axis\com\niku\www\xog\Object.
The emitter tool packaged with Microsoft Visual Studio is implemented as a web reference. The reference is developed from within a project within the Microsoft Visual Studio GUI.
To develop a web reference from Microsoft Visual Studio
The WSDL is located.
Note: The generated proxy API for the All Objects Web Reference is on the left side of the page. This enables a developer to communicate programmatically with the services defined in the All Objects Web Reference.
Copyright © 2013 CA.
All rights reserved.
|
|