I tried to use "soap" npm and build an object to be sent as param but the object is not able to be converted to envelope. I posted the file and response below app.js file contain the below
var soap = require('soap');
const express = require('express');
const bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
const url = 'https://files.developer.sabre.com/wsdl/sabreXML1.0.00/shopping/SSSAdvShopRQ_v5-4-0.wsdl';
let params = {
Envelope: {
Header: {
Action:"SSSAdvShopRQ",
Security: {
BinarySecurityToken: "Token"
},
MessageHeader: {
From: {.
PartyId:[ "WebServiceClient"]
},
To: {
PartyId:[ "WebServiceSupplier"]
},
CPAId: "ET",
ConversationId: "TestSession",
Service: "SSSAdvShop",
Action: "SSSAdvShopRQ"
},
},
Body: {
OTA_AirLowFareSearchRQ: {
POS: {
Source: {
RequestorID: {
CompanyName: {
Code: "SSW"
},
Type: "1",
ID: "1"
},
PseudoCityCode: "ADD"
}
},
OriginDestinationInformation: [
{
DepartureDateTime: "2023-01-25T00:00:00",
OriginLocation: {
LocationCode: "ADD"
},
DestinationLocation: {
LocationCode: "DXB"
},
TPA_Extensions: "",
RPH: "1"
},
{
DepartureDateTime: "2023-01-31T00:00:00",
OriginLocation: {
LocationCode: "DXB"
},
DestinationLocation: {
LocationCode: "SEA"
},
TPA_Extensions: "",
RPH: "2"
}
],
TravelPreferences: "",
TravelerInfoSummary: {
AirTravelerAvail: {
PassengerTypeQuantity: {
Code: "ADT",
Quantity: "1"
}
},
PriceRequestInformation: {
TPA_Extensions: {
Indicators: {
RetainFare: {
Ind: "true"
},
MinMaxStay: {
Ind: "true"
},
RefundPenalty: {
Ind: "true"
},
ResTicketing: {
Ind: "true"
},
TravelPolicy: {
Ind: "true"
}
},
PointOfSaleOverride: {
Code: "ADD"
}
},
CurrencyCode: "ETB"
}
},
TPA_Extensions: {
IntelliSellTransaction: {
RequestType: {
Name: "ADVBRD"
},
ServiceTag: {
Name: "ET"
}
}
},
Version: "5.4.0"
},
}
}
};
app.get('/', function (req, res) {
soap.createClient(url, function (err, client) {
client.SSSAdvShopRQAsync(params, function (err, response) {
console.log(response.data);
res.setHeader('Content-Type', 'application/json');
res.status(200).send(response.data);
});
});
});
app.listen(3000, () => {
console.log("Server started at port 3000");
});
I get the below response
soap-env:Fault soap-env:Client.InvalidEbXmlMessage Missing <soap-env:Header> in <soap-env:Envelope> javax.xml.soap.SOAPException: Missing <soap-env:Header> in <soap-env:Envelope> </soap-env:Fault>
I am looking how to convert from object to request envelope.
I have no token and username/password. I can't test this API.
But I can suggest your try this steps.
#1 Find correct input data parameters before node.js call using soapUI
.
This is detail information for using simple calculator.
Example: You need to enter this values
<sec:Username>your user name</sec:Username>
<sec:Password>your user password</sec:Password>
<sec:BinarySecurityToken>real binary token</sec:BinarySecurityToken>
#2 Then resume node.js without express
This is detail information for soap-npm node.js.
In I found more easy way to consume SOAP service
section.
#3 With express