Get an OTDS ticket via REST Post Call

In this quick guide you’ll learn how to use the HTTP Connector to create a customer web service to get an OTDS ticket.

These are the steps:

  • Setup the OpenText HTTP Connector
  • Create the config file for the HTTP Service Container
  • Create the XML Store Definition
  • Add the Runtime Reference HTTP Application Connector
  • Create the XML input and output schema for the web service
  • Create the custom web service
  • Add the Implementation
  • Test your service

Setup the HTTP Connector

Create a HTTP Service Group and Service Container using the OpenText HTTP Connector:

OpenText HTTP Connector
OpenText HTTP Connector

Click on the Next button.

On the next screen (Service Group details) provide the name and description. Select all Web Service Interfaces and click the Next button:

Service Group Details
Service Group Details

In the next screen (Service Container details) leave all information as they are and click Next:

Service Container Details
Service Container Details

Provide the path to the configuration that will be created in the next steps. Name it config.xml. In this case, the path to the configuration file is OpenText/HttpConnector/config.xml. Click on Next.

Connector Configuration
Connector Configuration

In the last step (Connection Point) leave all information as they are and click Finish:

Connection Point
Connection Point

Start your Service Container.

Create the configuration file for the HTTP Service Container

In your cws create following folder structure and mark the folder XML Store as Start Point of Qualified Name (right click on the folder and click on Set Start Point of Qualified Name).

Folder structure

Be aware of the spelling: It has to match the structure mentioned in the Connector Configuration:

Create a new XML file, name it config.xml and provide following input:

config.xml
config.xml

<configurations xmlns=”http://httpconnector.opentext.com/1.0/configuration”>
<connections>
<connection id=”OTDS”>
<url>http://scdemops1.westeurope.cloudapp.azure.com:8080</url>
<check-certificate>false</check-certificate>
</connection>
</connections>
</configurations>

Create the XML Store Definition

Create a new XML Store definition in the folder XML Store. Provide the name HttpConnectorConfig and save it:

XML Store Definition
XML Store Definition

Add the Runtime Reference Application Connector

Create a new folder in your project and call it Runtime Reference. Right click on the folder and Add runtime reference -> Other

Select Application Connector:

Runtime Reference Application Connector
Runtime Reference Application Connector

Select the OpenText HTTP Application Connector and click Finish:

Create the XML input and output schema for the web service

Create a new folder in your project and call it XML Schemas.

Create an XML schema OTDSInputSchema:

OTDS Input Schema
OTDS Input Schema

Input schema:

<request>
<userName/>
<password/>
<targetResourceId/>
</request>

Provide a Target Namespace URI (http://schemas.opentext.com/otdsws/rest/authentication/) and Prefix (tns):

Namespace + Prefix
Namespace + Prefix

Create a new schema for the output:

<requestResponse>
<token/>
<userID/>
<ticket/>
<resourceID/>
<failureReason/>
<passwordExpirationTime/>
<continuation/>
<continuationContext/>
<continuationData/>
</requestResponse>

OTDS Output Schema
OTDS Output Schema

Provide the Namespace (http://schemas.opentext.com/otdsws/rest/authentication/) & Prefix (tns):

OTDS Output Schema Namespace + Prefix
OTDS Output Schema Namespace + Prefix

Create the custom web service

Create a new folder called Services and add a new Web Service:

New Web Service
New Web Service

Provide following information:

  • Select Custom Web Service as Source
  • Name: OTDSServices
  • Namespace: http://schemas.opentext.com/otdsws/rest/authentication/
Web Service information

Click Next.

Provide following information:

  • Web Service Interface Name: OTDSWI
  • Select the HttpConnector Implementation Class
  • Name the service GetOTDSTicket
  • Select the request schema as Input
  • Select the requestResponse schema as Output
Web Service Information
Web Service Information

Click Finish.

Add the Web Service Interface OTDSWI to the HTTP Service Group and save your changes:

Add the Web Service Interface to the Service Group
Add the Web Service Interface to the Service Group

Double click on the GetOTDSTicket service. The blank implementation will be opened:

Blank Implementation
Blank Implementation

Provide following implementation and save your service:

<implementation xmlns=”http://httpconnector.opentext.com/1.0/implementation” xmlns:cws=”http://schemas.cordys.com/cws/1.0″ xmlns:c=”http://schemas.cordys.com/cws/1.0″ xmlns:SOAP=”http://schemas.xmlsoap.org/soap/envelope/” type=”HTTP”>
<connection-id>OTDS</connection-id>
<http-method>POST</http-method>
<uri>/otdsws/rest/authentication/credentials</uri>
<request-handler class=”com.opentext.applicationconnector.httpconnector.impl.RestRequestHandler”>
<root-xpath>./request</root-xpath>
<req-headers>
<header name=”Content-Type”>application/json</header>
<header name=”charset”>utf-8</header>
</req-headers>
</request-handler>
<response-handler class=”com.opentext.applicationconnector.httpconnector.impl.RestResponseHandler” />
<valid-response-code>200</valid-response-code>
<namespaces>
<binding prefix=”ns” uri=”http://schemas.opentext.com/otdsws/rest/authentication/” />
</namespaces>
</implementation>

Implementation
Implementation

Publish your project, restart the HTTP Service Container and test your service.

One thought on “Get an OTDS ticket via REST Post Call

  • September 4, 2019 at 1:49 pm
    Permalink

    Great article! A few notes:

    – On our sample machine, OTDS is run on port 81
    – The user ID on the response object is userId. Notice the last letter is not capitalized.
    – When copying and pasting the XML examples to my machine, the quotation marks were translated and required fixing.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *