| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- const http = require("http");
- const server = http.createServer((req, res) => {
- let body = "";
- req.on("data", (chunk) => {
- body += chunk;
- });
- req.on("end", () => {
- const regex = /<NS1:register>(.*?)<\/NS1:register>/;
- console.log(body);
- const match = body.match(regex);
- const register = match ? match[1] : null;
- console.log("register Value:", register);
- if (req.url === "/TutupRekening" && req.method === "POST") {
- let xmlInquiryResponse = '';
- xmlInquiryResponse =
- `<?xml version="1.0" encoding="utf-8"?>
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
- <TutupRekeningResponse xmlns="http://tempuri.org/">
- <TutupRekeningResult>
- <error>false</error>
- <code>00</code>
- <message>Delete rekening register: ` +
- register +
- ` berhasil.</message>
- </TutupRekeningResult>
- </TutupRekeningResponse>
- </soap:Body>
- </soap:Envelope>`;
- res.writeHead(200, { "Content-Type": "text/xml; charset=utf-8" });
- res.end(xmlInquiryResponse);
- } else {
- res.writeHead(404, { "Content-Type": "text/plain" });
- res.end("Not found");
- }
- });
- });
- server.listen(3097, () => {
- console.log(
- "SOAP dummy BPJS TK Individual running at http://0.0.0.0:3097/TutupRekening",
- );
- });
|