{"id":16416079,"url":"https://github.com/phax/phase4-peppol-standalone","last_synced_at":"2025-07-19T06:06:58.167Z","repository":{"id":204755727,"uuid":"712572094","full_name":"phax/phase4-peppol-standalone","owner":"phax","description":"This an example standalone implementation of phase4 for the Peppol Network","archived":false,"fork":false,"pushed_at":"2025-07-10T19:42:54.000Z","size":259,"stargazers_count":19,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-10T19:59:36.116Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-31T18:25:24.000Z","updated_at":"2025-07-10T19:42:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"ccc5d0f3-6f0f-4550-9a6b-9aa6132d679b","html_url":"https://github.com/phax/phase4-peppol-standalone","commit_stats":null,"previous_names":["phax/phase4-peppol-standalone"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phax/phase4-peppol-standalone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fphase4-peppol-standalone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fphase4-peppol-standalone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fphase4-peppol-standalone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fphase4-peppol-standalone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phax","download_url":"https://codeload.github.com/phax/phase4-peppol-standalone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phax%2Fphase4-peppol-standalone/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265896133,"owners_count":23845429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T07:08:21.219Z","updated_at":"2025-07-19T06:06:58.139Z","avatar_url":"https://github.com/phax.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Standalone Peppol phase4\n\nThis an example standalone implementation of [phase4](https://github.com/phax/phase4) for the Peppol Network.\n\nThis is a template application and NOT ready for production use, because you need to take decisions and add some code.\nOf course phase4 itself is ready for production use - see a list of [known phase4 users](https://github.com/phax/phase4/wiki/Known-Users) that have agreed to be publicly listed.\n\n**Note:** because it is a template application, no releases are created - you have to modify it anyway.\n\nThis project is part of my Peppol solution stack. See https://github.com/phax/peppol for other components and libraries in that area.\n\n# Functionality\n\n## Functionality Receiving\n\nBased on the Servlet technology, the application takes AS4 messages via HTTP POST to `/as4`.\n\nBy default, all valid incoming messages are handled by class `com.helger.phase4.peppolstandalone.spi.CustomPeppolIncomingSBDHandlerSPI`.\nThis class contains a `TODO` where you need to implement the stuff you want to do with incoming messages.\nIt also contains a lot of boilerplate code to show how certain things can be achieved (e.g. intergration with `peppol-reporting`).\n\n## Functionality Sending\n\nSending is triggered via an HTTP POST request.\n\nAll the sending APIs mentioned below also require the HTTP Header `X-Token` to be present and have a specific value.\nWhat value that is, depends on the configuration property `phase4.api.requiredtoken`.\nThe pre-configured value is `NjIh9tIx3Rgzme19mGIy` and should be changed in your own setup.\n\nThe actual Peppol Network choice (test or production network) is done based on the `peppol.stage` configuration parameter.\n\nTo send to an AS4 endpoint use this URL (the SBDH is built inside):\n```\n/sendas4/{senderId}/{receiverId}/{docTypeId}/{processId}/{countryC1}\n```\n\nTo send to an AS4 endpoint use this URL when the SBDH is already available (especially for Peppol Testbed):\n```\n/sendsbdh\n```\n\nIn both cases, the payload to send must be the XML business document (like the UBL Invoice).\nThe outcome is a JSON document that contains most of the relevant details on sending.\n\nTest call using the file `src\\test\\resources\\external\\example-invoice.xml` as the request body (note the URL escaping of special chars via the `%` sign):\n`http://localhost:8080/sendas4/9915:phase4-test-sender/9915:helger/urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice%23%23urn:cen.eu:en16931:2017%23compliant%23urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1/urn:fdc:peppol.eu:2017:poacc:billing:01:1.0/GB`\n\n**Note:** Documents are NOT validated internally. They need to be validated externally. See https://github.com/phax/phive and https://github.com/phax/phive-rules for this.\n\n## Peppol Reporting\n\nWas added on 2025-02-16 as an example. On 2025-04-12 extended with the `do-peppol-reporting` API and the automatic scheduling.\n\nBy default every 2nd of the month, at 5:00am the scheduled job to create, validate, store and send the Peppol Reports is executed. The 2nd was chosen to definitively not run in timezone issues. \n\nVia `GET` on `/create-tsr/{year}/{month}` a Peppol Reporting Transaction Statistics Report (TSR) will be created. This does not validate or send the report.\nThe `year` parameter must be \u0026ge; 2024 and the `month` parameter must be between `1` and `12`.\nThe response is a TSR XML in UTF-8 encoding. \n\nVia `GET` on `/create-eusr/{year}/{month}` a Peppol Reporting End User Statistics Report (EUSR) will be created. This does not validate or send the report.\nThe `year` parameter must be \u0026ge; 2024 and the `month` parameter must be between `1` and `12`.\nThe response is an EUSR XML in UTF-8 encoding. \n\nVia `GET` on `/do-peppol-reporting/{year}/{month}` it will create TSR and EUSR reports, validate them, store them, send them to OpenPeppol and stores the sending reports of those.\nThe `year` parameter must be \u0026ge; 2024 and the `month` parameter must be between `1` and `12`.\nThe response is a constant text showing that it was done.\n\n\n## What is not included\n\nThe following list contains the elements not considered for this demo application:\n\n* You need your own Peppol certificate to make it work - the contained keystore is a dummy one only\n* Document validation is not included\n    * See https://github.com/phax/phive and https://github.com/phax/phive-rules for this.\n* Peppol Reporting is not included, as no reporting backend is present.\n    * You can pick one from https://github.com/phax/peppol-reporting to add to your `pom.xml`\n    * The calls for storing Peppol Reporting information is part of the code, but disabled by default, as relevant parameters cannot automatically be determined\n    * The default storage of Peppol Reports is the file system - you may choose something else here as well (SQL, MongoDB etc.)\n\n# Get it up and running\n\n## Tasks\n\n1. Prepare your Peppol Access Point Key Store according to the rules described at https://github.com/phax/phoss-smp/wiki/Certificate-setup\n1. Set the correct value of `peppol.stage` in the `application.properties` file\n1. Configure your Key Store in the `application.properties` file\n1. Choose the correct Trust Store based on the Peppol Network stage (see above). Don't touch the Trust Store contents - they are part of the deployment.\n1. Set the correct value of `peppol.seatid` in the `application.properties` file\n1. Once the Peppol Certificate is configured, change the code snippet with `TODO` in file `ServletConfig` according to the comment (approx. line 215)\n1. Note that incoming Peppol messages are only logged and discarded. Edit the code in class `CustomPeppolIncomingSBDHandlerSPI` to fix it.\n1. Build and start the application (see below)\n\n## Building\n\nThis application is based on Spring Boot 3.x and uses Apache 3.x and Java 17 (or higher) to build.\n\n```\nmvn clean install\n```\n\nThe resulting Spring Boot application is afterwards available as `target/phase4-peppol-standalone-x.y.z.jar` (`x.y.z` is the version number).\n\nAn example Docker file is also present - see `docker-build.cmd` and `docker-run.cmd` for details.\n\n## Configuration\n\nThe main configuration is done via the file `src/main/resources/application.properties`.\nYou may need to rebuild the application to have an effect.\n\nThe following configuration properties are contained by default:\n* **`peppol.stage`** - defines the stage of the Peppol Network that should be used. Allowed values are `test` \n   (for the test/pilot Peppol Network) and `prod` (for the production Peppol Network). It defines e.g.\n   the SML to be used and the CAs against which checks are performed\n* **`peppol.seatid`** - defines your Peppol Seat ID. It could be taken from your AP certificate as well,\n   but this way it is a bit easier.\n* **`peppol.owner.countrycode`** - defines the country code of you as a Peppol Service Provider. Use the\n   2-letter country code (as in `AT` for Austria). This is required to send the Peppol Reports to\n   OpenPeppol.\n* **`peppol.reporting.senderid`** - the sending Peppol Participant ID. For now, this can be e.g. the VAT\n   number or organisational number of you as a Service Provider. In **the future** this will most likely need\n   to be an SPID (using the `0242` participant scheme ID). Example value: `9915:TestReportSender`. This will be used\n   as the sending Participant ID for sending Peppol Reports to OpenPeppol.\n* **`peppol.reporting.scheduled`** - a boolean value to indicate, if the Peppol TSR and EUSR reports should\n   automatically sent be towards OpenPeppol on a monthly basis. The cron rule is place is `0 0 5 2 * *`.\n\n## Running\n\nIf you run it with `java -jar target/phase4-peppol-standalone-x.y.z.jar` it will spawn a local Tomcat at port `8080` and you can access it via `http://localhost:8080`.\nIt should show a small introduction page. The `/as4` servlet itself has no user interface.\n\nIn case you run the application behind an HTTP proxy, modify the settings in the configuration file (`http.proxy.*`).\n\nIn case you don't like port 8080, also change it in the configuration file.\n\n---\n\nMy personal [Coding Styleguide](https://github.com/phax/meta/blob/master/CodingStyleguide.md) |\nIt is appreciated if you star the GitHub project if you like it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphax%2Fphase4-peppol-standalone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphax%2Fphase4-peppol-standalone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphax%2Fphase4-peppol-standalone/lists"}