var url = "https://wstest.creditinfo.co.ma/WsMonitoring/PublicService.svc?singleWsdl";
var XMLHttpRequest = require('xhr2');
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xhr.setRequestHeader("SOAPAction", "http://creditinfo.com/CB5/IMonitoringPublicPublicService/GetAllSubjects");
xhr.setRequestHeader("Authorization", "Basic Y2ZnX3dzX2FsZXJ0aW5nOkMxbUAwNTBDRkc=");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}};
var data = <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<GetAllSubjects xmlns="http://creditinfo.com/CB5">
<groupName>TEST_API</groupName>
<includeDisabledSubjects>true</includeDisabledSubjects>
</GetAllSubjects>
</Body>
</Envelope> ;
xhr.send(data);
here is the js code its a soap api call i need to execute it with in a java program and use the result into another function is there any way cuase i couldn't figure it out using nashorn