使用此代码,我可以跳过“摘要式身份验证”步骤,并返回 export abstract class BaseUploadComponent extends ReactiveComponent implements OnInit {
accept = '*.*';
showPopup = false;
popMsg = 'Do you want to reupload file!';
description: string;
uploadFile: Dto.FileDescription;
@ViewChild('form') rootForm: ElementRef;
newUpload: Dto.UploadInfo = { type: this.uploadType, originalFileName: null, ident: this.ident };
previousFiles: Dto.FileDescription[];
protected ready = new Rx.Subject<void>();
protected abstract get ident(): string;
protected abstract get uploadType(): Dto.UploadType;
private rawData: string | ArrayBuffer;
constructor(
private _admin: Proxy.AdminProxy,
private _alertService: AlertService,
private _translate: TranslateService
) {
super();
this.ready.subscribe(() => this.refreshList());
}
private refreshList() {
this._admin.listVersions({ type: this.uploadType, ident: this.ident }).uiSignal('files list').subscribe(ret => this.previousFiles = ret.data);
}
}
。
这是我的VBscript代码:
200 ok
这是我的解码器响应:
Option Explicit
Dim restReq, url
Dim jsontext, headerText
Dim fso1 : Set fso1 = CreateObject("Scripting.FileSystemObject")
Dim file1 : Set file1 = fso1.OpenTextFile("\\uspmuusrichm1a\users-h\nguyenhv\2018\PP camera system M.1879\document\Axis decoder\myfile.txt", 2, True)
headerText = "username="&"root"&", "&"realm="&"axis"&", "&"nonce="&"cd0357704fb04263a8203225579087d7"&", "&"uri="&"/axis-cgi/decoder.cgi"&", "&"algorithm="&"MD5"&", "&"response="&"385e2c4ad1be0feb5b8fa453f88e1c1b"&", "&"opaque="&"384b4e29e47341b6a967d94dc6a2c7e2"
Set restReq = CreateObject("MSXML2.serverXMLHTTP")
url = "http://10.67.72.130/axis-cgi/decoder.cgi"
jsontext = "{"&"apiVersion"&": "&"1.0"&" ,"&"context"&": "&"123"&"1.0"&" ,"&"method"&": "&"getCapabilities"&"}"
restReq.open "POST", url, false
restReq.setRequestHeader "Content-Type","application/json"
restReq.setRequestHeader "authorization","Digest " & headerText
restReq.send (jsontext)
file1.WriteLine "Status_Response : " & restReq.Status
file1.WriteLine "HEADER_RESPONSE : " & restReq.getAllResponseHeaders
file1.WriteLine "BODY_RESPONSE : " & restReq.responseText
file1.Close
对于错误代码Decoder response
Status_Response : 200
HEADER_RESPONSE : Date: Sat, 31 Jan 1970 16:25:20 GMT
Content-Length: 101
Content-Type: text/html; charset=UTF-8
Server: TornadoServer/4.0.2
Vary: Accept-Encoding
BODY_RESPONSE : {"error": {"message": "None", "code": 202}, "context": "None", "apiVersion": "1.0", "method": "None"}
,根据解码器手册,错误代码“ 202”表示
无效的JSON。
这意味着我对请求的正文无效。
我从JSON文本字符串的翻译是:
202
但这似乎不正确吗?
最后的障碍,不胜感激!
答案 0 :(得分:1)
哈利路亚!
Vbscript
Option Explicit
Dim restReq, url
Dim jsontext, headerText
Dim fso1 : Set fso1 = CreateObject("Scripting.FileSystemObject")
Dim file1 : Set file1 = fso1.OpenTextFile("\\uspmuusrichm1a\users-h\nguyenhv\2018\PP camera system M.1879\document\Axis decoder\myfile.txt", 2, True)
headerText = "username="&"root"&", "&"realm="&"axis"&", "&"nonce="&"cd0357704fb04263a8203225579087d7"&", "&"uri="&"/axis-cgi/decoder.cgi"&", "&"algorithm="&"MD5"&", "&"response="&"385e2c4ad1be0feb5b8fa453f88e1c1b"&", "&"opaque="&"384b4e29e47341b6a967d94dc6a2c7e2"
Set restReq = CreateObject("MSXML2.serverXMLHTTP")
url = "http://10.67.72.130/axis-cgi/decoder.cgi"
jsontext = "{""apiVersion"": ""1.0"", ""context"": ""123"", ""method"": ""getCapabilities""}"
restReq.open "POST", url, false
restReq.setRequestHeader "Content-Type","application/json"
restReq.setRequestHeader "authorization","Digest " & headerText
restReq.send (jsontext)
file1.WriteLine "Status_Response : " & restReq.Status
file1.WriteLine "HEADER_RESPONSE : " & restReq.getAllResponseHeaders
file1.WriteLine "BODY_RESPONSE : " & restReq.responseText
file1.Close
解码器响应 状态响应:200 HEADER_RESPONSE:日期:1970年1月31日星期六18:49:39 GMT 内容长度:215 内容类型:text / html;字符集= UTF-8 伺服器:TornadoServer / 4.0.2 有所不同:接受编码
BODY_RESPONSE:{"data": {"audioCodecs": [], "overlappingPanes": "false", "videoCodecs": ["H.264", "MJPEG", "MPEG4"], "resolution": "1920x1080", "maxStreams": 16}, "context": "123", "apiVersion": "1.0", "method": "getCapabilities"}