mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
Fixed WSMAN parsing.
This commit is contained in:
parent
1deacd93b3
commit
3c3d5c1687
@ -38,9 +38,18 @@ function WsmanStackCreateService(comm)
|
|||||||
obj.PerformAjax = function PerformAjax(postdata, callback, tag, pri, namespaces) {
|
obj.PerformAjax = function PerformAjax(postdata, callback, tag, pri, namespaces) {
|
||||||
if (namespaces == null) namespaces = '';
|
if (namespaces == null) namespaces = '';
|
||||||
obj.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns=\"http://www.w3.org/2003/05/soap-envelope\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) {
|
obj.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns=\"http://www.w3.org/2003/05/soap-envelope\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) {
|
||||||
if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; }
|
var wsresponse = null;
|
||||||
var wsresponse = obj.xmlParser.ParseWsman(data);
|
if (data != null) { try { wsresponse = obj.xmlParser.ParseWsman(data); } catch (ex) { } }
|
||||||
if (!wsresponse || wsresponse == null) { callback(obj, null, { Header: { HttpError: status } }, 601, tag); } else { callback(obj, wsresponse.Header["ResourceURI"], wsresponse, 200, tag); }
|
if ((data != null) && (!wsresponse || wsresponse == null) && (status == 200)) {
|
||||||
|
callback(obj, null, { Header: { HttpError: status } }, 601, tag);
|
||||||
|
} else {
|
||||||
|
if (status != 200) {
|
||||||
|
if (wsresponse == null) { wsresponse = { Header: {} }; }
|
||||||
|
wsresponse.Header.HttpError = status;
|
||||||
|
try { wsresponse.Header.WsmanError = wsresponse.Body['Reason']['Text']['Value']; } catch (ex) { }
|
||||||
|
}
|
||||||
|
callback(obj, wsresponse.Header['ResourceURI'], wsresponse, status, tag);
|
||||||
|
}
|
||||||
}, tag, pri);
|
}, tag, pri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user