Search in sources :

Example 36 with Ebms3UserMessage

use of com.helger.phase4.ebms3header.Ebms3UserMessage in project phase4 by phax.

the class CustomPeppolIncomingSBDHandlerSPI method handleIncomingSBD.

public void handleIncomingSBD(@Nonnull final IAS4IncomingMessageMetadata aMessageMetadata, @Nonnull final HttpHeaderMap aHeaders, @Nonnull final Ebms3UserMessage aUserMessage, @Nonnull final byte[] aSBDBytes, @Nonnull final StandardBusinessDocument aSBD, @Nonnull final PeppolSBDHDocument aPeppolSBD, @Nonnull final IAS4MessageState aState) throws Exception {
    // Get the service from the locator
    LOGGER.info("Retrieving the handler service.");
    final ISBDHandlerService service = SDBHandlerServiceLocator.getService(ESBDHHandlerServiceSelector.CUSTOM_PEPPOL_INCOMING);
    LOGGER.info("Successfully retrieved the handler service.");
    // Inject the parameters into the service
    LOGGER.info("Injecting parameters into the handler service.");
    service.setMessageMetadata(aMessageMetadata);
    service.setHttpHeaders(aHeaders);
    service.setUserMessage(aUserMessage);
    service.setStandardBusinessDocumentBytes(aSBDBytes);
    service.setStandardBusinessDocument(aSBD);
    service.setPeppolStandardBusinessDocumentHeader(aPeppolSBD);
    service.setMessageState(aState);
    // Handle the request, might raise an exception that needs to be dealt
    // carefully
    LOGGER.info("Handling request.");
    service.handle();
    LOGGER.info("Request handled with success.");
}
Also used : ISBDHandlerService(com.helger.phase4.springboot.service.ISBDHandlerService)

Example 37 with Ebms3UserMessage

use of com.helger.phase4.ebms3header.Ebms3UserMessage in project phase4 by phax.

the class Ebms3MessagingTest method testUserMessageNoMessageProperties.

@Test
public void testUserMessageNoMessageProperties() throws Exception {
    final Ebms3Messaging aEbms3Messaging = new Ebms3Messaging();
    final Ebms3UserMessage aEbms3UserMessage = new Ebms3UserMessage();
    // Message Info
    final Node aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
    final String sPModeID = SOAP_12_PARTY_ID + "-" + SOAP_12_PARTY_ID;
    final Ebms3PayloadInfo aEbms3PayloadInfo = MessageHelperMethods.createEbms3PayloadInfo(aPayload != null, null);
    final Ebms3CollaborationInfo aEbms3CollaborationInfo;
    aEbms3CollaborationInfo = MessageHelperMethods.createEbms3CollaborationInfo(sPModeID, DEFAULT_AGREEMENT, AS4TestConstants.TEST_SERVICE_TYPE, AS4TestConstants.TEST_SERVICE, AS4TestConstants.TEST_ACTION, AS4TestConstants.TEST_CONVERSATION_ID);
    final Ebms3PartyInfo aEbms3PartyInfo = new Ebms3PartyInfo();
    // From => Sender
    final Ebms3From aEbms3From = new Ebms3From();
    aEbms3From.setRole(CAS4.DEFAULT_INITIATOR_URL);
    aEbms3From.addPartyId(MessageHelperMethods.createEbms3PartyId(SOAP_12_PARTY_ID));
    aEbms3From.addPartyId(MessageHelperMethods.createEbms3PartyId(SOAP_12_PARTY_ID));
    aEbms3PartyInfo.setFrom(aEbms3From);
    // To => Receiver
    final Ebms3To aEbms3To = new Ebms3To();
    aEbms3To.setRole(CAS4.DEFAULT_RESPONDER_URL);
    aEbms3To.addPartyId(MessageHelperMethods.createEbms3PartyId(SOAP_12_PARTY_ID));
    aEbms3PartyInfo.setTo(aEbms3To);
    aEbms3UserMessage.setPartyInfo(aEbms3PartyInfo);
    aEbms3UserMessage.setPayloadInfo(aEbms3PayloadInfo);
    aEbms3UserMessage.setCollaborationInfo(aEbms3CollaborationInfo);
    aEbms3UserMessage.setMessageProperties(MessageHelperMethods.createEbms3MessageProperties(null));
    aEbms3UserMessage.setMessageInfo(MessageHelperMethods.createEbms3MessageInfo());
    aEbms3Messaging.addUserMessage(aEbms3UserMessage);
    final HttpEntity aEntity = new HttpXMLEntity(_getMessagingAsSoapDocument(aEbms3Messaging), SOAP_VERSION.getMimeType());
    sendPlainMessage(aEntity, false, EEbmsError.EBMS_VALUE_INCONSISTENT.getErrorCode());
}
Also used : Ebms3PayloadInfo(com.helger.phase4.ebms3header.Ebms3PayloadInfo) Ebms3From(com.helger.phase4.ebms3header.Ebms3From) HttpEntity(org.apache.http.HttpEntity) Ebms3CollaborationInfo(com.helger.phase4.ebms3header.Ebms3CollaborationInfo) Ebms3To(com.helger.phase4.ebms3header.Ebms3To) Node(org.w3c.dom.Node) Ebms3UserMessage(com.helger.phase4.ebms3header.Ebms3UserMessage) Ebms3Messaging(com.helger.phase4.ebms3header.Ebms3Messaging) HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) ClassPathResource(com.helger.commons.io.resource.ClassPathResource) Ebms3PartyInfo(com.helger.phase4.ebms3header.Ebms3PartyInfo) Test(org.junit.Test)

Aggregations

Ebms3UserMessage (com.helger.phase4.ebms3header.Ebms3UserMessage)26 Ebms3PartyInfo (com.helger.phase4.ebms3header.Ebms3PartyInfo)15 Ebms3MessageInfo (com.helger.phase4.ebms3header.Ebms3MessageInfo)14 Ebms3From (com.helger.phase4.ebms3header.Ebms3From)13 Ebms3SignalMessage (com.helger.phase4.ebms3header.Ebms3SignalMessage)13 Ebms3To (com.helger.phase4.ebms3header.Ebms3To)13 Nonnull (javax.annotation.Nonnull)13 Test (org.junit.Test)13 ErrorList (com.helger.commons.error.list.ErrorList)12 Ebms3Property (com.helger.phase4.ebms3header.Ebms3Property)12 PModeLeg (com.helger.phase4.model.pmode.leg.PModeLeg)12 Locale (java.util.Locale)12 Before (org.junit.Before)10 ECryptoAlgorithmSign (com.helger.phase4.crypto.ECryptoAlgorithmSign)9 ECryptoAlgorithmSignDigest (com.helger.phase4.crypto.ECryptoAlgorithmSignDigest)9 Ebms3PartyId (com.helger.phase4.ebms3header.Ebms3PartyId)9 ClassPathResource (com.helger.commons.io.resource.ClassPathResource)8 ETriState (com.helger.commons.state.ETriState)8 ECryptoAlgorithmCrypt (com.helger.phase4.crypto.ECryptoAlgorithmCrypt)8 Ebms3CollaborationInfo (com.helger.phase4.ebms3header.Ebms3CollaborationInfo)8