I am trying to create a SOAP call in javascript to query our cloud to return a document. This is to avoid using the standard Inquiry Reporting. Our Cloud uses Single Sign On and regular password login scenario won't work for the general user. I looking for the appropriate syntax of a SOAP call against Oracle to download documents from the repository and the appropriate syntax to get the authorization token to send to the Cloud to allow for the SOAP call to execute. Currently I am getting a 401 error from a POST command but a GET call has a response. I am unsure whether I should be referencing oraclecloud.com/crmCommonBulkExport/BulkExportService?WSDL or oraclecloud.com/fscmService/ServiceCatalogService?wsdl. I have read some similar posts on this topic but clearly I am missing something. Any assistance or advice is appreciated. The outline of the code with some substitution is below and testing it through the browser console".
//Organization instance remove replaced with your-instance
var url = "https://your-instance.oraclecloud.com/crmCommonBulkExport/BulkExportService?WSDL";
var xhr = new XMLHttpRequest();
//Response is 401; recieve a repsonse with a GET
xhr.open("POST", url,true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}};
//SOAP call for attactments
var data = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/crmCommon/bulkExport/bulkExportServiceV2/types/">
<soapenv:Body>
<dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
</dsig:KeyInfo>
<typ:getAttachmentsForBatch>
<typ:batchId>300000024150497</typ:batchId>
</typ:getAttachmentsForBatch>
</soapenv:Body>
</soapenv:Envelope>`;
//regualr authorization causes issues because of SSO
//xhr.setRequestHeader("Content-Type", "text/xml");
//SSO needed
xhr.setRequestHeader('Bearer', '<token>');
xhr.send(data);