此代码正在调用Jasper服务器以使用SAML身份验证建立连接。当执行代码时,它跳到handleError例程,尽管它是200,但是仍然存在解析错误。 这是执行代码后的控制台信息
此代码正在调用Jasper服务器以使用SAML身份验证建立连接。当执行代码时,它跳到handleError例程,尽管它是200,但是仍然存在解析错误。 这是执行代码后的控制台信息
<p>
<i>
<code>
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
report
HTML1300: Navigation occurred.
report
In Report Component init
In connectToJasperconnected
[object Object]
{
[functions]: ,
__proto__: { },
error: { },
headers: { },
message: "Http failure during parsing for THE URL",
name: "HttpErrorResponse",
ok: false,
status: 200,
statusText: "OK",
Symbol(INITIAL_VALUE)_h.bdyrahld8ry: undefined,
Symbol(rxSubscriber)_g.bdyrahld8ry: undefined,
Symbol(rxSubscriber)_i.bdyrahld8ry: undefined,
url: "THE URL"
}
Server Error Status: 200 <-- coming from the error routine
Error Connecting to Jasper Server: [object Object] <-- coming from the error routine defined in component
</i>
<b>Component code</b>
ngOnInit(): void {
console.log('In Report Component init');
this.connectToJasper();
}
connectToJasper() {
this.samlConnectionService.
getSAMLConnection().
subscribe(
data => this.connected = true,
error => console.log('Error Connecting to Jasper Server: ' + error)
);
console.log('In connectToJasperconnected');
}
<b>Service code</b>
jasperSamlURL = 'THE URL';
getSAMLConnection(): Observable<any> {
// return this.httpClient.get<any>(this.jasperSamlURL, { responseType: 'text'})
// return this.httpClient.post<any>(this.jasperSamlURL, { observe: 'response'})
return this.httpClient.get(this.jasperSamlURL, { observe: 'response', responseType: 'text' })
.pipe(
tap(response => {
console.log('Http Response Status: ' + response.status);
console.log('Http Response text: ' + response.statusText);
console.log('Http Response Type: ' + response.type);
console.log('Http Response Body: ' + response.body);
}),
map(response => this.HttpResponseCode = response.status),
catchError(this.handleError)
);
}
public handleError(err) {
if (err instanceof HttpErrorResponse) {
// Server side Error
this.HttpResponseCode = err.status;
console.log(err);
console.log('Server Error Status: ' + err.status);
} else {
// Client side error
this.HttpResponseCode = err.status;
console.log('Client Error Status: ' + err.status);
}
return throwError(err);
}
</code>