Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling SMP lookup failed #248

Closed
tonytram opened this issue Jul 11, 2024 · 6 comments
Closed

Handling SMP lookup failed #248

tonytram opened this issue Jul 11, 2024 · 6 comments
Assignees

Comments

@tonytram
Copy link

tonytram commented Jul 11, 2024

Hi @phax

I need help distinguishing between "Participant not existing" and "Participant not registered for this document type" in Phase4. The UnknownHostException, which could handle this, isn't accessible outside the SMPClient library. Any suggestions? Thanks for your help!

@phax phax self-assigned this Jul 11, 2024
@phax
Copy link
Owner

phax commented Jul 31, 2024

Hi @tonytram,
I was thinking this through and try to come up with a smart solution, but I failed.
Therefore I suggest you use the following solution: Execute an SMP lookup aforehand and check before you call the builder, like this:

SMPClientReadOnly smpClient = new SMPClientReadOnly (...); // the same as you put in the builder
SignedServiceMetadataType serviceGroup = smpClient.getServiceGroupOrNull (aServiceGroupID);
if (serviceGroup == null) {
  // Participant not registered in the Peppol Network
} else {
  // Participant is registered
  // Trigger the AS4 sending
}

hth

@tonytram
Copy link
Author

tonytram commented Aug 1, 2024 via email

@tonytram
Copy link
Author

tonytram commented Aug 6, 2024

Hi @phax,

I used ServiceGroupType instead because SignedServiceMetadataType caused a compile error. An extra request to check the availability of a given Participant might not be efficient.

To give you more context about our scenario, we're encountering cases where a lookup for a given ParticipantId fails during data transmission to Peppol. However, the Participant actually exists on the network. This issue might be due to latency or network lag.

Do you have any idea how we can make it more efficient?

Thank you,

@phax
Copy link
Owner

phax commented Aug 6, 2024

Yeah thanks. There is a bug in the code
Well, there is also the opportunity that a receiver exists in the network but simply does not support the request document type or process.
Indeed it does not add efficiency to perform another check, but that check is unavoidable. I will come up with a better and working test example to show that it can be done without an additional query...

@phax
Copy link
Owner

phax commented Aug 11, 2024

It took some time, but I think I found a suitable solution. With phase4 2.8.1 you can do the following code:
https://github.com/phax/phase4/blob/master/phase4-peppol-client/src/test/java/com/helger/phase4/peppol/MainPhase4PeppolSenderNonExistingReceiver.java#L82

I was trying to find a better solution but failed - sorry.

Release will come soon

@phax phax closed this as completed Aug 11, 2024
@tonytram
Copy link
Author

Hi @phax ,
Thank you so much for your support. I will check the new release and come back to you if anything unclear. Really appreciate your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants