-
Notifications
You must be signed in to change notification settings - Fork 0
/
soap_test3.js
39 lines (31 loc) · 1.79 KB
/
soap_test3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//var http = require('follow-redirects').http;
const http = require('http');
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'ws.aramex.net',
'path': '/shippingapi/tracking/service_1_0.svc',
'headers': {
'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction': 'http://ws.aramex.net/ShippingAPI/v1/Service_1_0/TrackShipments',
'Accept-Encoding': 'gzip, deflate',
'Expect': '100-continue'
},
'maxRedirects': 20
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString('utf-8'));
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><ShipmentTrackingRequest xmlns=\"http://ws.aramex.net/ShippingAPI/v1/\"><ClientInfo xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><UserName>[email protected]</UserName><Password>R123456789$r</Password><Version>v1.0</Version><AccountNumber>20016</AccountNumber><AccountPin>331421</AccountPin><AccountEntity>AMM</AccountEntity><AccountCountryCode>JO</AccountCountryCode></ClientInfo><Transaction xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><Reference1>ref1</Reference1><Reference2>ref1</Reference2><Reference3>ref1</Reference3><Reference4>ref1</Reference4><Reference5>ref1</Reference5></Transaction><Shipments xmlns:a=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><a:string>41496248135</a:string></Shipments><GetLastTrackingUpdateOnly>true</GetLastTrackingUpdateOnly></ShipmentTrackingRequest></s:Body></s:Envelope>";
req.write(postData);
req.end();