0.5.2 • Published 3 years ago

@basistechnologies/activecontrol-soap-api v0.5.2

Weekly downloads
17
License
Apache-2.0
Repository
bitbucket
Last release
3 years ago

License

ActiveControl SOAP API

This library allows access to the ActiveControl SOAP API.

Usage

Instantiate a client

import { ActiveControlSoapClient, Options} from "@basistechnologies/activecontrol-soap-api"
const options:Options = {
    systemnumber: "10", // AC integration ID, see table /BTI/TR_INT_SYST
    url: "https://myactivecontrolserver.mydomain/sap/bc/srt/rfc/bti/te_task_ws/myendpoint", // endpoint needs to be defined with transaction SOAMANAGER
    username: "jdoe",
    password: "secret"
  }
// instantiate a client
const client = new ActiveControlSoapClient(options)

Create a task

import { Task } from "@basistechnologies/activecontrol-soap-api"
const taskdata: Partial<Task> = {REFERENCE:"taskreference",CAPTION:"new task", GROUPID:""}
client.createTask(taskdata).then(id=>console.log(`Task created, id= ${id}`))

Read a task

client.readTask({ XTaskid:"12345" }).then(task=>console.log(JSON.stringify(task,null,1)))

Read a task's transports and locations

client.readTaskTransports({ XTaskReference: "Task-34432" })
.then(response => console.log(JSON.stringify(response))

Record test results

import { TestResultCodes, TestResultsInputs} from "@basistechnologies/activecontrol-soap-api"

const resultData: TestResultsInputs = {
    XClose: true, // close tests and move task to next control point
    XComment: "Test was successful",
    XRescode: TestResultCodes.Passed,
    XTarget: '0001',
    XTaskid: '0100000000001110' // task ID from table /BTI/TE_TASK. Task Reference can be used instead in later releases, or if exit 0083 is enabled
  }

  client.enterTestResults(resultData).then(result=>console.log(`Test Results recorded, id ${result.resultsId}`))

Change a task

  const task = await client.readTask({XTaskid:"12345"})
  const chdata: TaskChangeData = {
    XTask: { ...task, PRIORITY: "1", GROUPID: "12345678901234567890" },
    XUpddateTask:   true,
    XUpdateCustfields:   false,
    XUpdateDesc:   false,
    XUpdateTesters:   false
  }
  const result = await client.changeTask(chdata)
  console.log(result.message) //"Task changed successfully"

Approve a task step

  const result = await client.approveStep({
    XAnalysisMode: AnalysisMode.StopOnError,
    XReference: "mytaskref",
    XStep: "ECCQAOUT"
  })

  console.log(result.results[0].Reference) // "mytaskref" 

AnalysisMode.Force will ignore any analysis result you're allowed to AnalysisMode.None will skip analysis altogether and disable sanity checks. USE AT YOUR OWN RISK

Approve a task by location

This can be done but has serious issues, so it is deprecated.

Run an analysis

  const result = await client.startAnalysis({
    XTaskid: "12345678901234567890",
    XTarget: '0001',
    XLocation: TargetLocation.Outbox, 
    XAnltypeid: "0000", // general analysis
    XtRequest: []
  })

  console.log(result.YAnalysisId.length) // use this to retrieve the results 

The analysis will run in the background.

Read an analysis result

  const client = createReadTaskClient()

  const result = await client.readAnalysisResults({
    XAnalysisId: readEnv("AC_APPROVAL_ANALYSISID"),
    XMaxlines: ""
  })

  console.log(result.isRunning) // did it finish? 

Analysis results are quite complex, see the typescript definitions

  • analysisId Same as you passed in
  • hasErrors
  • isRunning true if the analysis is not complete yet. Might stay true forever if the analysis dumped.
  • status Field lists all the analysis steps and their progress
  • resultGroups The results usually displayed to the end user. The results bit has an entry for each column which is always a string except for URLs which are objects with a text and an url.
  • conflicts All the problematic transports with details of what went wrong (resultcode; every analyser has one or more) and what transport they conflict with. Date and time fields are set to 1900-01-01 and 00:00:00 for unreleased transports

Custom authentication

Can be specified by setting the authorization field when creating the client instead of passing user and password:

import { ActiveControlSoapClient, Options} from "@basistechnologies/activecontrol-soap-api"
const options:Options = {
    systemnumber: "10", 
    url: "https://myactivecontrolserver.mydomain/sap/bc/srt/rfc/bti/te_task_ws/myendpoint", 
    authorization: "Bearer foobar"
  }
// instantiate a client
const client = new ActiveControlSoapClient(options)

Overriding http options

Any Axios request parameter can be passed down to the client, with a few exceptions:

  • headers are merged with those generated by the library, with those passed taking precedence
  • method is set to post
  • can't override data
import { AxiosRequestConfig } from "axios"
const config:AxiosRequestConfig  = {"user-agent": "foobar"}
client.readTask({XTaskid:"12345"}, config).then(task=>console.log(JSON.stringify(task,null,1)))
0.5.2

3 years ago

0.5.1

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.3.1

3 years ago

0.2.1

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago