forked from vpulim/node-soap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arrays with proper prefix and namespace (vpulim#1137)
* Arrays with proper prefix and namespace When Array has specific prefix and namespace as per the WSDL, the namespace reference is ignored completely. The current fix makes the array elements with prefix and namespace when available. (Not only during the first element and don't conflict with overrideRootElement option) * added test cases for Arrays with proper prefix and namespace * Removed unnecessary comments * fixed lint errors * Removed duplicate implementation * fixed test failure and lint errors Co-authored-by: Vimalraj <[email protected]>
- Loading branch information
1 parent
0ef3c0e
commit 272a7da
Showing
13 changed files
with
1,332 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: "[email protected]", | ||
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(/<ns1:PurchaseRequestInputReqLineInterface xmlns:.{3}="(.*?)">/); | ||
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; | ||
|
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"return":"-1", | ||
"bstrError":"" | ||
"bstrError":"1" | ||
} |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__Messages_suffixed_with_In_Out/response.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError></bstrError></snp:Message></soap:Body></soap:Envelope> | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError>1</bstrError></snp:Message></soap:Body></soap:Envelope> |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"return":"-1", | ||
"bstrError":"" | ||
"bstrError":"1" | ||
} |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__Messages_suffixed_with_Input_Output/response.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError></bstrError></snp:Message></soap:Body></soap:Envelope> | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError>1</bstrError></snp:Message></soap:Body></soap:Envelope> |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"return":"-1", | ||
"bstrError":"" | ||
"bstrError":"1" | ||
} |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__Messages_suffixed_with_Request_Response/response.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError></bstrError></snp:Message></soap:Body></soap:Envelope> | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError>1</bstrError></snp:Message></soap:Body></soap:Envelope> |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__overriding_namespace_prefix/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"return":"-1", | ||
"bstrError":"" | ||
"bstrError":"1" | ||
} |
2 changes: 1 addition & 1 deletion
2
test/request-response-samples/Message__overriding_namespace_prefix/response.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError></bstrError></snp:Message></soap:Body></soap:Envelope> | ||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><snp:Message xmlns:snp="urn:MessageService"><return>-1</return><bstrError>1</bstrError></snp:Message></soap:Body></soap:Envelope> |
Oops, something went wrong.