From 82af507c8f850669e6631db09d8072dfd026dbe6 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2026 05:14:03 +0000 Subject: [PATCH] fix(MESHAGEN-006-2): 2 review findings in amt-wsman.js --- modules/amt-wsman.js | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/amt-wsman.js b/modules/amt-wsman.js index 717fd4c96..9863e85bf 100644 --- a/modules/amt-wsman.js +++ b/modules/amt-wsman.js @@ -40,7 +40,8 @@ function WsmanStackCreateService(/*CreateWsmanComm, host, port, user, pass, tls, if (CreateWsmanComm) { obj.comm = new CreateWsmanComm(arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]); } } - obj.PerformAjax = function PerformAjax(postdata, callback, tag, pri, namespaces) { + obj.PerformAjax = function PerformAjax(postdata, callback, tag, pri, namespaces) + { if (namespaces == null) namespaces = ''; obj.comm.PerformAjax('
' + postdata, function (data, status, tag) { if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; } @@ -62,7 +63,8 @@ function WsmanStackCreateService(/*CreateWsmanComm, host, port, user, pass, tls, } // Perform a WSMAN Subscribe operation - obj.ExecSubscribe = function ExecSubscribe(resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) { + obj.ExecSubscribe = function ExecSubscribe(resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) + { var digest = "", digest2 = "", opaque = ""; if (user != null && pass != null) { digest = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken' + user + '' + pass + ''; digest2 = ''; } if (opaque != null) { opaque = '' + opaque + ''; } @@ -72,19 +74,22 @@ function WsmanStackCreateService(/*CreateWsmanComm, host, port, user, pass, tls, } // Perform a WSMAN UnSubscribe operation - obj.ExecUnSubscribe = function ExecUnSubscribe(resuri, callback, tag, pri, selectors) { + obj.ExecUnSubscribe = function ExecUnSubscribe(resuri, callback, tag, pri, selectors) + { var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous" + _PutObjToSelectorsXml(selectors) + '
'; obj.PerformAjax(data + "
", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"'); } // Perform a WSMAN PUT operation - obj.ExecPut = function ExecPut(resuri, putobj, callback, tag, pri, selectors) { + obj.ExecPut = function ExecPut(resuri, putobj, callback, tag, pri, selectors) + { var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S" + _PutObjToSelectorsXml(selectors) + '' + _PutObjToBodyXml(resuri, putobj); obj.PerformAjax(data + "", callback, tag, pri); } // Perform a WSMAN CREATE operation - obj.ExecCreate = function ExecCreate(resuri, putobj, callback, tag, pri, selectors) { + obj.ExecCreate = function ExecCreate(resuri, putobj, callback, tag, pri, selectors) + { var objname = obj.GetNameFromUrl(resuri); var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S" + _PutObjToSelectorsXml(selectors) + ""; for (var n in putobj) { data += "" + putobj[n] + "" } @@ -92,35 +97,41 @@ function WsmanStackCreateService(/*CreateWsmanComm, host, port, user, pass, tls, } // Perform a WSMAN DELETE operation - obj.ExecDelete = function ExecDelete(resuri, putobj, callback, tag, pri) { + obj.ExecDelete = function ExecDelete(resuri, putobj, callback, tag, pri) + { var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S" + _PutObjToSelectorsXml(putobj) + ""; obj.PerformAjax(data, callback, tag, pri); } // Perform a WSMAN GET operation - obj.ExecGet = function ExecGet(resuri, callback, tag, pri) { + obj.ExecGet = function ExecGet(resuri, callback, tag, pri) + { obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S", callback, tag, pri); } // Perform a WSMAN method call operation - obj.ExecMethod = function ExecMethod(resuri, method, args, callback, tag, pri, selectors) { + obj.ExecMethod = function ExecMethod(resuri, method, args, callback, tag, pri, selectors) + { var argsxml = ""; for (var i in args) { if (args[i] != null) { if (Array.isArray(args[i])) { for (var x in args[i]) { argsxml += "" + args[i][x] + ""; } } else { argsxml += "" + args[i] + ""; } } } obj.ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors); } // Perform a WSMAN method call operation. The arguments are already formatted in XML. - obj.ExecMethodXml = function ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors) { + obj.ExecMethodXml = function ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors) + { obj.PerformAjax(resuri + "/" + method + "" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S" + _PutObjToSelectorsXml(selectors) + "" + argsxml + "", callback, tag, pri); } // Perform a WSMAN ENUM operation - obj.ExecEnum = function ExecEnum(resuri, callback, tag, pri) { + obj.ExecEnum = function ExecEnum(resuri, callback, tag, pri) + { obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S", callback, tag, pri); } // Perform a WSMAN PULL operation - obj.ExecPull = function ExecPull(resuri, enumctx, callback, tag, pri) { + obj.ExecPull = function ExecPull(resuri, enumctx, callback, tag, pri) + { obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull" + obj.Address + "" + resuri + "" + (obj.NextMessageId++) + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S" + enumctx + "99999999", callback, tag, pri); }