"SOAP 통신 (Node.js)"의 두 판 사이의 차이
라이언의 꿀팁백과
(같은 사용자의 중간 판 하나는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
//post to a SOAP API | https://gist.github.com/gjyoung1974/d256278023f43569a8d4982f309eedec | ||
https://stackoverflow.com/questions/124269/simplest-soap-example | |||
// post to a SOAP API | |||
var http = require('http'); | var http = require('http'); | ||
11번째 줄: | 16번째 줄: | ||
var s_AuthInfo = 'p3ssw3rd'; //get the data protection Format | var s_AuthInfo = 'p3ssw3rd'; //get the data protection Format | ||
//Marshal up a ProtectFormattedData SOAP Mesage: | |||
// Marshal up a ProtectFormattedData SOAP Mesage: | |||
var soapRequest = | var soapRequest = | ||
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vib="http://voltage.com/vibesimple">' + "\n" + | '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vib="http://voltage.com/vibesimple">' + "\n" + | ||
26번째 줄: | 32번째 줄: | ||
' </soapenv:Body>' + "\n" + | ' </soapenv:Body>' + "\n" + | ||
'</soapenv:Envelope>'; | '</soapenv:Envelope>'; | ||
var options = { | var options = { | ||
hostname: 'voltage-pp-0000.corp.acme.local', | hostname: 'voltage-pp-0000.corp.acme.local', |
2024년 2월 20일 (화) 14:25 기준 최신판
https://gist.github.com/gjyoung1974/d256278023f43569a8d4982f309eedec
https://stackoverflow.com/questions/124269/simplest-soap-example
// post to a SOAP API
var http = require('http');
var s_Pan = '378282246310005'; //get the unprotected PAN from the form
var s_DPFormat = 'CC'; //get the data protection Format
var s_Identity = 'user@domain.com'; //get the data protection Format
var s_AuthInfo = 'p3ssw3rd'; //get the data protection Format
// Marshal up a ProtectFormattedData SOAP Mesage:
var soapRequest =
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vib="http://voltage.com/vibesimple">' + "\n" + ' <soapenv:Header/>' + "\n" + ' <soapenv:Body>' + "\n" + ' <vib:ProtectFormattedData>' + "\n" + ' <dataIn>' + s_Pan + '</dataIn>' + "\n" + ' <format>' + s_DPFormat + '</format>' + "\n" + ' <identity>' + s_Identity + '</identity>' + "\n" + ' <tweak></tweak>' + "\n" + 'SharedSecret ' + "\n" + '' + s_AuthInfo + ' ' + "\n" + ' </vib:ProtectFormattedData>' + "\n" + ' </soapenv:Body>' + "\n" + '</soapenv:Envelope>';
var options = {
hostname: 'voltage-pp-0000.corp.acme.local', port: 8181, path: '/vibesimple/services/VibeSimpleSOAP', method: 'POST', headers: { //'Content-Type': 'text/xml; charset=utf-8', is it this one or the follwing one? 'Content-Type': 'application/soap+xml; charset=utf-8', 'SOAPAction': 'http://voltage.com/vibesimple' }
};
var req = http.request(options, function (res) {
//TODO do something usefull with the response headers: // console.log('headers:\n' + JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('body:\n' + chunk); });
});
req.on('error', function (e) {
console.log('problem with request: ' + e.message);
});
req.end();
/*
https://uat.riskmanager.cn/WebService/webservices/v3/JPReportService?wsdl
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="https://v3.creditreport.sinotrust.cn"> <soap:Header/>
<soap:Body> <v3:UserLogin> <v3:LoginName>KSURE_test</v3:LoginName> <v3:Password>Experian2023</v3:Password> </v3:UserLogin> </soap:Body>
</soap:Envelope>
*/