Я пытаюсь вызвать SOAP API (который имеет локальную версию Blue Prism) из Интернета. Его всегда бросает http://rfg-lt01029:8181/ws/Centrix?wsdl net::ERR_INVALID_HTTP_RESPONSE
. Этот WSDL предназначен для запуска процесса в blueprism.
Ниже приведен код, который я использую
<html>
<head>
<title>SOAP JavaScript Client Test</title>
<script type="text/javascript">
function soap() {
var data = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:blueprism:webservice:centrix\"> <soapenv:Header/> <soapenv:Body> <urn:Centrix soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"> <processType xsi:type=\"xsd:decimal\">1</processType> </urn:Centrix> </soapenv:Body></soapenv:Envelope>";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://rfg-lt01029:8181/ws/Centrix?wsdl");
xhr.setRequestHeader("Authorization", "Basic <password>");
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.send(data);
console.log('next req');
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', ' http://rfg-lt01029:8181/ws/Centrix?wsdl', true);
//xmlhttp.setRequestHeader("Authorization", "Basic " + btoa('username' + ":" + 'password'));
// build SOAP request
var sr =
'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:blueprism:webservice:centrix">'+
'<soapenv:Header/> '+
'<soapenv:Body> '+
'<urn:Centrix soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> '+
'<processType xsi:type="xsd:decimal">1</processType> '+
'</urn:Centrix> '+
'</soapenv:Body> '+
"</soapenv:Envelope>" ;
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert(xmlhttp.responseText);
// alert('done. use firebug/console to see network response');
}
}
}
// Send the POST request
//xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send('');
// send request
// ...
}
</script>
</head>
<body>
<form name="Demo" action="" method="post">
<div>
<input type="button" value="Soap" onclick="soap();" />
</div>
</form>
</body>
</html> <!-- typo -->```