diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..3353ff4 --- /dev/null +++ b/go.mod @@ -0,0 +1,6 @@ +module github.com/eduhenke/go-ocpp + +require ( + github.com/google/uuid v1.1.0 + github.com/sirupsen/logrus v1.3.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..233ebdb --- /dev/null +++ b/go.sum @@ -0,0 +1,17 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s= +github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= +github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/soap/client.go b/soap/client.go index 49d1863..3d57261 100644 --- a/soap/client.go +++ b/soap/client.go @@ -27,6 +27,9 @@ func NewClient(url string) *Client { // Call performs HTTP POST request func (s *Client) Call(soapAction string, request, response interface{}) error { + if len(s.url) == 0 { + return errors.New("no URL to request") + } envelope := toSendEnvelope{XMLNS: "http://www.w3.org/2003/05/soap-envelope"} envelope.Header = &toSendHeader{ XMLNS: "http://www.w3.org/2005/08/addressing", diff --git a/soap/models.go b/soap/models.go index 49d0c51..0fa6777 100644 --- a/soap/models.go +++ b/soap/models.go @@ -2,8 +2,6 @@ package soap import ( "encoding/xml" - - "github.com/eduhenke/go-ocpp/messages" ) type Envelope receivedEnvelope @@ -75,7 +73,7 @@ type toSendHeader struct { Action string `xml:"wsa5:Action"` MessageID string `xml:"wsa5:MessageID"` From toSendFrom - ChargeBoxIdentity messages.ChargeBoxIdentity `xml:"urn://Ocpp/Cs/2012/06/ chargeBoxIdentity"` + ChargeBoxIdentity string `xml:"urn://Ocpp/Cs/2012/06/ chargeBoxIdentity"` } type toSendBody struct {