我尝试使用node-soap模块,如下所示:
const soap = require('soap');
soap.createClient('some-wsdl-url', function(err, client) {
const args = {
'ValidateCustomerRequest': {
'memberNumber': 12345
}
};
client.ValidateCustomer(args, function(err, result) {
console.log(result);
});
});
Run Code Online (Sandbox Code Playgroud)
现在我收到了来自webservice的"无效格式"响应.为了调试这个,我非常想看看发送到webservice的实际XML是什么样的.
我已经尝试过这个:
require('request').debug = true
Run Code Online (Sandbox Code Playgroud)
......在另一个SO答案中提出了建议.
但输出没有帮助:
[ERROR] REQUEST { uri:
Url { ... },
method: 'GET',
headers:
{ 'User-Agent': 'node-soap/0.18.0',
Accept: 'text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding': 'none',
'Accept-Charset': 'utf-8',
Connection: 'close',
Host: 'xxx' },
followAllRedirects: true,
body: null,
callback: [Function] }
Run Code Online (Sandbox Code Playgroud)
我没有在那里看到我的"ValidateCustomerRequest"并且body是null.另外我想知道为什么方法是GET,不应该是POST吗?
那么这个调试输出看起来是否正常和/或是否有另一种方法来查看创建的XML请求?
在javascript中比较2个对象的最快方法是什么?
例如我有这两个对象:
a = [{'name': 'john', 'age': 22}, {'name': 'mike', 'age': 23}, {'name': 'anne', 'age': 12}, {'name': 'dan', 'age': 29}, {'name': 'jane', 'age': 34}]
b = [{'name': 'john', 'age': 22}, {'name': 'anne', 'age': 12}]
Run Code Online (Sandbox Code Playgroud)
通常,我会这样做:
for (var i = 0; i < a.length; i++) {
for (var j = 0; j < b.length; j++) {
console.log(a[i]) // => [{'name': 'john', 'age': 22}, {'name': 'anne', 'age': 12}]
}
}
Run Code Online (Sandbox Code Playgroud)
这花费的时间太长了,还有其他更快的方法吗?感谢您的时间!
我正在构建一个表单,可以选择为您的图标选择颜色
一切正常,唯一的问题是颜色选择器不会影响我的反应形式的值。我尝试了很多方法来构建第二个输入字段,强制它的值,然后使用它,getter 函数,并将其用作表单值。
color!: string;
get colorChange() {
let newColor:string;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return newColor = this.color
}
categoryForm!: FormGroup;
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
isSubmitted: boolean = false;
constructor(private _fb: FormBuilder, private _categoriesService: CategoriesService, private toastr: ToastrService, private location: Location, private route:ActivatedRoute) { }
ngOnInit(): void {
this.categoryForm = this._fb.group({
name: ['', [Validators.required, Validators.minLength(6)]],
icon: ['', [Validators.required]],
color: [this.colorChange, [Validators.required]]
});
this._checkEditMode();
}
Run Code Online (Sandbox Code Playgroud)
<div class="category">
<h1 class="h1"> {{title}}</h1>
<div class="card">
<form class="my-3 mx-3" [formGroup]="categoryForm" (ngSubmit)="onSubmit()">
<div class="mb-3">
<label for="exampleInputName" class="form-label">Category Name</label> …
Run Code Online (Sandbox Code Playgroud)