How chargetimeeu/java-oca-ocpp works
1. This repository is a Java library, not an application. Its purpose is to provide reusable OCPP protocol implementations for two roles: Central System/CSMS and Charge Point/Charging Station. There is no runtime entrypoint; consumers assemble the library into their own application.
2. The architecture is split by protocol version and transport. The base OCPP 1.6 stack is in ocpp-common, ocpp-json, ocpp-v1_6, and ocpp-v1_6-soap. The newer stack is in ocpp-v2, which supports OCPP 2.0.1 and 2.1 with a multi-protocol design. Test and example modules sit alongside these core packages.
3. ocpp-common is the transport-agnostic core. It contains the main session and communication abstractions: Client, Server, Session, Communicator, Listener, Transmitter, Receiver, promise/repository types, and the request dispatcher/feature repository. This is the boundary where protocol logic is separated from wire encoding and socket mechanics.
4. The core data flow is event-driven and request/response oriented. Incoming wire messages are decoded by a transport layer, passed to a Communicator, routed through a RequestDispatcher, matched against a registered feature, then completed via a promise/confirmation handler. Outgoing calls travel in the opposite direction: feature code creates a request, the communicator serializes it, and the transmitter sends it over the active session.
5. ocpp-json provides the JSON transport implementation for OCPP 1.6. It adapts the common communicator to WebSocket-based messaging through JSONCommunicator, WebSocketListener, WebSocketReceiver, and WebSocketTransmitter. The wss package adds WebSocket Secure factory/socket builders, so transport security is handled at this layer rather than in the core protocol model.
6. ocpp-v1_6 contains the OCPP 1.6 protocol surface itself: feature classes, feature profiles, request/confirmation message models, enums, validation helpers, and profile-specific event handlers. This module is the protocol domain layer; it defines what messages exist and how each OCPP 1.6 feature should behave, independent of whether the transport is JSON or SOAP.
7. The 1.6 model layer is large and strongly typed. Requests and confirmations are separated into packages such as core, firmware, localauthlist, reservation, remotetrigger, securityext, and smartcharging. This reflects the OCPP specification’s feature-profile decomposition and makes the API boundaries align with the spec sections.
8. ocpp-v1_6-soap is the SOAP transport implementation for the same 1.6 protocol. It includes SOAP-specific client/server communicators, WSDL resources, HTTP/SOAP handlers, and a timeout session decorator. This module is separate from JSON because SOAP has different message framing, endpoint handling, and request lifecycle semantics.
9. ocpp-v2 is the newer, broader protocol branch. It introduces multi-protocol APIs (IMultiProtocolClientAPI, IMultiProtocolServerAPI), multi-protocol session and WebSocket components, and PerMessageDeflateExtension for WebSocket compression. It supports both OCPP 2.0.1 and 2.1 from a shared transport/runtime.
10. The v2 architecture shifts from “feature profiles” to “functions.” Under v201 and v21, there are many Feature classes plus Function-style groupings and handler interfaces. This reflects the newer OCPP model, where protocol capabilities are organized around functions and messages rather than the older 1.6 profile structure.
11. The v2 model layer is even more expansive, with separate message and type hierarchies for 2.0.1 and 2.1. It contains protocol messages, enums, and rich domain types for charging, transactions, tariffs, DER control, certificates, monitoring, periodic event streams, and related capabilities. This module is where most schema-level differences between 2.0.1 and 2.1 are expressed.
12. Testing is a major architectural concern. ocpp-v1_6-test and ocpp-v2-test provide integration-style test harnesses, fake central systems/charging stations, dummy handlers, and protocol-specific specs. The tests are organized per feature and per transport, which mirrors the production module boundaries and validates both protocol logic and transport behavior.
13. The ocpp-v1_6-example tree contains runnable sample applications and configurations for JSON and SOAP client/server implementations. These examples are not part of the library core, but they show how consumers wire the abstractions together in a real application.
14. Build and delivery are multi-module and cross-tooling: Gradle and Maven files exist side by side, with GitHub Actions, Travis configuration, code coverage, and CodeQL scanning. That indicates the repo is maintained as a distributable library with multiple published artifacts rather than a single deployable service.
Main entry points: chargetime/ocpp Common core · chargetime/ocpp V2 runtime · chargetime/ocpp JSON transport · feature 1.6 features
Components 19
Build & CI
Multi-module build, publishing, and automation
- Gradle/Maven · Root build and cross-tooling for published library artifacts
build.gradle - Parent POM · Maven aggregation and module publishing metadata
pom.xml
OCPP 1.6 stack
Transport-agnostic core, 1.6 protocol model, and its transports
- Common core · Sessions, communicators, promises, dispatching, and feature registration
ocpp-common/src/main/java/eu/chargetime/ocpp - Base model · Message abstractions and validation used by the common layer
ocpp-common/src/main/java/eu/chargetime/ocpp/model - JSON transport · OCPP 1.6 JSON/WebSocket communicator and socket wiring
ocpp-json/src/main/java/eu/chargetime/ocpp - SOAP transport · OCPP 1.6 SOAP client/server, handlers, and WSDL-backed wiring
ocpp-v1_6-soap/src/main/java/eu/chargetime/ocpp - 1.6 features · Feature classes for the OCPP 1.6 API surface
ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature - 1.6 profiles · Client/server profile composition and event handlers for 1.6
ocpp-v1_6/src/main/java/eu/chargetime/ocpp/feature/profile - 1.6 messages · Requests, confirmations, enums, validation, and spec-aligned domain types
ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model - JSON clients · Convenience client/server entry points for JSON transport
ocpp-v1_6-json/src/main/java/eu/chargetime/ocpp
OCPP 2.x stack
Shared multi-protocol runtime plus 2.0.1 and 2.1 protocol branches
- V2 runtime · Shared multi-protocol client/server APIs, sessions, and WebSocket helpers
ocpp-v2/src/main/java/eu/chargetime/ocpp - Function layer · Function abstractions that replace 1.6-style profiles in v2
ocpp-v2/src/main/java/eu/chargetime/ocpp/feature/function - 2.0.1 features · OCPP 2.0.1 feature set and function bindings
ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/feature - 2.0.1 model · 2.0.1 messages, types, enums, and rich domain objects
ocpp-v2/src/main/java/eu/chargetime/ocpp/v201/model - 2.1 features · OCPP 2.1 feature set and expanded function bindings
ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/feature - 2.1 model · 2.1 messages, types, enums, and advanced energy/tariff/DER domains
ocpp-v2/src/main/java/eu/chargetime/ocpp/v21/model
Tests & examples
Integration harnesses and sample consumer applications
- 1.6 tests · Feature-, transport-, and model-level tests for the 1.6 stack
ocpp-v1_6-test/src/test/groovy/eu/chargetime/ocpp/test - V2 tests · Multi-protocol integration tests and fake CSMS/station implementations
ocpp-v2-test/src/test/java/eu/chargetime/ocpp/test - 1.6 examples · Runnable JSON/SOAP consumer examples showing library assembly
ocpp-v1_6-example
Connections 29
- Gradle/Maven → Common core: builds · Root build includes the shared library modules
- Gradle/Maven → JSON transport: builds · Root build includes the JSON transport module
- Gradle/Maven → SOAP transport: builds · Root build includes the SOAP transport module
- Gradle/Maven → V2 runtime: builds · Root build includes the v2 runtime module
- Parent POM → Common core: publishes · Maven metadata targets the shared core artifact
- Base model → Common core: supports · Base message types support the transport-agnostic protocol core
- Common core → JSON transport: adapts to · JSON communicator and sockets plug into the common session flow
- Common core → SOAP transport: adapts to · SOAP communicator and HTTP handlers plug into the common session flow
- Common core → 1.6 features: routes · Dispatcher resolves feature requests registered by 1.6 feature classes
- 1.6 features → 1.6 profiles: composes · Feature classes are grouped into client/server profiles and handlers
- 1.6 messages → 1.6 features: defines · Protocol message classes back the 1.6 feature implementations
- JSON transport → JSON clients: exposes · JSON transport is surfaced through convenience client/server APIs
- JSON clients → 1.6 features: uses · JSON facade wires protocol features into consumer apps
- JSON clients → JSON transport: uses · Facade delegates to the JSON communicator layer
- 1.6 tests → 1.6 features: verifies · Tests exercise 1.6 feature behavior and profile composition
- 1.6 tests → JSON transport: verifies · Tests cover JSON transport behavior
- 1.6 tests → SOAP transport: verifies · Tests cover SOAP transport behavior
- 1.6 examples → JSON clients: demonstrates · Samples show how to assemble JSON client/server applications
- 1.6 examples → SOAP transport: demonstrates · Samples show how to assemble SOAP client/server applications
- V2 runtime → Function layer: orchestrates · Shared runtime coordinates capability functions and sessions
- V2 runtime → 2.0.1 features: supports · Multi-protocol runtime supports the OCPP 2.0.1 branch
- V2 runtime → 2.1 features: supports · Multi-protocol runtime supports the OCPP 2.1 branch
- Function layer → 2.0.1 features: binds · Functions group and route 2.0.1 capabilities
- Function layer → 2.1 features: binds · Functions group and route 2.1 capabilities
- 2.0.1 features → 2.0.1 model: uses · 2.0.1 features are backed by the 2.0.1 message/type model
- 2.1 features → 2.1 model: uses · 2.1 features are backed by the 2.1 message/type model
- V2 tests → V2 runtime: verifies · Integration tests exercise the shared multi-protocol runtime
- V2 tests → 2.0.1 features: verifies · Tests cover OCPP 2.0.1 function/feature behavior
- V2 tests → 2.1 features: verifies · Tests cover OCPP 2.1 function/feature behavior