const http = require('http'); const fs = require('fs'); const express = require('express') const app = express(); const bodyParser = require('body-parser') const soap = require('soap'); app.use(bodyParser.urlencoded({ extended: false })) app.use(bodyParser.json()) const request = require('ajax-request'); app.use(express.static('vcm')); app.listen(process.env.PORT || 8080); console.log("on 8080"); var url = 'http://193.196.137.147:8990/simstadt/services/SimStadt2MonthlyenergyBalance?wsdl'; var args = { gmlid: 'DEBW522AA0003113b', // an example of a building in Essen DENW22AL700004Lv cityID: 1,// Essen 3 // Stockach 1 ui: { attic: true, atticHeating: true, basement: true, basementHeating: true, buildingType: "EFH", // other options: "RH", "MFH", "GFH", "HH" flatRoof: true, id: 'DEBW522AA0003113b', // equal with glmid latitude: 51.44679140365339, // an example of a building in Essen longitude: 6.967781962878631, // an example of a building in Essen refurbishment: "statuQuo", // other options: "medium", "advanced" simulationName: "MonthlyEnergyBalance", // just use this value for Heat/Cooling Demand storeyCount: 3, timestep: 1, // dummy integer, not yet integrated but mandatory usageProfile: "Single Family House", // // other options: "Multi Family House" yearOfConstruction: 1946 } }; app.post('/getSimS', function(req,res){ try { const data = req.body; // console.log("data ==============") // console.log(data.id); args.gmlid = data.id // console.log(data[0]); // console.log(data[1]); // console.log("args ==============") // console.log(args); //asdf const returnedTarget = Object.assign(args.ui,data); // args.ui = data; // args.gmlid = data.id; // console.log("returned ==============") // console.log(returnedTarget) // console.log("args ==============") // console.log(args); soap.createClient(url, function(err, client) { client.getMonthlyEnergyBalance(args, function(err, result) { if (err) throw err; console.log(result); // const obj = JSON.parse(result); // console.log(obj) res.json(result); return result; }); }); } catch (err) { console.log('.../getSimS failed!\n' + err); } });