Skip to content

Commit d142dc9

Browse files
committed
Aligned with standalone sender
1 parent 4bca50e commit d142dc9

File tree

1 file changed

+16
-17
lines changed
  • phase4-peppol-server-webapp/src/main/java/com/helger/phase4/peppol/server/api

1 file changed

+16
-17
lines changed

phase4-peppol-server-webapp/src/main/java/com/helger/phase4/peppol/server/api/PeppolSender.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import com.helger.annotation.Nonempty;
2424
import com.helger.annotation.concurrent.Immutable;
25-
import com.helger.base.system.EJavaVersion;
2625
import com.helger.base.timing.StopWatch;
2726
import com.helger.base.wrapper.Wrapper;
2827
import com.helger.peppol.sbdh.PeppolSBDHData;
@@ -113,12 +112,22 @@ public static Phase4PeppolSendingReport sendPeppolMessageCreatingSbdh (@NonNull
113112
throw new IllegalStateException ("Only XML payloads with a namespace are supported");
114113

115114
// Start configuring here
116-
final IParticipantIdentifier aSenderID = aIF.createParticipantIdentifierWithDefaultScheme (sSenderID);
115+
IParticipantIdentifier aSenderID = aIF.parseParticipantIdentifier (sSenderID);
116+
if (aSenderID == null)
117+
{
118+
// Fallback to default scheme
119+
aSenderID = aIF.createParticipantIdentifierWithDefaultScheme (sSenderID);
120+
}
117121
if (aSenderID == null)
118122
throw new IllegalStateException ("Failed to parse the sending participant ID '" + sSenderID + "'");
119123
aSendingReport.setSenderID (aSenderID);
120124

121-
final IParticipantIdentifier aReceiverID = aIF.createParticipantIdentifierWithDefaultScheme (sReceiverID);
125+
IParticipantIdentifier aReceiverID = aIF.parseParticipantIdentifier (sReceiverID);
126+
if (aReceiverID == null)
127+
{
128+
// Fallback to default scheme
129+
aReceiverID = aIF.createParticipantIdentifierWithDefaultScheme (sReceiverID);
130+
}
122131
if (aReceiverID == null)
123132
throw new IllegalStateException ("Failed to parse the receiving participant ID '" + sReceiverID + "'");
124133
aSendingReport.setReceiverID (aReceiverID);
@@ -152,12 +161,6 @@ public static Phase4PeppolSendingReport sendPeppolMessageCreatingSbdh (@NonNull
152161
// If this block is not used, it may be removed
153162
});
154163

155-
if (EJavaVersion.getCurrentVersion ().isNewerOrEqualsThan (EJavaVersion.JDK_17))
156-
{
157-
// Work around the disabled SHA-1 in XMLDsig issue
158-
aSMPClient.setSecureValidation (false);
159-
}
160-
161164
final Phase4PeppolHttpClientSettings aHCS = new Phase4PeppolHttpClientSettings ();
162165
// TODO Add AP HTTP outbound proxy settings here
163166

@@ -204,6 +207,7 @@ public void onAS4Message (@NonNull final AbstractAS4Message <?> aMsg)
204207
.getConversationId ());
205208
}
206209
})
210+
.rawResponseConsumer (aSendingReport::setRawHttpResponse)
207211
.signalMsgConsumer ( (aSignalMsg,
208212
aMessageMetadata,
209213
aState) -> {
@@ -218,7 +222,7 @@ public void onAS4Message (@NonNull final AbstractAS4Message <?> aMsg)
218222
{
219223
// TODO determine the enduser ID of the outbound message
220224
// In many simple cases, this might be the sender's participant ID
221-
final String sEndUserID = "TODO";
225+
final String sEndUserID = aSenderID.getURIEncoded ();
222226

223227
// TODO Enable Peppol Reporting when ready
224228
if (false)
@@ -293,12 +297,6 @@ static void sendPeppolMessagePredefinedSbdh (@NonNull final PeppolSBDHData aData
293297
// If this block is not used, it may be removed
294298
});
295299

296-
if (EJavaVersion.getCurrentVersion ().isNewerOrEqualsThan (EJavaVersion.JDK_17))
297-
{
298-
// Work around the disabled SHA-1 in XMLDsig issue
299-
aSMPClient.setSecureValidation (false);
300-
}
301-
302300
final Phase4PeppolHttpClientSettings aHCS = new Phase4PeppolHttpClientSettings ();
303301
// TODO Add AP HTTP outbound proxy settings here
304302

@@ -333,6 +331,7 @@ public void onAS4Message (@NonNull final AbstractAS4Message <?> aMsg)
333331
.getConversationId ());
334332
}
335333
})
334+
.rawResponseConsumer (aSendingReport::setRawHttpResponse)
336335
.signalMsgConsumer ( (aSignalMsg,
337336
aMessageMetadata,
338337
aState) -> {
@@ -346,7 +345,7 @@ public void onAS4Message (@NonNull final AbstractAS4Message <?> aMsg)
346345
{
347346
// TODO determine the enduser ID of the outbound message
348347
// In many simple cases, this might be the sender's participant ID
349-
final String sEndUserID = "TODO";
348+
final String sEndUserID = aData.getSenderAsIdentifier ().getURIEncoded ();
350349

351350
// TODO Enable Peppol Reporting when ready
352351
if (false)

0 commit comments

Comments
 (0)