I'm writing a node js program to consume a SOAP service and the code is as below.
var xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns0="http://ei/crm/billing_account_retrieval_crm34x1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><tns0:GetBillAcctDetail><GetBillAcctDetailRequest><BillAccountId>XA2GENMR</BillAccountId></GetBillAcctDetailRequest></tns0:GetBillAcctDetail></soapenv:Body></soapenv:Envelope>';
var http = require('http');
var request = require("request");
var utf8 = require('utf8');
var auth = 'Basic ' + new Buffer("DPINSURITY1" + ':' + "default").toString('base64');
request.post({
url: "https://services-st.chubb.com",
path: "/CRMServices/BillingAccountRetrievalCRM34X1",
method: "POST",
headers: {
'Content-Type': 'application/xml',
'Authorization': auth
},
body: xml
},
function (error, response, body) {
console.log("Status Code Received " + response.statusCode + "\n\n");
console.log("Success " + body + "\n\n");
console.log("Error " + error + "\n\n");
});
when I run this, the output that i get is as below.
Status Code Received 500
Success <?xml version="1.0" encoding="UTF-8"?>
<env:Fault xmlns:date="http://exslt.org/dates-and-times" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><faultcode
>server</faultcode><faultstring>Internal error occurred</faultstring><faultactor/><detail/></env:Fault>
Error null
when I run the same in postman, I get the result as expected. please refer to the below screenshot. 
I'm very new to node as well as SOAP. Please let me know where am I going wrong and how can I fix it.
Thanks
via user3872094
No comments:
Post a Comment