Closed seciq closed 11 months ago
A possible workaround is:
@Override
public void persist(InboundMetadata inboundMetadata) {
final Header header = inboundMetadata.getHeader();
C1CountryIdentifier senderCountry = header.getC1CountryIdentifier();
if (senderCountry == null && header instanceof As4PayloadHeader) {
final Header wrappedHeader = ((As4PayloadHeader)header).getHeader();
senderCountry = wrappedHeader.getC1CountryIdentifier();
}
// ...
}
I've submitted a pull-request with the required changes but I haven't assigned any reviewers as I do not have permissions. @aaron-kumar Please review the code changes.
The reason of this mistake lays in the fact that As4PayloadHeader
extends vefa Header
, but overrides all its getters with delegate calls.
So missing overriding of the new method getC1CountryIdentifier()
, introduced in 3.2.0, with a call to a delegate means - method is present but always returns null...
The fix introduced by @seciq looks correct, also I confirm the workaround - it is possible to get C1 country via internal original 'Header' instance inside As4PayloadHeader
- instead of as4PayloadHeader.getC1CountryIdentifier()
do as4PayloadHeader.getHeader().getC1CountryIdentifier()
.
@aaron-kumar it looks like a critical issue to fix asap...
Thanks for your contribution @seciq . This fix will be part of upcoming Oxalis/Oxalis-AS4 release (tentative schedule on 15.10.2023)
Thanks for the quick feedback. Looking forward for the new release.
Released as part of "Oxalis-AS4 6.2.0 Release"
I do have a StatisticsService extension for collecting the data required for TSR/EUSR. In the 6.0.0 version I've managed to succesfuly collect the COUNTRY_C1 from the
InboundMetadata
usingheader.getArgument("COUNTRY_C1")
.After upgrading to Oxalis 6.1.1 the COUNTRY_C1 scope is not available anymore in the header. I've switched from
header.getArgument("COUNTRY_C1")
toheader.getC1CountryIdentifier()
but the value returned is null.I do suspect the
As4PayloadHeader
wrapper is missing getter and setter for thec1CountryIdentifier
and thereforeInboundMetadata.getHeader().getC1CountryIdentifier()
is always null.More Info
The Header object is wrapped in an As4PayloadHeader and, as of 06.10.2023, the
c1CountryIdentifier
getters and setters are not implemented by this class causing the COUNTRY_C1 to be null. Theheader.getArgument("COUNTRY_C1")
will also be null (not set) because theSbdhReader
in vefa-peppol will not set the argument (since it was already added as c1CountryIdentifier).Refs: