How to integrate soap xml API of unicommerce in nodejs

0 votes

I am trying to hit xml Api of unicommerce by soap module in nodejs. It is working fine in soapUI.But is not integrated in node Application. I am getting this error.

ERROR: {Error: Cannot parse response}.

   var express = require("express");
    var soap = require("soap");
    var http = require('http');
    var app = express();
    var router = express.Router();
var username = "*********";
var password = "************";
var auth = "Basic " + new Buffer(username + ":" + password).toString("base64");// not working 

var wsdlUrl = 'https://lensclues.unicommerce.com/services/soap/uniware16.wsdl?facility=01';

const Autentication = '<soapenv:Header>' +
'<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' +
'<wsse:UsernameToken wsu:Id="UsernameToken-D6BE484999DA5E97D4148483888689316">' +
'<wsse:Username>**********</wsse:Username>' +
'<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">*******************</wsse:Password>'+
'<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">$$$$$$$$$$$</wsse:Nonce>'+
'<wsu:Created>2017-01-19T15:14:46.893Z</wsu:Created>'+
'</wsse:UsernameToken>'+
'</wsse:Security>' +
'</soapenv:Header>'
 soap.createClient(wsdlUrl, function (err, soapClient) {
soapClient.addSoapHeader(Autentication);
const data = '<soapenv:Envelope xmlns:ser="http://uniware.unicommerce.com   /services/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' + '<soapenv:Body>' +
    '<ser:GetInventorySnapshotRequest>' +
    '<ser:ItemTypes>' +
    '<ser:ItemType>' +
    '<ser:ItemSKU>LCSGDB555xD15165S4PURx124</ser:ItemSKU>' +
    '</ser:ItemType>' +
    '</ser:ItemTypes>' +
    '<ser:UpdatedSinceInMinutes>600</ser:UpdatedSinceInMinutes>' +
    '</ser:GetInventorySnapshotRequest>' +
    '</soapenv:Body>' +
    '</soapenv:Envelope>'
if (err) {
    console.log("err", err);
}
soapClient.GetInventorySnapshot({    
    data
}, function (err, result) {
    if (err) {
        console.log("ERROR:", err);
    }
    else {
        console.log("result", result);
    }
});

The question is: How do I send the request and print the answer? Could you have any clues about this kind of issue?

Thanks a lot!

Aug 11, 2022 in Node-js by Neha
• 9,020 points
658 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Node-js

0 votes
1 answer

How to get the _id of inserted document in Mongo database in NodeJS?

Hello @kartik, A shorter way than using second ...READ MORE

answered Sep 7, 2020 in Node-js by Niroj
• 82,840 points
13,763 views
0 votes
1 answer

How to clean node_modules folder of packages that are not in package.json?

Hello @kartik, You could remove your node_modules/ folder ...READ MORE

answered Jul 13, 2020 in Node-js by Niroj
• 82,840 points
30,247 views
0 votes
1 answer

How to run app.js in nodejs?

Hello @kartik, Assuming I have node and npm properly installed on the ...READ MORE

answered Oct 13, 2020 in Node-js by Niroj
• 82,840 points
2,978 views
0 votes
1 answer

How to get path from the request in nodejs?

Hello @kartik, Try this out: var http = require('http'); var ...READ MORE

answered Oct 14, 2020 in Node-js by Niroj
• 82,840 points
4,516 views
0 votes
1 answer

How to get hash of most recent git commit in Node?

Hello @kartik, Try this: revision = require('child_process') .execSync('git ...READ MORE

answered Oct 14, 2020 in Node-js by Niroj
• 82,840 points
2,672 views
0 votes
1 answer

How to provide a mysql database connection in single file in nodejs?

Hello @kartik, You could create a db wrapper ...READ MORE

answered Oct 15, 2020 in Node-js by Niroj
• 82,840 points
9,077 views
0 votes
0 answers

How to integrate soap xml API of unicommerce in nodejs?

I'm attempting to use the Node.js soap ...READ MORE

Aug 11, 2022 in Node-js by Neha
• 9,020 points
590 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP