Commit 553e9ba6 authored by Gozutok, Recep's avatar Gozutok, Recep
Browse files

Delete main.cpp

parent 16ed5613
#include "soapCentralSystemServiceSoapProxy.h" // include the proxy declarations
#include "CentralSystemServiceSoap.nsmap" // include the XML namespace mappings
#include <ctime>
#include <thread>
#include <mutex>
void heartbeat(){
std::mutex mtx;
int b=0;
while(b==0){
sleep(3);
mtx.lock();
CentralSystemServiceSoapProxy service;
std::cout << "Starting client" <<std::endl;
ns1__HeartbeatRequest req;
ns1__HeartbeatResponse res;
SOAP_ENV__Header rec;
rec.ns1__chargeBoxIdentity = "CP1234";
rec.wsa5__MessageID = "file:///home/rgozutok/Belgeler/heartbeath/CentralSystemServiceSoap.Heartbeat.req.xml";
rec.wsa5__To = "http://130.149.159.42:9000/soap/CS?wsdl";
rec.wsa5__Action = "/Heartbeat";
service.soap_header(
rec.ns1__chargeBoxIdentity,
rec.wsa5__MessageID,
rec.wsa5__RelatesTo,
rec.wsa5__From,
rec.wsa5__ReplyTo,
rec.wsa5__FaultTo,
rec.wsa5__To,
rec.wsa5__Action,
rec.chan__ChannelInstance);
double result = service.Heartbeat("http://130.149.159.42:9000/soap/CS","/Heartbeat", &req,res);
if (result==SOAP_OK) {
tm *ltm = localtime(&res.currentTime);
std::cout << "Date: "<< ltm->tm_mday << "/" << 1 + ltm->tm_mon << "/" << 1900 + ltm->tm_year << std::endl;
std::cout << "Time: "<< ltm->tm_hour << ":" << ltm->tm_min << ":" << 1 + ltm->tm_sec << std::endl;
}
mtx.unlock();
}
}
void authorize(){
CentralSystemServiceSoapProxy service;
ns1__AuthorizeRequest req;
ns1__AuthorizeResponse res;
SOAP_ENV__Header rec;
rec.ns1__chargeBoxIdentity = "CP1234";
rec.wsa5__MessageID = "file:///home/rgozutok/Belgeler/authorize/CentralSystemServiceSoap.Authorize.req.xml";
rec.wsa5__To = "http://130.149.159.42:9000/soap/CS?wsdl";
rec.wsa5__Action = "/Authorize";
service.soap_header(
rec.ns1__chargeBoxIdentity,
rec.wsa5__MessageID,
rec.wsa5__RelatesTo,
rec.wsa5__From,
rec.wsa5__ReplyTo,
rec.wsa5__FaultTo,
rec.wsa5__To,
rec.wsa5__Action,
rec.chan__ChannelInstance);
req.idTag;
double result=service.Authorize( &req, res);
if (result == SOAP_OK) {
std::cout<<"Yes the binding is working..."<< std::endl;
if (res.idTagInfo->status==0)
std::cout<<"Authorization is Accepted..."<<std::endl;
if (res.idTagInfo->status==1)
std::cout<<"Authorization is Blocked..."<<std::endl;
if (res.idTagInfo->status==2)
std::cout<<"Authorization is Expired..."<<std::endl;
if (res.idTagInfo->status==3)
std::cout<<"Authorization is Invalid..."<<std::endl;
if (res.idTagInfo->status==4)
std::cout<<"Authorization is ConcurrentTx..."<<std::endl;
}
tm *ltm = localtime(res.idTagInfo->expiryDate);
std::cout << "Date: "<< ltm->tm_mday << "/" << 1 + ltm->tm_mon << "/" << 1900 + ltm->tm_year << std::endl;
std::cout << "Time: "<< ltm->tm_hour << ":" << ltm->tm_min << ":" << 1 + ltm->tm_sec << std::endl;
}
int main() {
CentralSystemServiceSoapProxy service;
std::thread t1(authorize);
t1.join();
std::cout << "/* message */" << std::endl;
std::thread t2(heartbeat);
t2.join();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment