我正在编写一个SOAP :: Lite客户端来处理SOAP服务器,该服务器有时会发送缺少命名空间规范的响应。这是我第一次使用SOAP做任何事情,所以我根本不是很了解。以下是一个示例回复:
HTTP/1.1 200 OK
Server: "OS/version" UPnP/1.0 "product/version"
Content-Length: 83219
Content-Type: text/xml; charset="UTF-8"
Client-Date: Tue, 01 Aug 2017 06:30:44 GMT
Client-Peer: 192.168.1.123:5000
Client-Response-Num: 1
<?xml version="1.0" encoding="UTF-6"?>
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<soap-env:Body>
<m:GetDataResponse
xmlns:m="urn:BLACKBOX:service:DataSource:1">
<DataBlob xsi:type="xsd:base64Binary">Ikf7SPJ...SsA==</DataBlob>
</m:GetDataResponse>
<ResponseCode>0</ResponseCode>
</soap-env:Body>
</soap-env:Envelope>
注意使用没有规范的'xsi'命名空间。 'xsd'也应该有一个? SOAP :: Lite给了我这个错误信息:
failed: Unresolved prefix 'xsi' for attribute 'xsi:type'
如果我无法控制服务器,我将如何解决客户端中的SOAP :: Lite问题?有没有办法让我告诉SOAP :: Lite假设我提供的命名空间?
答案 0 :(得分:0)
服务器坏了,你应该提出错误。同时,您可以通过编辑传入数据来添加
来使代码正常工作这些定义到r=3.0 # value over threshold 2.0
while [ $(expr $r \<= 2.0) -eq 0 ] # random until you get one <= 2.0
do
r=$(($RANDOM%3)).$(($RANDOM%10)) # random [012].[0-9]
done
echo $r # output it or not
元素
Envelope
答案 1 :(得分:0)
只需添加到SOAP :: Lite对象:
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit {
constructor(
private readonly location: Location
) { }
ngOnInit(): void {
this.location.replaceState("/");
}
}