Я интегрировал запрос мыла от собственного приложения реагировать, но получаю ошибку несоответствия версии мыла.
Я пытался вызвать запрос мыла как с "XMLHttpRequest", так и с "response-native-soap-request".
Но я не получаю никакого успеха, этот API-интерфейс мыла отлично работает в интерфейсе мыла, но не из приложения, ниже приведен мой код, который я пробовал до сих пор: -
var body =
'<?xml version="1.0" encoding="utf-8"?>' +
"<soap: Envelope xmlns: soap='http://www.w3.org/2003/05/soap-envelope' xmlns: pub='http://xmlns.oracle.com/oxp/service/PublicReportService'>" +
"<soap: Header/>" +
"<soap: Body>" +
"<pub: runReport>" +
"<pub: reportRequest>" +
"<pub: parameterNameValues>" +
"<pub: item>" +
"<pub: name>SLQ</pub: name>" +
"<pub: values>" +
"<pub: item>SELECT FBU.BU_NAME RCV_HEADER_BUSINESS_UNIT , TO_CHAR(POS.SEGMENT1) RCV_HEADER_VENDOR_NUMBER , POS.VENDOR_NAME RCV_HEADER_VENDOR_NAME , PSS.VENDOR_SITE_CODE XVENDOR_SITE_CODE , POH.SEGMENT1 RCV_TRXN_DOCUMENT_NUMBER , POL.LINE_NUM RCV_TRXN_DOCUMENT_LINE_NUMBER , PLL.SHIPMENT_NUM RCV_TRXN_DOC_SHIPMENT_LINE_NUM , POD.DISTRIBUTION_NUM RCV_TRXN_DOCUMENT_DIST_NUMBER , TO_CHAR(PRH.REQUISITION_NUMBER) XREQUISITION_NUMBER , PRL.LINE_NUMBER XREQUISITION_LINE_NUMBER , POL.MATCHING_BASIS XMATCHING_BASIS , TRIM('.' FROM GCC.SEGMENT1 || '.' || GCC.SEGMENT2 || '.' || GCC.SEGMENT3 || '.' || GCC.SEGMENT4 || '.' || GCC.SEGMENT5 || '.' || GCC.SEGMENT6 || '.' || GCC.SEGMENT7 || '.' || GCC.SEGMENT8 || '.' || GCC.SEGMENT9 || '.' || GCC.SEGMENT10) XCHARGE_ACCOUNT , POD.AMOUNT_ORDERED - POD.AMOUNT_DELIVERED - POD.AMOUNT_CANCELLED RCV_TRXN_AMOUNT , POH.CURRENCY_CODE RCV_TRXN_AMOUNT_CURRENCY , POD.QUANTITY_ORDERED - POD.QUANTITY_DELIVERED - POD.QUANTITY_CANCELLED RCV_TRXN_QUANTITY , TO_CHAR(SYSDATE, 'DD') || '-' || DECODE(TO_CHAR(SYSDATE, 'MM'), '01', 'Jan' , '02', 'Feb' , '03', 'Mar' , '04', 'Apr' , '05', 'May' , '06', 'Jun' , '07', 'Jul' , '08', 'Aug' , '09', 'Sep' , '10', 'Oct' , '11', 'Nov' , '12', 'Dec') || '-' || TO_CHAR(SYSDATE, 'YYYY') || ' ' || '00:00:00' RCV_TRXN_TRANSACTION_DATE , POD.AMOUNT_ORDERED XAMOUNT_ORDERED , POD.QUANTITY_ORDERED XQUANTITY_ORDERED , TO_CHAR(POD.REQ_BU_ID) RCV_HEADER_BUSINESS_UNIT_ID , TO_CHAR(POH.VENDOR_ID) RCV_HEADER_VENDOR_ID , TO_CHAR(POH.VENDOR_SITE_ID) RCV_HEADER_VENDOR_SITE_ID , TO_CHAR(PLL.SHIP_TO_ORGANIZATION_ID) RCV_HEADER_SHIP_TO_ORG_ID , TO_CHAR(POD.DELIVER_TO_PERSON_ID) RCV_HEADER_EMPLOYEE_ID , 'NEW' RCV_HEADER_TRANSACTION_TYPE , 'STD' RCV_HEADER_ASN_TYPE , 'VENDOR' RCV_HEADER_RECEIPT_SOURCE_CODE , 'VENDOR' RCV_TRXN_RECEIPT_SOURCE_CODE , 'PO' RCV_TRXN_SOURCE_DOCUMENT_CODE , 'RECEIVE' RCV_TRXN_TRANSACTION_TYPE , 'DELIVER' RCV_TRXN_AUTO_TRANSACT_CODE , TO_CHAR(POD.DESTINATION_ORGANIZATION_ID) RCV_TRXN_TO_ORGANIZATION_ID , TO_CHAR(POH.SOLDTO_LE_ID) RCV_TRXN_SOLD_TO_LEGAL_ENT_ID , (SELECT PNF.FULL_NAME FROM PER_PERSON_NAMES_F_V PNF WHERE PNF.PERSON_ID = POD.DELIVER_TO_PERSON_ID AND SYSDATE BETWEEN PNF.EFFECTIVE_START_DATE AND PNF.EFFECTIVE_END_DATE) PERSON_NAME , POL.ITEM_DESCRIPTION RCV_TRXN_ITEM_DESCRIPTION , TO_CHAR(PLL.NEED_BY_DATE, 'DD') || '-' || DECODE(TO_CHAR(PLL.NEED_BY_DATE, 'MM'), '01', 'Jan' , '02', 'Feb' , '03', 'Mar' , '04', 'Apr' , '05', 'May' , '06', 'Jun' , '07', 'Jul' , '08', 'Aug' , '09', 'Sep' , '10', 'Oct' , '11', 'Nov' , '12', 'Dec') || '-' || TO_CHAR(PLL.NEED_BY_DATE, 'YYYY') XNEED_BY_DATE , (SELECT PPA.SEGMENT1 FROM PJF_PROJECTS_ALL_VL PPA WHERE PPA.PROJECT_ID = POD.PJC_PROJECT_ID AND ROWNUM = 1) XPROJECT_NUMBER , (SELECT PPA.NAME FROM PJF_PROJECTS_ALL_VL PPA WHERE PPA.PROJECT_ID = POD.PJC_PROJECT_ID AND ROWNUM = 1) XPROJECT_NAME , (SELECT PT.TASK_NUMBER FROM PJF_TASKS_V PT WHERE PT.TASK_ID = POD.PJC_TASK_ID AND ROWNUM = 1) XTASK_NUMBER , (SELECT PT.TASK_NAME FROM PJF_TASKS_V PT WHERE PT.TASK_ID = POD.PJC_TASK_ID AND ROWNUM = 1) XTASK_NAME FROM PO_HEADERS_ALL POH , PO_LINES_ALL POL , PO_LINE_LOCATIONS_ALL PLL , PO_DISTRIBUTIONS_ALL POD , GL_CODE_COMBINATIONS GCC , FUN_NAMES_BUSINESS_UNITS_V FBU , POZ_SUPPLIERS_V POS , POZ_SUPPLIER_SITES_V PSS , POR_REQUISITION_HEADERS_ALL PRH , POR_REQUISITION_LINES_ALL PRL , POR_REQ_DISTRIBUTIONS_ALL PRD WHERE 1 = 1 AND POL.PO_HEADER_ID = POH.PO_HEADER_ID AND PLL.PO_HEADER_ID = POH.PO_HEADER_ID AND PLL.PO_LINE_ID = POL.PO_LINE_ID AND POD.PO_HEADER_ID = POH.PO_HEADER_ID AND POD.PO_LINE_ID = POL.PO_LINE_ID AND POD.LINE_LOCATION_ID = PLL.LINE_LOCATION_ID AND GCC.CODE_COMBINATION_ID = NVL(POD.DEST_CHARGE_ACCOUNT_ID, PRD.CODE_COMBINATION_ID) AND FBU.BU_ID (+) = POD.REQ_BU_ID AND POS.VENDOR_ID = POH.VENDOR_ID AND PSS.VENDOR_SITE_ID = POH.VENDOR_SITE_ID AND PRD.DISTRIBUTION_ID (+) = POD.REQ_DISTRIBUTION_ID AND PRL.REQUISITION_LINE_ID (+) = PRD.REQUISITION_LINE_ID AND PRH.REQUISITION_HEADER_ID (+) = PRL.REQUISITION_HEADER_ID AND POL.LINE_STATUS NOT IN ('CLOSED', 'REJECTED', 'FINALLY CLOSED', 'CANCELED', 'CLOSED FOR RECEIVING') AND DECODE(POL.MATCHING_BASIS, 'AMOUNT', (NVL(POD.AMOUNT_ORDERED, 0) - NVL(POD.AMOUNT_DELIVERED, 0) - NVL(POD.AMOUNT_CANCELLED, 0) ) , 'QUANTITY', (NVL(POD.QUANTITY_ORDERED, 0) - NVL(POD.QUANTITY_DELIVERED, 0) - NVL(POD.QUANTITY_CANCELLED, 0)) ) <> 0 AND ( POD.DELIVER_TO_PERSON_ID IN (SELECT PERSON_ID FROM PER_USERS WHERE UPPER(USERNAME) IN (UPPER('amy.marlin'))) OR PRH.PREPARER_ID IN (SELECT PERSON_ID FROM PER_USERS WHERE UPPER(USERNAME) IN (UPPER('amy.marlin'))))" +
"</pub: values >" +
"</pub: item >" +
"</pub: parameterNameValues >" +
"<pub: reportAbsolutePath>/Custom/SL_RP.xdo</pub: reportAbsolutePath >" +
"<pub: sizeOfDataChunkDownload>-1</pub: sizeOfDataChunkDownload >" +
"</pub: reportRequest >" +
"</pub: runReport >" +
"</soap: Body >" +
"</soap: Envelope >";
const soapRequest = new SoapRequest({
security: {
username: 'amy.marlin',
password: 'aNN88656'
},
targetNamespace: 'http://soap.acme.com/2.0/soap-access-services',
commonTypes: 'http://soap.acme.com/2.0/soap-common-types',
requestURL: "https://ucf6-zhfb-fa-ext.oracledemos.com/xmlpserver/services/ExternalReportWSSService?WSDL"
});
const xmlRequest = soapRequest.createRequest({
body
});
const response = await soapRequest.sendRequest();
alert(JSON.stringify(response));
Я пытался сXMLHttpRequest также: -
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'https://ucf6-zhfb-fa-ext.oracledemos.com/xmlpserver/services/ExternalReportWSSService?WSDL', true);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert(xmlhttp.responseText + "200");
alert('done. use firebug/console to see network response');
} else {
alert(xmlhttp.status + " " + xmlhttp.responseText + "else")
}
}
}
Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.setRequestHeader('CharSet', 'UTF-8');
xmlhttp.setRequestHeader('Content-Length', body.length);
xmlhttp.setRequestHeader('Connection', 'Keep-Alive');
xmlhttp.setRequestHeader('Authorization', 'Basic ' + base64.encode("amy.marlin:Agv55365"));
xmlhttp.setRequestHeader('SOAPAction', 'NA');
xmlhttp.setRequestHeader('Accept', 'Encoding:gzip,deflate');
xmlhttp.send(body);
Тело, о котором я уже упоминал выше, теперь это ответ, который я получаю ниже: -