我在同一个.js文件上创建了SOAP客户端和服务器。
索引.js
"use strict"
var soap = require('strong-soap').soap;
var express = require('express');
var Promise = require('promise');
var app = express();
var WSDL = soap.WSDL;
var xml = require('fs').readFileSync('centralsystemservice_1.5.wsdl','utf8');
var xmlCl = require('fs').readFileSync('chargingpointservice_1.5.wsdl','utf8');
var url = './chargingpointservice_1.5.wsdl';
function aa(args)
{
console.log("<<<>>>",args.bb);
}
var path = "/dek";
var port = 9330;
soap.createClient(url, {}, (err, client) => {
if(err)
throw err;
else
{
client.setEndpoint('http://localhost:9330/Ocpp/ChargePointService/');
client.ChargePointService.ChargePointServiceSoap12.Reset();
}
});
app.post('/Ocpp/ChargePointService/', (req, res, next) => {
console.log(req);
})
app.listen(port, () => {
console.log("Listening on port "+port);
soap.listen(app, path, service, xml);
});
我不能写的内容.wsdl文件,因为太长。我有一个问题:如何实现心跳或引导通知等功能?在编写OCPP协议中通信的功能时有什么限制吗?
1条答案
按热度按时间vsaztqbk1#
我建议你用json代替soap,用json容易多了。
例如,在BootNotification的情况下,工作站启动并发送到您的Ocpp服务器:
您的服务器会回应:
从字面上看就是这样