phax/phase4

Add the possibility to send an outside SBDH

Closed this issue · 6 comments

phax commented

In a comparable way as phax/as2-peppol#5

phax commented

Part of the 0.9.6 release

kukel commented

Does this still mean I need to manually parse the SBD(H) and retrieve the sender, recipient documenttypeid etc? Just that the SBDH is not created? I thought with your AS2 solution this was not needed or am I wrong?

phax commented

If you want phase4 to build your SBDH, you use Phase4PeppolSender.builder () whereas if you already have an SBDH, you use Phase4PeppolSender.sbdhBuilder() to set the necessary settings. The difference is in validation etc.
The setup here is not comparable to the AS2 solution and was rebuild from scratch (hopefully simpler).

kukel commented

Ok, maybe my expectation was wrong. With passing on an existing SBDH, I expected the sbdhBuilder to extract the recipient, doctype etc from the existing SDBH so I would not need to pass those on manually. This does not seem to be the case. Would it be an interesting enhancement? E.g. when doing Phase4PeppolSender.sbdhBuilder(true) it uses the info from the existing header...

phax commented

@kukel Would something like this suffice:

    @Nonnull
    public SBDHBuilder payloadAndMetadata (@Nonnull final PeppolSBDHDocument aSBDH)
    {
      ValueEnforcer.notNull (aSBDH, "SBDH");
      return senderParticipantID (aSBDH.getSenderAsIdentifier ())
                   .receiverParticipantID (aSBDH.getReceiverAsIdentifier ())
                   .documentTypeID (aSBDH.getDocumentTypeAsIdentifier ())
                   .processID (aSBDH.getProcessAsIdentifier ())
                   .payload (new SBDMarshaller ().getAsBytes (new PeppolSBDHDocumentWriter ().createStandardBusinessDocument (aSBDH)));
    }

or what is your input format of the SBDH?

phax commented

Part of 0.10.2 release