How to use the ws.WSRequest function in ws

To help you get started, we’ve selected a few ws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wso2 / carbon-device-mgt / components / device-mgt / org.wso2.carbon.device.mgt.ui / src / main / resources / jaggeryapps / devicemgt / app / modules / oauth / token-protected-service-invokers.js View on Github external
privateMethods["initiateWSRequest"] = function (action, endpoint, successCallback,
                                                    errorCallback, soapVersion, payload) {
        var ws = require("ws");
        //noinspection JSUnresolvedFunction
        var wsRequest = new ws.WSRequest();
        var options = [];
        if (devicemgtProps["isOAuthEnabled"]) {
            var accessToken = privateMethods.getAccessToken();
            if (accessToken) {
                var authenticationHeaderName = String(constants["AUTHORIZATION_HEADER"]);
                var authenticationHeaderValue = String(constants["BEARER_PREFIX"] + accessToken);
                var headers = [];
                var oAuthAuthenticationData = {};
                oAuthAuthenticationData.name = authenticationHeaderName;
                oAuthAuthenticationData.value = authenticationHeaderValue;
                headers.push(oAuthAuthenticationData);
                options.HTTPHeaders = headers;
            } else {
                response.sendRedirect(devicemgtProps["appContext"] + "login");
            }
        }
github wso2 / carbon-device-mgt / features / base-ui-feature / org.wso2.carbon.devicemgt.ui.feature / src / main / resources / jaggeryapps / devicemgt / modules / backend-service-invoker.js View on Github external
function initiateWSRequest(action, endpoint, payload, successCallback, errorCallback, soapVersion) {
        var ws = require('ws');
        var wsRequest = new ws.WSRequest();
        var options = new Array();
        if (IS_OAUTH_ENABLED) {
            var accessToken = session.get(constants.ACCESS_TOKEN_PAIR_IDENTIFIER).accessToken;
            if (!(!accessToken)) {
                var authenticationHeaderName = String(constants.AUTHORIZATION_HEADER);
                var authenticationHeaderValue = String(constants.BEARER_PREFIX + accessToken);
                var headers = [];
                var oAuthAuthenticationData = {};
                oAuthAuthenticationData.name = authenticationHeaderName;
                oAuthAuthenticationData.value = authenticationHeaderValue;
                headers.push(oAuthAuthenticationData);
                options.HTTPHeaders = headers;
            }
        }
        options.useSOAP = soapVersion;
        options.useWSA = constants.WEB_SERVICE_ADDRESSING_VERSION;
github wso2 / carbon-device-mgt / components / cdmf-base-ui / org.wso2.carbon.device.mgt.ui / src / main / resources / jaggeryapps / devicemgt / app / modules / backend-service-invoker.js View on Github external
function initiateWSRequest(action, endpoint, payload, successCallback, errorCallback, soapVersion) {
        var ws = require('ws');
        var wsRequest = new ws.WSRequest();
        var options = new Array();
        if (IS_OAUTH_ENABLED) {
            var accessToken = getAccessToken();
            if (!(!accessToken)) {
                var authenticationHeaderName = String(constants.AUTHORIZATION_HEADER);
                var authenticationHeaderValue = String(constants.BEARER_PREFIX + accessToken);
                var headers = [];
                var oAuthAuthenticationData = {};
                oAuthAuthenticationData.name = authenticationHeaderName;
                oAuthAuthenticationData.value = authenticationHeaderValue;
                headers.push(oAuthAuthenticationData);
                options.HTTPHeaders = headers;
            }
        }
        options.useSOAP = soapVersion;
        options.useWSA = constants.WEB_SERVICE_ADDRESSING_VERSION;
github wso2 / carbon-device-mgt / features / cdmf-base-ui / org.wso2.carbon.devicemgt.ui.feature / src / main / resources / jaggeryapps / devicemgt / modules / backend-service-invoker.js View on Github external
function initiateWSRequest(action, endpoint, payload, successCallback, errorCallback, soapVersion) {
        var ws = require('ws');
        var wsRequest = new ws.WSRequest();
        var options = new Array();
        if (IS_OAUTH_ENABLED) {
            var accessToken = session.get(constants.ACCESS_TOKEN_PAIR_IDENTIFIER).accessToken;
            if (!(!accessToken)) {
                var authenticationHeaderName = String(constants.AUTHORIZATION_HEADER);
                var authenticationHeaderValue = String(constants.BEARER_PREFIX + accessToken);
                var headers = [];
                var oAuthAuthenticationData = {};
                oAuthAuthenticationData.name = authenticationHeaderName;
                oAuthAuthenticationData.value = authenticationHeaderValue;
                headers.push(oAuthAuthenticationData);
                options.HTTPHeaders = headers;
            }
        }
        options.useSOAP = soapVersion;
        options.useWSA = constants.WEB_SERVICE_ADDRESSING_VERSION;
github wso2 / product-es / modules / jaggery-modules / registration / module / scripts / registration.js View on Github external
(function() {

	var log = new Log();

	var ws = require('ws');
	var request = new ws.WSRequest();
	var options = new Array();
	this.urlWs = "https://localhost:9443/services/UserAdmin/";



	this.addNewUser = function(skey, userName, password) {
		//log.info("module " + skey + userName + password)
		options.useSOAP = 1.2;
		options.useWSA = 1.0;
		options.action = "urn:addUser";
		options["HTTPHeaders"] = [{
			name : "Cookie",
			value : "JSESSIONID=" + skey
		}];
		var payload = '' + userName + '' + password + '';
		var result;

ws

Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js

MIT
Latest version published 6 months ago

Package Health Score

89 / 100
Full package analysis