angular - Angular NGX-SOAP 请求获取 ERR_RESPONSE_HEADERS_TRUNCATED
问题描述
我目前在本地主机中,并试图向外部公共 SOAP 服务发出肥皂请求。我能够使用 Soap 客户端在 PHP localhost 上发出请求。但是现在我在提出请求时遇到了 Angular 问题。让我介绍一下我的代码。
首先是 WSDL 的在线版本 => HERE
模块的构造函数没有错误:
constructor(private soap: NgxSoapService, private httpClient: HttpClient, private snackBar: MatSnackBar, public dialog: MatDialog, private auth: AuthenticationService, private restApi: RestApi) {
let headers = new HttpHeaders({
'Content-Type': 'text/xml',
'Access-Control-Allow-Headers': 'origin, content-type, accept, authorization',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Methods': 'GET, POST',
});
this.soap.createClient('./assets/wsdl/CityService.wsdl', {headers: headers}).then(client => {
this.client = client;
})
.catch(function(error) {
console.log(error);
});
}
这是一个基本的 SOAP 请求函数。
makeAnExampleRequest() {
this.client.call('GetCities', {}).subscribe((res: ISoapMethodResponse) => console.log(res), (error) => console.error(error));
}
调用上述函数时,出现以下错误:
从控制台.错误(错误):
HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: "https://api.n11.com/ws/cityService/", ok: false, …}
headers: HttpHeaders
normalizedNames: Map(0) {}
lazyUpdate: null
headers: Map(0) {}
__proto__: Object
status: 0
statusText: "Unknown Error"
url: "https://api.n11.com/ws/cityService/"
ok: false
name: "HttpErrorResponse"
message: "Http failure response for https://api.n11.com/ws/cityService/: 0 Unknown Error"
error: ProgressEvent
isTrusted: true
lengthComputable: false
loaded: 0
total: 0
type: "error"
target: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "https://api.n11.com/ws/cityService/", __zone_symbol__loadfalse: Array(1), __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …}
currentTarget: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "https://api.n11.com/ws/cityService/", __zone_symbol__loadfalse: Array(1), __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …}
eventPhase: 0
bubbles: false
cancelable: false
defaultPrevented: false
composed: false
timeStamp: 3544.754999995348
srcElement: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "https://api.n11.com/ws/cityService/", __zone_symbol__loadfalse: Array(1), __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …}
returnValue: true
cancelBubble: false
path: []
__proto__: ProgressEvent
__proto__: HttpResponseBase
来自 zone-evergreen.js:
POST https://api.n11.com/ws/cityService/ net::ERR_RESPONSE_HEADERS_TRUNCATED
我用另一个需要身份验证对象的请求尝试了另一个 WSDL,我得到的只是同样的错误
解决方案
推荐阅读
- python - python中电报机器人中的回调和if条件
- python - 我收到错误 AttributeError: 'NoneType' 对象没有属性 'get'
- windows - Windows 是否有 docker 日志查看器或调试模式?
- google-workflows - 有没有办法暂停工作流程的执行?
- python - python中的参数类
- python - 我如何制作用户资料,以便我输入姓名、邮件等,然后保存,这样我就可以登录了
- python - Matplotlib pyplot 从张量中保存多个图像
- python - pytables 添加重复的子类作为列
- powershell - PowerShell:如何按顺序附加文本文件?
- python - 如何创建具有可变数量“for”循环的函数,每个循环都有不同的索引?