Need help in building the JavaScript code which will create a button and on button click build the SOAP body and then Execute the SOAP API. please suggest without <script> </script>
or creating a local function.
here is the Sample JSON payload and SOAP API
SOAP API : https://XXXXXXX.fin.ZZZ.oraclecloud.com:443/fscmService/ErpIntegrationService
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/">
<soapenv:Header/>
<soapenv:Body>
<typ:submitESSJobRequest>
<typ:jobPackageName>/oracle/apps/ess/financials/receivables/transactions/shared/</typ:jobPackageName>
<typ:jobDefinitionName>TransactionPrintProgramEss</typ:jobDefinitionName>
<typ:paramList>11123456</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>ANY</typ:paramList>
<typ:paramList>TRX_NUMBER</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>9876543</typ:paramList>
<typ:paramList>9876543</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>N</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>PDF</typ:paramList>
<typ:paramList>Inv_Template</typ:paramList>
<typ:paramList>Default Credit Memo Template</typ:paramList>
<typ:paramList>Default Debit Memo Template</typ:paramList>
<typ:paramList>Default Chargeback Template</typ:paramList>
<typ:paramList>N</typ:paramList>
<typ:paramList>#NULL</typ:paramList>
<typ:paramList>-1</typ:paramList>
</typ:submitESSJobRequest>
</soapenv:Body>
</soapenv:Envelope>
tried below code
<button id="myButton" onclick="const soapRequest="<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://xmlns.oracle.com/scheduler" xmlns:typ="http://xmlns.oracle.com/scheduler/types"><soapenv:Header/><soapenv:Body><sch:submitRequest><sch:description>Prints invoice transactions</sch:description><sch:jobDefinitionId><typ:name>InvoicePrintReport</typ:name><typ:packageName>/transactions/</typ:packageName><typ:type>BIPJobType</typ:type></sch:jobDefinitionId><sch:application>Receivables</sch:application><sch:requestedStartTime>2017-05-03T12:30:00</sch:requestedStartTime></sch:submitRequest></soapenv:Body></soapenv:Envelope>";
const username="username";
const password = 'password';
const url="https://www.google.combi/ess/esswebservice";
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'text/xml',
'Authorization': 'Basic ' + btoa(username + ':' + password)nb
},
body: soapRequest,
})
.then(response => response.text())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
">Click me</button>
Putting this much script in the HTML outside a script tag OR even better an external .js file is not a recipe for great solutions/productivity IMHO.
I can not put the code in .js file and access it due to the application restriction. Hence looking for code.
Really, I see no difference in a script tag at the end of your HTML vs inserted into ANOTHER tag this way – be interesting to see WHY that restriction even exists/logic behind that choice.