{"id":13646871,"url":"https://github.com/SoftwareAG/wm-is-client","last_synced_at":"2025-04-21T21:31:51.440Z","repository":{"id":31880997,"uuid":"130118262","full_name":"SoftwareAG/wm-is-client","owner":"SoftwareAG","description":"Node.js package for invoking Integration Server services.","archived":true,"fork":false,"pushed_at":"2023-01-23T14:02:25.000Z","size":14218,"stargazers_count":14,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-06T01:37:24.334Z","etag":null,"topics":["integration-server","webmethods"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SoftwareAG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-18T20:28:28.000Z","updated_at":"2023-03-02T07:02:17.000Z","dependencies_parsed_at":"2023-02-12T23:45:29.722Z","dependency_job_id":null,"html_url":"https://github.com/SoftwareAG/wm-is-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftwareAG%2Fwm-is-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftwareAG%2Fwm-is-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftwareAG%2Fwm-is-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftwareAG%2Fwm-is-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SoftwareAG","download_url":"https://codeload.github.com/SoftwareAG/wm-is-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249872581,"owners_count":21338017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration-server","webmethods"],"created_at":"2024-08-02T01:03:12.214Z","updated_at":"2025-04-21T21:31:50.651Z","avatar_url":"https://github.com/SoftwareAG.png","language":"JavaScript","readme":"# !!! Archived!!! This repository is no longer relevant!\n\n![alt text](docs/images/is_logo_stacked.png \"Integration Server\")\n\n# Introduction\nwm-is-client is a NodeJS package for accessing Software AG's wm Integration Server services natively from node JS using\npure Javascript.\n\nGET invocation example\n\n![alt text](docs/images/ss-1.png \"GET ping\")\n\n\n# Revision history\n\n \n| when          | what   |\n| ------------- | :------|\n| 1.0.17  | Attach license header to source files |\n| 1.0.16  | README.md update |\n| 1.0.15  | Initial release | \n\n\n# Supported Platforms\n| when           | what |\n| -------------  | ---- |\n| Apr 2018       | w64      |\n| Apr 2018       | lnxamd64 | \n\nnpm package installation enforces these platforms via the 'os' element.\n```js\n\"os\": [\n    \"linux\",\n    \"win32\",\n    \"!darwin\"\n  ],\n```\n\n# Installation\nGlobally install the [wm-is-client](https://www.npmjs.com/package/wm-is-client) node package.\n```js\n npm install -g wm-is-client\n```\n\nNo errors? You're ready to use the package's IS demo client  or skip to [API](#api) documentation\n\n\n# CLI Demo Tool\n\n## Invoke Requests Against a Running Server\nThis section uses the [is-client](#is-client-doc) demo utility.\n \n \n\u003e First, start an Integration Server.  \n\u003e Note: This readme may refer to 'Integration Server' as \"IS\".\n\n```\n\n\n$ cd /pathToInstallation/profiles/IS_default/bin\n$ ./console.sh\n.\n.\n.\n```\n\u003e Fetch a list of IS packages from the server.\n```js\n$ is-client -s localhost:5555 -u Administrator -p manage list\n{\n    \"packages\": [\n        {\n            \"name\": \"Default\",\n            \"enabled\": \"true\",\n            \"loadok\": \"0\",\n            \"pkgType\": \"1\",\n            \"loaderr\": \"0\",\n            \"loadwarning\": \"0\",\n            \"subsystem\": false\n        },\n        {\n            \"name\": \"NodeBench\",\n            \"enabled\": \"true\",\n            \"loadok\": \"1\",\n            \"pkgType\": \"1\",\n            \"loaderr\": \"0\",\n            \"loadwarning\": \"0\",\n            \"subsystem\": false,\n            \"zipLastModified\": \"Mon Mar 19 10:02:11 EDT 2018\"\n        },\n\n.\n.\n.\n```\n\u003e Or if the server is running locally rely on the default settings\n```js\n$ is-client list\n.\n.\n.\n```\n\n\u003e Refer to help for more details.\n```\n$ is-client -h\n\n  Usage: is-client [options]\n\n  node lib/cli-test.js [get] | [list] | [post]\n\n\n  Options:\n\n    -v, --version                    output the version number\n    -s --serverport \u003cserverport\u003e     hostname:port\n    -c --console                     Send log messages to stdout\n    -d, --debug                      Additional trace messages\n    -u --user \u003cusername\u003e             e.g. Administrator\n    -r --request-file \u003crequestFile\u003e  Path to requestFile\n    -o --output-file \u003cresponseFile\u003e  Path to responseFile\n    -p --password \u003cpassword\u003e         e.g. manage\n    -x, --x-stream                   eXecute using serviceStream\n    -t, --tls                        Use TLS encryption\n    -n, --notrust                    server trust verification disabled\n    -h, --help                       output usage information\n$ \n```\n\n\n### POST invocation example\n\nThis POST example sends a request to the Integration Server to execute an operating system command.\n\n---\n#### About executing OS commands from IS \u003ca id=\"is-os-exec\"\u003e\u003c/a\u003e\n\u003e This example requires an additional step for granting permission to run an OS command on the Integration Server.\n\n```\n$ cd ~/dev/installs/102apr2018/IntegrationServer/instances/default/packages/WmPublic/config/\n\n$ cat OSCommands.cnf \nallowedOSCommands=ls;uptime;ps\nallowedWorkingDirectories=\n$ \n\n```\n\n\u003e After editing the configuration file, you must either reload the WmPublic package or restart the IS server. The server is now authorized to execute these OS commands.\n---\n\n![alt text](docs/images/ss-2.png \"POST execute\")\n\n\n#### You can also redirect from stdin \n\n```\n$ is-client post pub.utils:executeOSCommand \u003c $testdir/requests/uptime.req\n```\n\n\n#### Or pass a request on the command line argument\n```\n$ is-client post pub.utils:executeOSCommand \"{ \\\"command\\\" : \\\"uptime\\\" }\"\n```\n\n#### Windows Example\nThis example is invoking an OS command on an IS server running on a Windows platform.\n```\n$ is-client -s my-windows-vm:5555 post pub.utils:executeOSCommand \"{ \\\"command\\\" : \\\"cmd /c ver\\\" }\"\n\n```\n\nWith IS returning this response.\n```\n{\n    \"command\": \"cmd /c ver\",\n    \"status\": \"0\",\n    \"outputMessage\": \"\\r\\nMicrosoft Windows [Version 6.3.9600]\\r\\n\",\n    \"errorMessage\": \"\"\n}$ \n```\n\n## CLI Demo Tool Documentation \u003ca id=\"is-client\"\u003e\u003c/a\u003e\nComplete details for the 'is-client' command line tool for invoking Integration Server services. Since the pacakge was globally installed, it will be on your path.\n\ne.g.\n```\n$ is-client --version\n1.0.8\n```\nThree actions are supported: list, get and post.\n\n| functions          | example            | When  |\n| ------------- |:-------------| -----:|\n| list IS packages    | is-client list | 102apr2018 |\n| list IS services in a package  |  is-client list WmPublic | 102apr2018    |\n| list IS service details | is-client wm.server:ping | 102apr2018 |\n| Execute GET service  | node lib/cli-test.js get wm.serve:ping  | 102apr2018  |\n| Execute POST service | node lib/cli-test.js post pub.utils:executeOSCommand -r /home/user/test/fixtures/requests/uptime.req  | 102apr2018    |\n\n\n\n## Examples\n\n#### List packages\n```js\nis-client list\n```\n\n#### Execute GET\n```js\nis-client get wm.server:ping\n```\n\n#### Execute POST\nThis example assumes a relative path to a 'ps.req' file containing the following request:\n\u003e{\n    \"command\": \"ps\",\n    \"arguments\": [ \"-ef\" ]\n}\n\n```js\nis-client post pub.utils:executeOSCommand -r test/fixtures/requests/ps.req\n```\nNote, if you receive an error response containing 'Specified command [ps -ef] is not on the allowed...' See [this section](#is-os-exec) if you have not already added 'ps' to the list of whitelisted OS commands in IntegrationServer/instances/default/packages/WmPublic/config/OSCommands.cnf.\n\n\n## Stress Test\nInstall the included sample IS NodeBench package and use the is-client tool to generate load on the server by performing these two steps:\n\n1. Install NodeBench IS package\n2. Invoke the package's IS service\n\n#### Install NodeBench IS package\n* Copy the 'test/IS/NodeBench.zip' zip archive from the wm-is-client's installation package to the \u003cpathToIntegrationServerInstallation\u003e/IntegrationServer/instances/default/replicated/inbound/ directory.\n* Use the IS Administrator web portal to install the package.\n* Verify the package has loaded without any errors.\n\n![alt text](docs/images/ss-3.png \"Install IS NodeBench package\")\n\n#### Invoke service with the is-client tool\n```\n$ is-client post pub:DataPump -x \"{ \\\"rowCount\\\": 3, \\\"chunkCount\\\" : 3 }\"\n\n{ \"rows\" : [\n  { \"0\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"1\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"2\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" }\n  ] \n}\n$ \n```\n\nSend the content to an output file when generating lots of data.\n\nThis example sets the 'debug' switch to illustrate the streaming functionality.\n\n```\n$ is-client post pub:DataPump -d -x -o test.json \"{ \\\"rowCount\\\": 10000, \\\"chunkCount\\\" : 1000 }\"\nWriting response to test.json\nTrusted server verification disabled? undefined\nOverride checking server certificate? false\nUsing key path: /home/user/dev/git/njs/wm-is-client/test/fixtures/pem/ssos-key.pem\nUsing key passphrase: manage\nUsing certificate authority: /home/user/dev/git/njs/wm-is-client/test/fixtures/pem/ssos-ca.pem\nUsing trust store: /home/user/dev/git/njs/wm-is-client/test/fixtures/pem/ssos-trust.pem\n### Connection success! ssnid: 07b79ad715a9478ba14b82937db35e82\n### Invoking app.stream()\n### Received chunk event: (200) data length: 16128\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 65536\n### Received chunk event: (200) data length: 64028\n### Received LAST chunk: (200) data length: 0\n(200) Response headers: {\"content-type\":\"application/json\",\"content-length\":\"538908\"}\n$ \n```\nConfirming 10,000 rows were created and the json response data is parseable.\n```\n$ cat test.json | jq '.[]' | jq length\n10000\n$ \n```\n\n\n# wm-is-client API \u003ca id=\"api\"\u003e\u003c/a\u003e\n\nThe API is very simple. There are two functions for connecting and disconnecting to/from an Integration Server, and two functions for invoking an IS service.  One function sends and receives String objects containing the entire request and response content. The other function is optimized for very large request or response objects, so it uses [Streams](https://nodejs.org/api/stream.html \"Node JS\") to send/receive chunks of data as to avoid excessive memory consumption.\n\n| functions          | purpose            | When  |\n| :------------- |:-------------| -----:|\n| connect    | Connect to the Integration Server | 102apr2018 |\n| disconnect  | Disconnect from the Integration Server | 102apr2018    |\n| execute  |  Execute an IS service | 102apr2018    |\n| stream  |  Execute an IS service with request and response messages delivered/returned in chunks | 102apr2018    |\n\n## connect\n\nconnect() is used to create an authenticated session on the Integration Server. Connection details are defined in the config parameter included with the function.\n\n\u003e NOTE: Only basic auth is supported at this time.  \n\n\u003ePlease refer to the wm-is-client/lib/config.js source file for more details regarding valid configuration options.\n\nThis method returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) \n\n\n### Request\n| in/out|  param | required | contents | example |\n| ----- | -------- | ------- |-------- | ------- |\n| in    | config | yes |  a config object.  | var config = require('wm-is-client').config |\n| out   | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | - | data varies depending upon whether the response is resolved or rejected | See  'Response' section for more details.\n\n### Response\nThe format for the Promise's data object.\n\n| success   | contents | example | \n| ------   | -------- | -------- |\n| ssnid  | String containing the session id created by IS|  b58f53a9ca3043d6be019c04f556fdd4 |\n\n| failure   | contents | example | \n| ------   | -------- | -------- |\n| JSON object with two elements  | Optional javascript [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object and an optional reason string  | -\n\u003e There will always be an error object, a reason string, or both.\n\n\n\u003eSee the 'execute' or 'stream' examples for a complete connect() example.\n\n## disconnect\n\ndisconnect() ends the session.\n\nThis method returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) \n\n\n### Request\n| in/out|  param | required | contents | example |\n| ----- | -------- | ------- |-------- | ------- |\n| in    | - | - |  -  | - |\n| out   | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | - | data varies depending upon whether the response is resolved or rejected | See  'Response' section for more details.\n\n### Response\nThe format for the Promise's data object.\n\n| success   | contents | example | \n| ------   | -------- | -------- |\n| ssnid  | String containing the session id created by IS|  b58f53a9ca3043d6be019c04f556fdd4 |\n\n| failure   | contents | example | \n| ------   | -------- | -------- |\n| JSON object with two elements  | Optional javascript [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object and an optional reason string  | -\n\n\u003e There will always be an error object, a reason string, or both.\n\n\u003eSee the 'execute' or 'stream' examples for a complete disconnect() example.\n\n## execute\n\nexecute() is the simplest method for interacting with an IS service.\n\nIt returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) ( containing a json object with keys defined in API)\n\n\u003e NOTE: IS services that contain request and response elements which do not support the 'application/json' content are unsupported.  In this case, additional steps are required such as writing it an IS service which calls the unsupported service.\n\nThe data value returned for a succesful invocation ( i.e. resolve ) or failed invocation (i.e. reject ) are shown below.  In both cases, the object returned by the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) is a Javascript [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) containing key-value pairs. The key names are a fixed part of the API; therefore, they are defined and exported from index.js. \n\n\n### Request\n| in/out|  param | required | contents | example |\n| ----- | -------- | ------- |-------- | ------- |\n| in    | service | yes |  fully qualified IS servicename | wm.server:ping |\n| in    | method  | yes |  HTTP GET or POST | GET, POST |\n| in    | sRequest | no |  request [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | { \"rows\" : 3, \"chunk\" : 3} | \n| in    | headers | no |  JSON object of optional additional HTTP request headers | {'Accept':'application/json'} |\n| out   | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | - | data varies depending upon whether the response is resolved or rejected | See  'Response' section for more details.\n\n\n### Response\nThe format for the Promise's data object.\n\n| success   | contents | example | \n| ------   | -------- | -------- |\n| data[app.STATUS_CODE]  | HTTP numeric response code |  200, 500, etc. |\n| data[app.RESPONSE]  | Node.js API [buffer](https://nodejs.org/api/buffer.html) | \u003cBuffer 7b 20 22 72 6f 77 73 22 20 3a 20 5b 0a 20 20 7b 20 22 30 22 3a 20 22 31 32 33 34 35 36 37 38 39 30 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 ... \u003e  |\n| data[app.RESPONSE_HEADERS] | | |\n\n\u003eNOTE: An object containing buffer data may be converted to a [string] using \n```js\nconst StringDecoder = require('string_decoder').StringDecoder;\nvar decoder = new StringDecoder('utf8');\n.\n.\n.\nif ( Buffer.isBuffer(data)) {\n  \n  var myString = decoder.write(data)); \n}\n```\n\n| failure   | contents | example | \n| ------   | -------- | -------- |\n| data[app.ERROR]  | Optional javascript [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object | -\n| data[app.REASON]  | Optional reason string  | -\n\u003e There will always be an error object, a reason string, or both.\n\nGET example ( docs/get.js )\n```js\nvar app = require('wm-is-client');\n\nfunction getMe(ssnid) {\n    console.log(`Session connected: (${ssnid})... Executing ping`);\n    var promise = app.execute( 'wm.server:ping', 'GET');\n    return promise;\n\n}\nfunction dumpResponse(data) {\n    console.log( `Response: ${data[app.RESPONSE]}`);\n}\n\napp.connect(app.config)\n    .then( (ssnid) =\u003e getMe())    \n    .then( (data) =\u003e dumpResponse(data))\n    .then( () =\u003e app.disconnect())\n    .then( (ssnid) =\u003e {\n        console.log('Session disconnected... ${ssnid}');\n    }).catch( (err) =\u003e {\n        console.log(err);\n    });\n```\n```bash\n$ node docs/get.js\nSession connected: (59fccd53de6245be9bf8dce7d71bc40b)... Executing ping\nResponse: {\"date\":\"Mon Mar 26 11:14:40 EDT 2018\"}\nSession disconnected...\n$ \n```\n\n\nPOST example ( docs/post.js )\n```js\nvar app = require('wm-is-client');\nvar stream = require('stream');\nconst StringDecoder = require('string_decoder').StringDecoder;\nconst decoder = new StringDecoder('utf8');\n\nfunction postMe() {\n    let sRequest = \"{\\\"rowCount\\\": 4, \\\"chunkCount\\\": 2}\";\n    let reqStream = new stream.PassThrough();\n    reqStream.write(sRequest);\n    reqStream.end();\n    var listener = app.stream( 'pub:DataPump', 'POST', reqStream);\n\n    listener.on(app.CHUNK, (data) =\u003e {\n    \n        let statusCode = data[app.STATUS_CODE];           \n        let myBuffer = data[app.RESPONSE];\n        if ( myBuffer != null) {\n                sResponse = decoder.write( myBuffer);\n        }\n        \n        console.log(`Chunk of response received: ${sResponse}`);\n    });\n\n    listener.on(app.END, (data) =\u003e {             \n        \n        let statusCode = data[app.STATUS_CODE];                   \n        console.log(`Response completed. (${statusCode})`);\n    });\n\n    listener.on(app.ERROR, (data) =\u003e {\n\n        console.log('Error received');\n        let e = data[app.ERROR];\n        let reason = data[app.REASON];\n    });\n}\n\napp.connect(app.config).then( () =\u003e {\n    try {\n        postMe();\n    } finally { \n        app.disconnect();\n    }\n\n}).catch( (err) =\u003e {\n    console.log(err);\n});\n\n```\n```bash\n$ node docs/post.js\nChunk of response received: { \"rows\" : [\n  { \"0\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"1\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"2\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"3\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" }\n  ]\n}\n\nResponse completed. (200)\n$ \n```\n\n## stream\nUse the stream() function if the size of the request or response is so large that too much memory would be consumed if all the data exists in memory.\n\nIt returns a Node.js [event](https://nodejs.org/api/events.html) emitter which may be used to receive events containing data (or error) as it becomes available.\n\n\u003e IS services that contain request and response elements which do not support the 'application/json' content are unsupported.  In this case, additional steps are required such as writing it an IS service which calls the unsupported service.\n\n\n```js\nvar listener = app.stream( service, 'POST', reqStream);\nlistener.on(app.CHUNK, (data) =\u003e {\n    let statusCode = data[app.STATUS_CODE];           \n    let myBuffer = data[app.RESPONSE]);\n    .\n    .\n    .\n});\nlistener.on(app.END, (data) =\u003e {             \n    let statusCode = data[app.STATUS_CODE];           \n    let myBuffer = data[app.RESPONSE]);\n    .\n    .\n    .\n});\nlistener.on(app.ERROR, (data) =\u003e {\n\n    let e = data[app.ERROR];\n    let reason = data[app.REASON];\n});\n```\n\n### Request\n\n| in/out | param | required | contents | example |\n| -----  | ----- | -------- | -------  | ------- |\n| in     | service | yes    | fully qualified IS servicename | wm.server:ping |\n| in     | method | yes | HTTP GET or POST | GET, POST |\n| in     | reqStream | no | request [stream](https://nodejs.org/api/stream.html) | See POST example below | \n| in     | headers | no | JSON object of optional additional HTTP request headers | {'Accept':'application/json'} |\n| out    | listener | - | [event](https://nodejs.org/api/events.html) emitter to listen for response events.| See  'Response' section for more details.\n\n\n### Response\nThe format for the promise's data object.\n\n| event type   | contents | example | \n| ------   | -------- | -------- |\n|  data[app.RESPONSE] | A chunk of Node.js API [buffer](https://nodejs.org/api/buffer.html) | \u003cBuffer 7b 20 22 72 6f 77 73 22 20 3a 20 5b 0a 20 20 7b 20 22 30 22 3a 20 22 31 32 33 34 35 36 37 38 39 30 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 ... \u003e |\n| data[app.END] | Signals the last chunk of data has arrived for the response. (This chunk does not have to contain data.) | -\n| data[app.ERROR] | Contains a JSON object with two keys: app.ERROR key to a javascript [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object and app.REASON key to an optional reason string | { \"error\" : err object, \"reason\": \"An optional message\"}\n\n \nPOST example\n```js\nPOST example\n```js\nvar app = require('wm-is-client');\nvar stream = require('stream');\n  .\n  .\n  .\n\nlet sRequest = \"{\\\"row\\\": 2000000, \\\"chunk\\\": 100}\";\nlet reqStream = new stream.PassThrough();\nreqStream.write(sRequest);\nreqStream.end();\nvar listener = app.stream( 'pub:DataPump', 'POST', reqStream);\nlistener.on(app.CHUNK, (data) =\u003e {\n    console.log('Chunk of response received');\n    let statusCode = data[app.STATUS_CODE];           \n    let myBuffer = data[app.RESPONSE]);\n    .\n    .\n    .\n});\nlistener.on(app.END, (data) =\u003e {             \n    console.log('Response received');\n    let statusCode = data[app.STATUS_CODE];           \n    let myBuffer = data[app.RESPONSE]);\n    .\n    .\n    .\n});\nlistener.on(app.ERROR, (data) =\u003e {\n\n    let e = data[app.ERROR];\n    let reason = data[app.REASON];\n});\n\n        var jResponse = JSON.parse( data[app.RESPONSE] );\n\n}).catch(function(err) {\n    console.log(`Execute err: ${err[app.ERROR]}`);\n    console.log(`Reason? ${err[app.REASON]}`);\n});  \n\n```\n\n\u003e Refer to the bin/cli-test.js source for a more complete example that writes the chunks of data to a text file.\n\n# TroubleShooting\n\nQuestions may be submitted via email to npm-cirrus@softwareag.com.\n## Logging\nwm-is-client supports two loggers in its configuration.\n\n1. console\n2. file path\n\nBy default, nothing is written to the console log and information is written to a 'log.json' file in a .wm-is-client folder in the user's home directory.\n```js\n  'logger' : {    \n      'level' : 'info',  // info, debug\n      // skipped if null, or set to process.stdout or process.stderr\n      'console' : null,\n      // if null, the default is to ~/.wm-is-client/log.json when logger is created\n      'path' : null \n  },\n```\n\u003e (Windows example)\n```\n C:\\\u003edir %USERPROFILE%\\.wm-is-client\\log.json\n Volume in drive C is SYS\n Volume Serial Number is 7431-F125\n\n Directory of C:\\Users\\usawco\\.wm-is-client\n\n03/24/2018  04:51 PM               372 log.json\n               1 File(s)            372 bytes\n```\n\n## Node.js trace facility\nThe node tracing functionality is supported. The following example demonstrates trace logging for this package as well as Node's core HTTP module.\n\nNote: wm-is-client does not display the password included with the config object passed to its connect function.\n\n```\n$ NODE_DEBUG=http,wm-is-client is-client post pub:DataPump -x \"{ \\\"rowCount\\\": 3, \\\"chunkCount\\\" : 3 }\"\n\nWM-IS-CLIENT 28754: wm-is-client client.js Config: {\n    \"logger\": {\n        \"level\": \"info\",\n        \"path\": \"/home/user/dev/git/njs/wm-is-client/logs/wm-is-client.log\"\n    },\n    \"timeout\": {\n        \"connect\": 30000,\n        \"read\": 30000\n    },\n    \"auth\": {\n        \"basic\": {\n            \"user\": \"Administrator\",\n            \"pass\": \"xxxxxxx\"\n        }\n    },\n    \"tls\": {\n        \"ca\": \"/home/user/dev/git/njs/wm-is-client/test/fixtures/pem/ssos-ca.pem\",\n        \"trust\": \"/home/user/dev/git/njs/wm-is-client/test/fixtures/pem/ssos-trust.pem\",\n        \"key\": \"/home/user/dev/git/njs/wm-is-client/test/fixtures/pem/ssos-key.pem\",\n        \"passphrase\": \"manage\"\n    },\n    \"http\": {\n        \"agent\": {\n            \"keepAlive\": true,\n            \"keepAliveMsecs\": 1000,\n            \"maxSockets\": 256,\n            \"maxFreeSockets\": 256\n        },\n        \"protocol\": \"http:\",\n        \"hostname\": \"localhost\",\n        \"headers\": {\n            \"Accept\": \"application/json\"\n        },\n        \"port\": \"5555\"\n    }\n}\nWM-IS-CLIENT 28754: Creating connect Promise: \nWM-IS-CLIENT 28754: Connecting to: http://localhost:5555 with user: Administrator. Password provided? true\nWM-IS-CLIENT 28754: connect() options: {\n    \"protocol\": \"http:\",\n    \"hostname\": \"localhost\",\n    \"port\": \"5555\",\n    \"headers\": {\n        \"Authorization\": \"Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=\",\n        \"Content-Type\": \"application/x-www-form-urlencoded\"\n    },\n    \"timeout\": 30000,\n    \"method\": \"GET\",\n    \"path\": \"/\"\n}\nHTTP 28754: call onSocket 0 0\nHTTP 28754: createConnection localhost:5555: { servername: 'localhost',\n  passphrase: 'manage',\n  key: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0d 0a 50 72 6f 63 2d 54 79 70 65 3a 20 34 2c 45 4e 43 52 ... \u003e,\n  cert: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e,\n  maxFreeSockets: 256,\n  maxSockets: 256,\n  keepAliveMsecs: 1000,\n  keepAlive: true,\n  ca: \n   [ \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e ],\n  agent: \n   Agent {\n     domain: null,\n     _events: { free: [Function] },\n     _eventsCount: 1,\n     _maxListeners: undefined,\n     defaultPort: 80,\n     protocol: 'http:',\n     options: \n      { passphrase: 'manage',\n        key: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0d 0a 50 72 6f 63 2d 54 79 70 65 3a 20 34 2c 45 4e 43 52 ... \u003e,\n        ca: [Array],\n        cert: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e,\n        port: '5555',\n        host: 'localhost',\n        maxFreeSockets: 256,\n        maxSockets: 256,\n        keepAliveMsecs: 1000,\n        keepAlive: true,\n        path: null },\n     requests: {},\n     sockets: { 'localhost:5555:': [] },\n     freeSockets: {},\n     keepAliveMsecs: 1000,\n     keepAlive: true,\n     maxSockets: 256,\n     maxFreeSockets: 256 },\n  path: null,\n  method: 'GET',\n  timeout: 30000,\n  headers: \n   { Authorization: 'Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=',\n     'Content-Type': 'application/x-www-form-urlencoded' },\n  port: '5555',\n  hostname: 'localhost',\n  protocol: 'http:',\n  host: 'localhost',\n  _agentKey: 'localhost:5555:' }\nHTTP 28754: sockets localhost:5555: 1\nWM-IS-CLIENT 28754: msConnTimeout set to 30000 milliseconds\nHTTP 28754: outgoing message end.\nWM-IS-CLIENT 28754: Request sent.\nHTTP 28754: AGENT incoming response!\nHTTP 28754: AGENT isHeadResponse false\nWM-IS-CLIENT 28754: Response arriving... (200)\nWM-IS-CLIENT 28754: cookie: ssnid=4b22108c1daf41afa2d4fd8d1acc7607; path=/; HttpOnly\nWM-IS-CLIENT 28754: Executing serviceStream: pub:DataPump on localhost:5555\nWM-IS-CLIENT 28754: Executing serviceExecute: /invoke/pub:DataPump on localhost:5555\nWM-IS-CLIENT 28754: (inPromise)serviceExecute: {\n    \"protocol\": \"http:\",\n    \"hostname\": \"localhost\",\n    \"port\": \"5555\",\n    \"headers\": {\n        \"Authorization\": \"Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=\",\n        \"Content-Type\": \"application/json\",\n        \"Transfer-Encoding\": \"chunked\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": [\n            \"ssnid=4b22108c1daf41afa2d4fd8d1acc7607; path=/; HttpOnly\"\n        ]\n    },\n    \"timeout\": 30000,\n    \"method\": \"POST\",\n    \"path\": \"/invoke/pub:DataPump\"\n}\nHTTP 28754: call onSocket 1 0\nHTTP 28754: createConnection localhost:5555: { servername: 'localhost',\n  passphrase: 'manage',\n  key: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0d 0a 50 72 6f 63 2d 54 79 70 65 3a 20 34 2c 45 4e 43 52 ... \u003e,\n  ca: \n   [ \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e ],\n  cert: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e,\n  maxFreeSockets: 256,\n  maxSockets: 256,\n  keepAliveMsecs: 1000,\n  keepAlive: true,\n  agent: \n   Agent {\n     domain: null,\n     _events: { free: [Function] },\n     _eventsCount: 1,\n     _maxListeners: undefined,\n     defaultPort: 80,\n     protocol: 'http:',\n     options: \n      { passphrase: 'manage',\n        key: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0d 0a 50 72 6f 63 2d 54 79 70 65 3a 20 34 2c 45 4e 43 52 ... \u003e,\n        ca: [Array],\n        cert: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e,\n        port: '5555',\n        host: 'localhost',\n        maxFreeSockets: 256,\n        maxSockets: 256,\n        keepAliveMsecs: 1000,\n        keepAlive: true,\n        path: null },\n     requests: {},\n     sockets: { 'localhost:5555:': [Array] },\n     freeSockets: {},\n     keepAliveMsecs: 1000,\n     keepAlive: true,\n     maxSockets: 256,\n     maxFreeSockets: 256 },\n  path: null,\n  method: 'POST',\n  timeout: 30000,\n  headers: \n   { Authorization: 'Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=',\n     'Content-Type': 'application/json',\n     'Transfer-Encoding': 'chunked',\n     Accept: 'application/json',\n     Cookie: [ 'ssnid=4b22108c1daf41afa2d4fd8d1acc7607; path=/; HttpOnly' ] },\n  port: '5555',\n  hostname: 'localhost',\n  protocol: 'http:',\n  host: 'localhost',\n  _agentKey: 'localhost:5555:' }\nHTTP 28754: sockets localhost:5555: 2\nWM-IS-CLIENT 28754: msReadTimeout set to 30000 milliseconds\nWM-IS-CLIENT 28754: Creating disconnect Promise chain to gracefully ask server to shutdown this session\nWM-IS-CLIENT 28754: Executing serviceExecute: /invoke/wm.server:disconnect on localhost:5555\nWM-IS-CLIENT 28754: (inPromise)serviceExecute: {\n    \"protocol\": \"http:\",\n    \"hostname\": \"localhost\",\n    \"port\": \"5555\",\n    \"headers\": {\n        \"0\": \"a\",\n        \"1\": \"p\",\n        \"2\": \"p\",\n        \"3\": \"l\",\n        \"4\": \"i\",\n        \"5\": \"c\",\n        \"6\": \"a\",\n        \"7\": \"t\",\n        \"8\": \"i\",\n        \"9\": \"o\",\n        \"10\": \"n\",\n        \"11\": \"/\",\n        \"12\": \"j\",\n        \"13\": \"s\",\n        \"14\": \"o\",\n        \"15\": \"n\",\n        \"Authorization\": \"Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=\",\n        \"Content-Type\": \"application/json\",\n        \"Transfer-Encoding\": \"chunked\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": [\n            \"ssnid=4b22108c1daf41afa2d4fd8d1acc7607; path=/; HttpOnly\"\n        ]\n    },\n    \"timeout\": 30000,\n    \"method\": \"GET\",\n    \"path\": \"/invoke/wm.server:disconnect\"\n}\nHTTP 28754: call onSocket 2 0\nHTTP 28754: createConnection localhost:5555: { servername: 'localhost',\n  passphrase: 'manage',\n  key: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0d 0a 50 72 6f 63 2d 54 79 70 65 3a 20 34 2c 45 4e 43 52 ... \u003e,\n  ca: \n   [ \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e ],\n  cert: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e,\n  maxFreeSockets: 256,\n  maxSockets: 256,\n  keepAliveMsecs: 1000,\n  keepAlive: true,\n  agent: \n   Agent {\n     domain: null,\n     _events: { free: [Function] },\n     _eventsCount: 1,\n     _maxListeners: undefined,\n     defaultPort: 80,\n     protocol: 'http:',\n     options: \n      { passphrase: 'manage',\n        key: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 52 53 41 20 50 52 49 56 41 54 45 20 4b 45 59 2d 2d 2d 2d 2d 0d 0a 50 72 6f 63 2d 54 79 70 65 3a 20 34 2c 45 4e 43 52 ... \u003e,\n        ca: [Array],\n        cert: \u003cBuffer 2d 2d 2d 2d 2d 42 45 47 49 4e 20 43 45 52 54 49 46 49 43 41 54 45 2d 2d 2d 2d 2d 0d 0a 4d 49 49 44 62 7a 43 43 41 6c 65 67 41 77 49 42 41 67 49 45 42 ... \u003e,\n        port: '5555',\n        host: 'localhost',\n        maxFreeSockets: 256,\n        maxSockets: 256,\n        keepAliveMsecs: 1000,\n        keepAlive: true,\n        path: null },\n     requests: {},\n     sockets: { 'localhost:5555:': [Array] },\n     freeSockets: {},\n     keepAliveMsecs: 1000,\n     keepAlive: true,\n     maxSockets: 256,\n     maxFreeSockets: 256 },\n  path: null,\n  method: 'GET',\n  timeout: 30000,\n  headers: \n   { '0': 'a',\n     '1': 'p',\n     '2': 'p',\n     '3': 'l',\n     '4': 'i',\n     '5': 'c',\n     '6': 'a',\n     '7': 't',\n     '8': 'i',\n     '9': 'o',\n     '10': 'n',\n     '11': '/',\n     '12': 'j',\n     '13': 's',\n     '14': 'o',\n     '15': 'n',\n     Authorization: 'Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=',\n     'Content-Type': 'application/json',\n     'Transfer-Encoding': 'chunked',\n     Accept: 'application/json',\n     Cookie: [ 'ssnid=4b22108c1daf41afa2d4fd8d1acc7607; path=/; HttpOnly' ] },\n  port: '5555',\n  hostname: 'localhost',\n  protocol: 'http:',\n  host: 'localhost',\n  _agentKey: 'localhost:5555:' }\nHTTP 28754: sockets localhost:5555: 3\nWM-IS-CLIENT 28754: msReadTimeout set to 30000 milliseconds\nWM-IS-CLIENT 28754: Flushing request... Now transition wm-is-client state to shutdown\nHTTP 28754: outgoing message end.\nWM-IS-CLIENT 28754: ### stream() sending request chunks\nHTTP 28754: write ret = false\nWM-IS-CLIENT 28754: ##### Drain event fired from stream()\nWM-IS-CLIENT 28754: ### stream() completed sending request\nHTTP 28754: outgoing message end.\nHTTP 28754: AGENT incoming response!\nHTTP 28754: AGENT isHeadResponse false\nWM-IS-CLIENT 28754: Receiving response... status code: 200\nWM-IS-CLIENT 28754: on data event. data.length = 16\nHTTP 28754: AGENT socket keep-alive\nWM-IS-CLIENT 28754: Response received... status code: (200)  Pending request count? 1 Shutdown? true\nHTTP 28754: CLIENT socket onFree\nHTTP 28754: agent.on(free) localhost:5555:\nHTTP 28754: removeSocket localhost:5555: writable: true\nHTTP 28754: AGENT incoming response!\nHTTP 28754: AGENT isHeadResponse false\nWM-IS-CLIENT 28754: Response status code:200\nWM-IS-CLIENT 28754: Received 'on' data event. data.length = 171\n{ \"rows\" : [\n  { \"0\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"1\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" },\n  { \"2\": \"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ\" }\n  ]\n}\nHTTP 28754: AGENT socket keep-alive\nWM-IS-CLIENT 28754: Received 'end' data event. Pending requests count: 0\nWM-IS-CLIENT 28754: shutdownAgent() cleanup to close agent: localhost:5555:\nHTTP 28754: CLIENT socket onFree\nHTTP 28754: agent.on(free) localhost:5555:\nHTTP 28754: CLIENT socket onClose\nHTTP 28754: removeSocket localhost:5555: writable: false\nHTTP 28754: CLIENT socket onClose\nHTTP 28754: removeSocket localhost:5555: writable: false\nHTTP 28754: HTTP socket close\nHTTP 28754: CLIENT socket onClose\nHTTP 28754: removeSocket localhost:5555: writable: false\n$ \n```\n\n## Configuration\nA configuration object is included in the API and is defined by config.js contents. This object should only hold static content that will not change while a connection is made to an Integration Server. \n\u003e Modifying a connected configuration will lead to unpredictable results.\n\n\n\n\n# License\nApache-2.0\nhttps://www.apache.org/licenses/LICENSE-2.0\n\n\n# Miscellaneous\n\n## Authentication\nOnly Basic Auth is supported at this time.\n\n## i18n\nBasic message translation is supported using 'i18n' and 'os-locale' packages. \n\n## logging\nUsing the 'bunyan' package, but this is not exposed in the API.\n\n\n## Error Response \u003ca id=\"error_resp\"/\u003e\n\nThe API functions return a json object containing two elements\n\n* error - optional Javascript [Error object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error \"JS Reference\")\n* reason - optional string object\n\n\n  data[app.ERR] - exception object if available\n  data[app.REASON] - reason if available\n\n_____________________\n \nThese tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.\n\n_____________________\n \nFor more information you can Ask a Question in the [TECHcommunity Forums](https://tech.forums.softwareag.com/tags/c/forum/1/webMethods).\n\nYou can find additional information in the [Software AG TECHcommunity](https://tech.forums.softwareag.com/tag/webmethods).\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSoftwareAG%2Fwm-is-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSoftwareAG%2Fwm-is-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSoftwareAG%2Fwm-is-client/lists"}