diff --git a/src/wsdl/index.ts b/src/wsdl/index.ts index cf85f1641..23e007159 100644 --- a/src/wsdl/index.ts +++ b/src/wsdl/index.ts @@ -736,6 +736,7 @@ export class WSDL { } } } else if (typeof obj === 'object') { + let currentChildXmlnsAttrib = ''; for (name in obj) { // Happens when Object.create(null) is used, it will not inherit the Object prototype if (!obj.hasOwnProperty) { @@ -834,7 +835,10 @@ export class WSDL { if (childNsURI && childNsPrefix) { if (nsContext.declareNamespace(childNsPrefix, childNsURI)) { childXmlnsAttrib = ' xmlns:' + childNsPrefix + '="' + childNsURI + '"'; - xmlnsAttrib += childXmlnsAttrib; + if (!xmlnsAttrib.includes(childNsPrefix)) { + currentChildXmlnsAttrib = childXmlnsAttrib; + xmlnsAttrib += childXmlnsAttrib; + } } } } @@ -874,6 +878,7 @@ export class WSDL { current: childNsPrefix, parent: ns, }; + childXmlnsAttrib = childXmlnsAttrib && childXmlnsAttrib.length ? childXmlnsAttrib : currentChildXmlnsAttrib; } else { // parent (array) already got the namespace childXmlnsAttrib = null; diff --git a/test/client-test.js b/test/client-test.js index 534ace8e0..619ab232b 100644 --- a/test/client-test.js +++ b/test/client-test.js @@ -1579,6 +1579,53 @@ it('should create async client without options', function (done) { }); }); +it('should add namespace to array of objects', function (done) { + soap.createClientAsync(__dirname + '/wsdl/PurchaseRequestService.wsdl').then(function (client) { + const input = { + errorProcessingLevel: "ALL", + groupBy: "SUPPLIER", + initiateApprovalAfterRequisitionImport: "N", + interfaceSourceCode: "ABC", + purchaseRequestPayload: { + ApproverEmail: "abc@gmail.com", + ApproverId: "idname", + PurchaseRequestInputReqLineInterface: + [ + { + Amount: "600.00", + GroupCode: "supplier", + ItemDescription: "test1", + LineTypeId: 6, + ProductType: "SERVICES", + RequestedDeliveryDate: "2021-02-26", + + }, + { + Amount: "400.00", + GroupCode: "supplier", + ItemDescription: "test2", + LineTypeId: 7, + ProductType: "SERVICES", + RequestedDeliveryDate: "2021-02-28", + }, + ], + }, + RequisitioningBUName: "BU", + requisitioningBUName: "BU", + }; + client.setSecurity(new soap.BasicAuthSecurity('username', 'password')); + client.createRequisition(input,function(err, result, rawResponse, soapHeader, rawRequest) { + const match = rawRequest.match(//); + if(match && match.length) { + assert.ok(match[0]) + } else { + assert.ok(null, `Array object don't have namesapce`) + } + done(); + }); + }); +}); + describe('Client using stream and returnSaxStream', () => { let server = null; diff --git a/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.json b/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.json index 79fdba308..9e4a3f0e0 100644 --- a/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.json +++ b/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.json @@ -1,4 +1,4 @@ { "return":"-1", - "bstrError":"" + "bstrError":"1" } diff --git a/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.xml b/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.xml index 17169f0b0..a3b4127b0 100644 --- a/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.xml +++ b/test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.xml @@ -1 +1 @@ --1 \ No newline at end of file +-11 \ No newline at end of file diff --git a/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.json b/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.json index 79fdba308..9e4a3f0e0 100644 --- a/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.json +++ b/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.json @@ -1,4 +1,4 @@ { "return":"-1", - "bstrError":"" + "bstrError":"1" } diff --git a/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.xml b/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.xml index 17169f0b0..a3b4127b0 100644 --- a/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.xml +++ b/test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.xml @@ -1 +1 @@ --1 \ No newline at end of file +-11 \ No newline at end of file diff --git a/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.json b/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.json index 79fdba308..9e4a3f0e0 100644 --- a/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.json +++ b/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.json @@ -1,4 +1,4 @@ { "return":"-1", - "bstrError":"" + "bstrError":"1" } diff --git a/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.xml b/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.xml index 17169f0b0..a3b4127b0 100644 --- a/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.xml +++ b/test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.xml @@ -1 +1 @@ --1 \ No newline at end of file +-11 \ No newline at end of file diff --git a/test/request-response-samples/Message__overriding_namespace_prefix/response.json b/test/request-response-samples/Message__overriding_namespace_prefix/response.json index 79fdba308..9e4a3f0e0 100644 --- a/test/request-response-samples/Message__overriding_namespace_prefix/response.json +++ b/test/request-response-samples/Message__overriding_namespace_prefix/response.json @@ -1,4 +1,4 @@ { "return":"-1", - "bstrError":"" + "bstrError":"1" } diff --git a/test/request-response-samples/Message__overriding_namespace_prefix/response.xml b/test/request-response-samples/Message__overriding_namespace_prefix/response.xml index 17169f0b0..a3b4127b0 100644 --- a/test/request-response-samples/Message__overriding_namespace_prefix/response.xml +++ b/test/request-response-samples/Message__overriding_namespace_prefix/response.xml @@ -1 +1 @@ --1 \ No newline at end of file +-11 \ No newline at end of file diff --git a/test/wsdl/PurchaseRequestService.wsdl b/test/wsdl/PurchaseRequestService.wsdl new file mode 100644 index 000000000..6c226abce --- /dev/null +++ b/test/wsdl/PurchaseRequestService.wsdl @@ -0,0 +1,1021 @@ + + + + Purchase Request Service Version 1 + Version 1 of the purchase request web service. A service allowing + integrating applications to create, change, control, and get details + about requisitions and purchase orders. + + External + Integration + + Active + Supported - Backward Compatibility Assured + + PrcTop-Procurement + PrcTop-Procurement : PrcPoTop-Purchasing + PrcTop-Procurement : PrcPoTop-Purchasing : + PrcPoEditDocument-Edit Purchasing Document + + + Fusion DOO to AU Order Entry/Fulfillment + + + An operation to get purchase request details. + Active + + + + + + + An operation to perform a hold action on a requisition line on + hold or to perform a hold or firm action on a purchase order + schedule. + Active + + + + + + + An operation to change a purchase request. Depending on the + current state, the operation may cancel a requisition line, + cancel a change, or cancel or split a purchase order schedule. + Active + + + + + + + This operation kicks off the requisition import process to + complete the creation of the requisition with the data from the + interface table. Calling applications should first load the + interface table via the operation populate interface table and + then call the Purchase Request Web Service with the operation + submit requisition import. + Active + + + + + + + + + + + + + + + This operation is for when integrating applications have a high + volume of supply requests like Planning which may have 10K + requests for a single batch. The caller can call the Purchase + Request Web Service with this operation multiple times to + populate the interface table with the data to create + requisitions. Once the interface table is fully loaded, the + calling application must call the Purchase Request Web Service + with the operation submit requisition import + Active + + + + + + + + + This operation combines Populate interface table and Submit + requisition import. It will write the attributes into the + requisition interface tables, and then kick off the requisition + import process to complete the creation of requisitions. The + requisition import process will then perform the necessary + derivation and validation logic on the requisition. + Active + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + https://ecex-test.prc.us2.oraclecloud.com/fscmService/PurchaseRequestService + + + + MIIDVzCCAj+gAwIBAgIIT/yPBCeD1PswDQYJKoZIhvcNAQELBQAwWTETMBEGCgmSJomT8ixkARkWA2NvbTEWMBQGCgmSJomT8ixkARkWBm9yYWNsZTEVMBMGCgmSJomT8ixkARkWBWNsb3VkMRMwEQYDVQQDEwpDbG91ZDlDQS0yMB4XDTE2MDUyODAzNDcyOVoXDTI2MDUyNjAzNDcyOVowWzETMBEGCgmSJomT8ixkARkWA2NvbTEWMBQGCgmSJomT8ixkARkWBm9yYWNsZTEVMBMGCgmSJomT8ixkARkWBWNsb3VkMRUwEwYDVQQDEwxGQUVuY3J5cHRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpKD/tDxflZbH41vnIlOLD4C8JI1f7escvpK1/SvQZNLilaJ+rm2CNoUzjhWQG1JL/mcbo61UQ5idaSRABafZ7xMyWz6FMfn6PqIxArbGEZdf0Q+0IHBkSBtjIZ1FNYiCinu8q7CKObzyzRV3Rbvj7DzOdqubQ20r1/gyxw3HfhDXknBEiyC19GKkrReedgSiruB+PxgpsJNUGlm03ZQLAgR/u7fmsCQqbvRTx+nr229jDWBsqBQbBHrTy14NU9ZRlneNA82jh87WiUxC6eUzJyynThDC4Ux5ncEnrac2MyaVoqcO02mk167oH+9HfWyn68d8LOkHWpGacieNDO5EXAgMBAAGjITAfMB0GA1UdDgQWBBTYnQF69xPmMTA36+DSbKdWe7YtMDANBgkqhkiG9w0BAQsFAAOCAQEARmfGrdlTLElHhhcPfdGOXnJBm46N3jKAhxrwF4ucQQ7tCqXF/9LcQmWBLwMgDefxYWtCIDT1SvhYgeF3Yy16hmxiSIbVZCKjGCHoiUh4RgEghVmdRaAJxm+6E74fLNfyGdmOQv85whfadb6xkrY7dOyToipFggu/d2RrZYrvSaOvu5usfQ/GujzkMsqHB2V+SNJqAzmX9ax/yYoFpod1niH7JNLwSkbKIsEqpiD+eTtahZThMZ+9zHQCSkdZtgM/klctUjtTNSBzf5+HScrUK/mBuZUK7VzFFnXVhsD8OaIu0SudByEqT6Q7vhN1AB38ar4n1rJmA9uoStHF7YWxhQ== + + CN=Cloud9CA-2, DC=cloud, DC=oracle, DC=com + 5763638871132984571 + + CN=FAEncryption, DC=cloud, DC=oracle, DC=com + 2J0BevcT5jEwN+vg0mynVnu2LTA= + MIIDazCCAlOgAwIBAgIIVG39wJnOff4wDQYJKoZIhvcNAQELBQAwWTETMBEGCgmSJomT8ixkARkWA2NvbTEWMBQGCgmSJomT8ixkARkWBm9yYWNsZTEVMBMGCgmSJomT8ixkARkWBWNsb3VkMRMwEQYDVQQDEwpDbG91ZDlDQS0yMCAXDTE2MDUyODAzNDcyOFoYDzIxMTYwNTA0MDM0NzI4WjBZMRMwEQYKCZImiZPyLGQBGRYDY29tMRYwFAYKCZImiZPyLGQBGRYGb3JhY2xlMRUwEwYKCZImiZPyLGQBGRYFY2xvdWQxEzARBgNVBAMTCkNsb3VkOUNBLTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDmxTOCcmaSkBMBdFz1s4Ri48tY7FKYrfN83sE4EYvDe8/I5A2qTkYnDJbX07QYfeW1biyR2wMF1ms1jATkXhy5o9AxiK8B1YD1O5d0acYivl6MESqIpAU76epDCSRhY7KfmyUlHyRZcIta7YL8wSEMriQTOBiLM0Lm0eFl7UU7oJqy6DMAbJ2Xm+/UvQxTKFDfVwuRGDQSx1cwGTAhQJ4Mm0lmkw9k6qo0LrgOii/Q6xsca+XPSKcaJgKDQiBpoxnh5AqUXbWhF/RaoUXUbOgGSJhQhyVPqSVfYsmOt25++3IS+wSJst5eHZ/wvf8jR8wu/z/62Uqcz/7Zub9D9kgvAgMBAAGjNTAzMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFPj83RIIMectb5d49Z6Y0Tw4As0rMA0GCSqGSIb3DQEBCwUAA4IBAQAImcQymnssHZ1kqfmwn0MWvBr/xRaTBvC4Zu7htnr9HHsibHFPhYJfqM3VcLs5lDIgjMLYOfI9o9dbOhPZ/tREnAAPV/9bu7bipMMTJoDwGr7l1cpTF/sisawvOKkJ/0sCHuKsiE3Uz25/1ABG+F0+uxZFi0GCbGPmcFku4KliyzUOMNm+UUq2G6zMqZi3DSncPQjD9IcIOO7TDQgH0hbj5QtuTIANiVJTIdtIOFgPofdSsrTeYGG9nuyr46d4XSioW9h9VDEECvUVZqexYp9CwdD91MMVjc2Oqc0CrUv+EzpTf+J+uSnb7+omQK060uHkZSxYqkElNd+SzodVC9yW + + + + + + + diff --git a/test/wsdl/PurchaseRequestService.xsd b/test/wsdl/PurchaseRequestService.xsd new file mode 100644 index 000000000..e20c074cf --- /dev/null +++ b/test/wsdl/PurchaseRequestService.xsd @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/wsdl/oracle-webservices-async-fault-11_0.xsd b/test/wsdl/oracle-webservices-async-fault-11_0.xsd new file mode 100644 index 000000000..6100e284b --- /dev/null +++ b/test/wsdl/oracle-webservices-async-fault-11_0.xsd @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + +