How to use ENTSOG client #83
-
Hey, I have just recently started looking into AS4. So I am not that well-informed in the field. For the past day or so, I have tried to implement a way to send a request with the AS4 protocol. Full Stack:
[main] INFO com.helger.phase4.mgr.MetaAS4Manager - MetaAS4Manager is initialized with in-memory data structures
[main] INFO com.helger.phase4.mgr.MetaAS4Manager - Creating AS4 managers using factory class com.helger.phase4.mgr.ManagerFactoryInMemory
[main] INFO com.helger.phase4.profile.AS4ProfileManager - 1 AS4 profile is registered
[main] INFO com.helger.phase4.mgr.MetaAS4Manager - MetaAS4Manager was initialized
[main] INFO com.helger.phase4.sender.AS4BidirectionalClientHelper - Sending AS4 UserMessage to 'http://localhost:8080/as4' with max. 1 retries
[main] INFO com.helger.phase4.wss.WSSConfigManager - None of the WSSConfig Security Providers is already installed - doing it now
[main] INFO com.helger.phase4.messaging.crypto.AS4Signer - Now signing AS4 message. KeyIdentifierType=ISSUER_SERIAL; KeyAlias=null; SignAlgo=http://www.w3.org/2001/04/xmldsig-more#rsa-sha256; DigestAlgo=http://www.w3.org/2001/04/xmlenc#sha256; C14NAlgo=http://www.w3.org/2001/10/xml-exc-c14n#
[main] ERROR com.helger.phase4.entsog.MainPhase4PeppolSenderLocalHost8080 - Error sending ENTSOG message via AS4
com.helger.phase4.util.Phase4Exception: Wrapped Phase4Exception
at com.helger.phase4.entsog.Phase4ENTSOGSender$AbstractENTSOGUserMessageBuilder.mainSendMessage(Phase4ENTSOGSender.java:218)
at com.helger.phase4.sender.AbstractAS4MessageBuilder.sendMessage(AbstractAS4MessageBuilder.java:598)
at com.helger.phase4.entsog.MainPhase4PeppolSenderLocalHost8080.main(MainPhase4PeppolSenderLocalHost8080.java:129)
Caused by: org.apache.wss4j.common.ext.WSSecurityException: No certificates for user "null" were found for signature
at org.apache.wss4j.dom.message.WSSecSignature.getSigningCerts(WSSecSignature.java:867)
at org.apache.wss4j.dom.message.WSSecSignature.prepare(WSSecSignature.java:171)
at org.apache.wss4j.dom.message.WSSecSignature.build(WSSecSignature.java:391)
at com.helger.phase4.messaging.crypto.AS4Signer._createSignedMessage(AS4Signer.java:129)
at com.helger.phase4.messaging.crypto.AS4Signer.createSignedMessage(AS4Signer.java:189)
at com.helger.phase4.client.AS4ClientUserMessage.buildMessage(AS4ClientUserMessage.java:664)
at com.helger.phase4.client.AbstractAS4Client.sendMessageWithRetries(AbstractAS4Client.java:458)
at com.helger.phase4.sender.AS4BidirectionalClientHelper.sendAS4UserMessageAndReceiveAS4SignalMessage(AS4BidirectionalClientHelper.java:132)
at com.helger.phase4.entsog.Phase4ENTSOGSender$AbstractENTSOGUserMessageBuilder.mainSendMessage(Phase4ENTSOGSender.java:196)
... 2 more
[main] INFO com.helger.phase4.wss.WSSConfigManager - Cleaning up WSSConfig. Security Providers will also be removed.
Process finished with exit code 0 The code that I am trying to use is the following: final ESuccess eResult;
eResult = Phase4ENTSOGSender.builder()
// Certificates
.receiverCertificate(certificate)
// Setup
.endpointURL("http://localhost:8080/as4")
.action("http://docs.oasis-open.org/ebxml-msg/as4/200902/action")
.service("A06")
.agreementRef("http://entsog.eu/communication/agreements/" +receiverId + "/" + senderId + "/1")
// From Partner
.fromRole(senderRole)
.fromPartyID(senderId)
.fromPartyIDType("http://www.entsoe.eu/eic-codes/eic-party-codes-x")
// To Partner
.toRole(receiverRole)
.toPartyID(receiverId)
.toPartyIDType("http://www.entsoe.eu/eic-codes/eic-party-codes-x")
// Payload
.payload(aPayloadElement, params)
// Send the message
.sendMessage(); Is there an example of the usage of Phase4ENTSOGSender? If not, can somebody please explain the error more in-depth, because I am currently not sure why the user is "null" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
@MakakWasTaken Please make sure that you have "application.properties" in classpath and following properties configured. org.apache.wss4j.crypto.provider=org.apache.wss4j.common.crypto.Merlin org.apache.wss4j.crypto.merlin.load.cacerts=false |
Beta Was this translation helpful? Give feedback.
@MakakWasTaken Please make sure that you have "application.properties" in classpath and following properties configured.
org.apache.wss4j.crypto.provider=org.apache.wss4j.common.crypto.Merlin
org.apache.wss4j.crypto.merlin.keystore.type=pkcs12
org.apache.wss4j.crypto.merlin.keystore.file=test-ap-2021.p12
org.apache.wss4j.crypto.merlin.keystore.password=peppol
org.apache.wss4j.crypto.merlin.keystore.alias=openpeppol aisbl id von pop000306
org.apache.wss4j.crypto.merlin.keystore.private.password=peppol
org.apache.wss4j.crypto.merlin.load.cacerts=false
#org.apache.wss4j.crypto.merlin.truststore.provider=
org.apache.wss4j.crypto.merlin.truststore.type=jks
org.apache.wss4j.crypto.merlin.trusts…