调用soap服务会引发404错误,但在SOAP UI中工作正常。某处我发现这可能是由于CORS问题所以我将标题设置为“访问控制 - 允许 - 来源”':' *'但没有运气
以下是我如何致电服务
let _this=this;
var webServiceURL = 'http://localhost:8082/ode/processes/WS_Invocation.WS_InvocationPort';
var soapMessage = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.invocation.tps"><soapenv:Header/><soapenv:Body><ws:WS_InvocationRequest><ws:input>1</ws:input><ws:input1>Mohan</ws:input1></ws:WS_InvocationRequest></soapenv:Body></soapenv:Envelope>'
$.ajax({
url: _this.webServiceURL,
type: "POST",
dataType: "xml",
crossDomain: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
data: _this.soapMessage,
contentType: "text/xml; charset=\"utf-8\"",
success: _this.OnSuccess,
error: _this.OnError
});
答案 0 :(得分:0)
你应该在你的API服务中为所有人启用CORS是CORS问题,每个平台都有不同的配置,如NodeJS,Apache,Nginx等。
您可以在此处查看有关如何在此处激活网络服务中的CORS的文档https://enable-cors.org/index.html
请求你可以做这样的事情
val nums = List(-1.2200000000000006, -1.3200000000000003, -1.0099999999999998,
22.22, 11.11, -31.310000000000002, -0.9799999999999986, 2.959999999999999)
nums.foldLeft(List[Double]()){
case (l,n) if n < 0 => if (l.isEmpty) List(n) else n + l.head :: l.tail
case (l, _) => Double.MinValue :: l
}.max
// res0: Double = -3.5500000000000007
问候。