OxalisCommunity / Oxalis-AS4

PEPPOL AS4 pMode plugin for Oxalis
32 stars 25 forks source link

Generate SBDH #132

Closed TTD93 closed 4 years ago

TTD93 commented 4 years ago

Hi, I've some questions on how to use Oxalis when it comes to outbound document. I might have misunderstood how Oxalis works, so sorry in advance.

So what I'm trying to do is to generate a new EHF file and send it, the first part was very straight forward on how to generate the content. But as far as I can tell, Oxalis does not generate the SBDH, it only validates it and passes it on. I could however not find any good documentation on SBDH.

The XML elements to generate this looks pretty straight forward. However, if I manually generate this I'll also generate the InstanceIdentifier. This looks a bit dangerous, as it looks like this needs to be unique for ALL EHF files and not just for us, the accesspoint. Could someone here perhaps explain how this works or point me to the right place to find the documentation on this?

jannewaren commented 4 years ago

Hello!

You are correct, Oxalis does not anymore create the SBDH for you based on your payload (at least that is true for new document types) - you need to create the SBDH yourself and wrap your payload in it.

Documentation available here: https://docs.peppol.eu/edelivery/envelope/PEPPOL-EDN-Business-Message-Envelope-1.2-2019-02-01.pdf

It is not that complicated really. You could even get away with some simple "string template" type of approach. Not saying if it's a good idea or not. Take the example from that documentation and replace all the values with correct ones in your implementation. I'm not sure if there are any available open source implementations of this but maybe someone else has a tip.

For the InstanceIdentifier, I think just using an newly generated UUID is enough, practically speaking you're guaranteed not to collide with anyone.

TTD93 commented 4 years ago

Thanks, the self generate part where we cross fingers that the ID is unique means that we've to handle the case where we get a negative receipt for non unique ID which is a bit pain in the ass. I've a followup question. So if I'm going to send these files, do I've to use standalone? In the documentation it says it should only be used for testing purposes.

FrodeBjerkholt commented 4 years ago

You should not use the standalone sender in production. You should use the Transmitter interface.

TTD93 commented 4 years ago

@FrodeBjerkholt could you comment on our discussion with InstanceIdentifier? How is this field validated? Is it unique for all EHF files, and we need to handle those cases or is it unique per certificate?

FrodeBjerkholt commented 4 years ago

Yes, the InstanceIdentifier needs to be universally unique. This can easily be achived by using UUID.randomUUID().toString()

TTD93 commented 4 years ago

Thanks.