aymen-mouelhi / ocpp-js

Open Charge Point Protocol Implementation in JS

Home Page:https://aymen-mouelhi.github.io/ocpp-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with soadHeaders

srivanilingam opened this issue · comments

Hi ,
I am playing around with the code and trying to run CP,
While running it facing issue "[ChargingPoint] ERROR Central System:::>> Error: Text data outside of root node. Line: 0 Column: 62 Char: e "

#ISSUE Description

The issue is due to the SoapHeaders that are being passed in ChargePoint js file. Tried many alternative ways for soapHeaders but so far no luck. Please do the needful.

this.client.addSoapHeader('<h:chargeBoxIdentity xmlns:h="urn://Ocpp/Cp/2012/06/" >'+ this.getId() + '</h:chargeBoxIdentity>')
this.client.addSoapHeader('<h:MessageID>urn:uuid:' + uuid4 + '</h:MessageID>')
this.client.addSoapHeader('<h:From><h:Address>'+ this.uri +'</h:Address></h:From>')
this.client.addSoapHeader('<h:ReplyTo><h:Address>http://www.w3.org/2005/08/addressing/anonymous</h:Address></h:ReplyTo>')
this.client.addSoapHeader('<h:To>http://localhost:9220/Ocpp/CentralSystemService</h:To>')
this.client.addSoapHeader('<h:Action soap:mustUnderstand="1">'+ this.action +'</h:Action>')

Sample CODE
=========== "

var OCPP = require('../index.js');

var options = {
centralSystem: {
port: 9220
},
chargingPoint: {
serverURI: 'http://localhost:9221/Ocpp/ChargePointService',
name: 'Simulator'
},
chargingPointServer: {
port: 9221
}
}

var ocppJS = new OCPP(options);

// Create Central System
var centralSystem = ocppJS.createCentralSystem();

// Create Charging Point Client
var chargingPoint = ocppJS.createChargingPoint('http://localhost:9221/Ocpp/ChargePointService', "chargingPoint-Simulator");

// Create Charging Point Server
var chargingPointServer = ocppJS.createChargingPointServer(9221);

var boot = setInterval(function() {

chargingPoint.bootNotification({
	chargePointVendor: 'Shneider Electric',
	chargePointModel: 'NQC-ACDC',
	chargePointSerialNumber: '5894babc-c6a3-4b8d-81a70e48',
	chargeBoxSerialNumber: '5894babc-c6a3-4b8d-81a7',
	firmwareVersion: '2.0.49',
	iccid: '1',
	imsi: '',
	meterType: 'DBT NQC-ACDC',
	meterSerialNumber: 'gir.vat.mx.000e48'
});

clearInterval(boot);

}, 2000);

Thanks
Srivani