Search in sources :

Example 16 with IAS4ClientBuildMessageCallback

use of com.helger.phase4.client.IAS4ClientBuildMessageCallback in project phase4 by phax.

the class MainPhase4PeppolSenderOZGRE method main.

public static void main(final String[] args) {
    WebScopeManager.onGlobalBegin(MockServletContext.create());
    // Dump (for debugging purpose only)
    AS4DumpManager.setIncomingDumper(new AS4IncomingDumperFileBased());
    AS4DumpManager.setOutgoingDumper(new AS4OutgoingDumperFileBased());
    try {
        final boolean bVerify = false;
        final Element aPayloadElement = DOMReader.readXMLDOM(new File("src/test/resources/" + (bVerify ? "zre/Verifizierungs_Rechnung_PEPPOL.xml" : "examples/xrechnung-2.0.0-ubl-inv.xml"))).getDocumentElement();
        if (aPayloadElement == null)
            throw new IllegalStateException("Failed to read XML file to be send");
        // Start configuring here
        final IParticipantIdentifier aReceiverID = Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("0204:99661-WEBSERVICEOZG-28");
        final IAS4ClientBuildMessageCallback aBuildMessageCallback = new IAS4ClientBuildMessageCallback() {

            public void onAS4Message(final AbstractAS4Message<?> aMsg) {
                final AS4UserMessage aUserMsg = (AS4UserMessage) aMsg;
                LOGGER.info("Sending out AS4 message with message ID '" + aUserMsg.getEbms3UserMessage().getMessageInfo().getMessageId() + "'");
                LOGGER.info("Sending out AS4 message with conversation ID '" + aUserMsg.getEbms3UserMessage().getCollaborationInfo().getConversationId() + "'");
            }
        };
        final ESimpleUserMessageSendResult eResult = Phase4PeppolSender.builder().documentTypeID(Phase4PeppolSender.IF.createDocumentTypeIdentifierWithDefaultScheme(bVerify ? "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0::2.1" : "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0::2.1")).processID(Phase4PeppolSender.IF.createProcessIdentifierWithDefaultScheme("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0")).senderParticipantID(Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:phase4-test-sender")).receiverParticipantID(aReceiverID).senderPartyID("POP000306").payload(aPayloadElement).smpClient(new SMPClientReadOnly(Phase4PeppolSender.URL_PROVIDER, aReceiverID, ESML.DIGIT_TEST)).rawResponseConsumer(new AS4RawResponseConsumerWriteToFile()).buildMessageCallback(aBuildMessageCallback).sendMessageAndCheckForReceipt();
        LOGGER.info("Peppol send result: " + eResult);
    } catch (final Exception ex) {
        LOGGER.error("Error sending Peppol message via AS4", ex);
    } finally {
        WebScopeManager.onGlobalEnd();
    }
}
Also used : IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) Element(org.w3c.dom.Element) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) File(java.io.File) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 17 with IAS4ClientBuildMessageCallback

use of com.helger.phase4.client.IAS4ClientBuildMessageCallback in project phase4 by phax.

the class MainPhase4PeppolSenderQvalia method main.

public static void main(final String[] args) {
    WebScopeManager.onGlobalBegin(MockServletContext.create());
    // Dump (for debugging purpose only)
    AS4DumpManager.setIncomingDumper(new AS4IncomingDumperFileBased());
    AS4DumpManager.setOutgoingDumper(new AS4OutgoingDumperFileBased());
    try {
        final Element aPayloadElement = DOMReader.readXMLDOM(new File("src/test/resources/examples/base-example.xml")).getDocumentElement();
        if (aPayloadElement == null)
            throw new IllegalStateException("Failed to read XML file to be send");
        // Start configuring here
        final IParticipantIdentifier aReceiverID = Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("0007:5567321707");
        final IAS4ClientBuildMessageCallback aBuildMessageCallback = new IAS4ClientBuildMessageCallback() {

            public void onAS4Message(final AbstractAS4Message<?> aMsg) {
                final AS4UserMessage aUserMsg = (AS4UserMessage) aMsg;
                LOGGER.info("Sending out AS4 message with message ID '" + aUserMsg.getEbms3UserMessage().getMessageInfo().getMessageId() + "'");
                LOGGER.info("Sending out AS4 message with conversation ID '" + aUserMsg.getEbms3UserMessage().getCollaborationInfo().getConversationId() + "'");
            }
        };
        // Invalid certificate is valid until 2029
        final IAS4CryptoFactory cf = true ? AS4CryptoFactoryProperties.getDefaultInstance() : new AS4CryptoFactoryInMemoryKeyStore(KeyStoreHelper.loadKeyStoreDirect(EKeyStoreType.JKS, "invalid-keystore-pw-peppol.jks", "peppol"), "1", "peppol", KeyStoreHelper.loadKeyStore(PeppolKeyStoreHelper.TRUSTSTORE_TYPE, PeppolKeyStoreHelper.Config2018.TRUSTSTORE_PRODUCTION_CLASSPATH, PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD).getKeyStore());
        final ESimpleUserMessageSendResult eResult;
        eResult = Phase4PeppolSender.builder().httpRetrySettings(new HttpRetrySettings().setMaxRetries(0)).cryptoFactory(cf).documentTypeID(Phase4PeppolSender.IF.createDocumentTypeIdentifierWithDefaultScheme("urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1")).processID(Phase4PeppolSender.IF.createProcessIdentifierWithDefaultScheme("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0")).senderParticipantID(Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:phase4-test-sender")).receiverParticipantID(aReceiverID).senderPartyID("POP000306").payload(aPayloadElement).smpClient(new SMPClientReadOnly(Phase4PeppolSender.URL_PROVIDER, aReceiverID, ESML.DIGIT_TEST)).rawResponseConsumer(new AS4RawResponseConsumerWriteToFile()).validationConfiguration(PeppolValidation3_13_0.VID_OPENPEPPOL_INVOICE_V3, new Phase4PeppolValidatonResultHandler()).buildMessageCallback(aBuildMessageCallback).sendMessageAndCheckForReceipt();
        LOGGER.info("Peppol send result: " + eResult);
    } catch (final Exception ex) {
        LOGGER.error("Error sending Peppol message via AS4", ex);
    } finally {
        WebScopeManager.onGlobalEnd();
    }
}
Also used : IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) IAS4CryptoFactory(com.helger.phase4.crypto.IAS4CryptoFactory) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) Element(org.w3c.dom.Element) AS4CryptoFactoryInMemoryKeyStore(com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) HttpRetrySettings(com.helger.phase4.http.HttpRetrySettings) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) File(java.io.File) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 18 with IAS4ClientBuildMessageCallback

use of com.helger.phase4.client.IAS4ClientBuildMessageCallback in project phase4 by phax.

the class MainPhase4PeppolSenderQvaliaConstantReceiver method main.

public static void main(final String[] args) {
    WebScopeManager.onGlobalBegin(MockServletContext.create());
    // Dump (for debugging purpose only)
    AS4DumpManager.setIncomingDumper(new AS4IncomingDumperFileBased());
    AS4DumpManager.setOutgoingDumper(new AS4OutgoingDumperFileBased());
    try {
        final Element aPayloadElement = DOMReader.readXMLDOM(new File("src/test/resources/examples/base-example.xml")).getDocumentElement();
        if (aPayloadElement == null)
            throw new IllegalStateException("Failed to read XML file to be send");
        // Start configuring here
        final IParticipantIdentifier aReceiverID = Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("0007:5567321707");
        final IAS4ClientBuildMessageCallback aBuildMessageCallback = new IAS4ClientBuildMessageCallback() {

            public void onAS4Message(final AbstractAS4Message<?> aMsg) {
                final AS4UserMessage aUserMsg = (AS4UserMessage) aMsg;
                LOGGER.info("Sending out AS4 message with message ID '" + aUserMsg.getEbms3UserMessage().getMessageInfo().getMessageId() + "'");
            }
        };
        final IAS4CryptoFactory cf = AS4CryptoFactoryProperties.getDefaultInstance();
        final ESimpleUserMessageSendResult eResult;
        eResult = Phase4PeppolSender.builder().httpRetrySettings(new HttpRetrySettings().setMaxRetries(0)).cryptoFactory(cf).documentTypeID(Phase4PeppolSender.IF.createDocumentTypeIdentifierWithDefaultScheme("urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1")).processID(Phase4PeppolSender.IF.createProcessIdentifierWithDefaultScheme("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0")).senderParticipantID(Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:phase4-test-sender")).receiverParticipantID(aReceiverID).senderPartyID("POP000306").payload(aPayloadElement).receiverEndpointDetails(CertificateHelper.convertStringToCertficate("-----BEGIN CERTIFICATE-----\r\n" + "MIIFxzCCA6+gAwIBAgIQTJRiSywVkdw+JqmDB29xYjANBgkqhkiG9w0BAQsFADBr MQswCQYDVQQGEwJCRTEZMBcGA1UEChMQT3BlblBFUFBPTCBBSVNCTDEWMBQGA1UE CxMNRk9SIFRFU1QgT05MWTEpMCcGA1UEAxMgUEVQUE9MIEFDQ0VTUyBQT0lOVCBU RVNUIENBIC0gRzIwHhcNMjAwODIxMDAwMDAwWhcNMjIwODExMjM1OTU5WjBUMRIw EAYDVQQDDAlQU0UwMDAwOTQxFzAVBgNVBAsMDlBFUFBPTCBURVNUIEFQMRgwFgYD VQQKDA9RdmFsaWEgR3JvdXAgQUIxCzAJBgNVBAYTAlNFMIIBIjANBgkqhkiG9w0B AQEFAAOCAQ8AMIIBCgKCAQEArMPej9tY7q6Yf1X3ki4yDcMIuVBrBvwEluXxBoLI C02BeGA2gFln2gGz/2ydFF1hokW5rmoUrJwHT2WoxHK2evvbiyDIOh3ULNKD5Qml XMZMPOHrMth0r3v0Fuvvl8t88pcB2zJxmysHa+Y0HDb6O2W9uZssMZr25eKPb3p+ /qUe0/UoAsPW+u7mhjZdjIsUz+MtYlUyAedcQptM6uh18f6eR2mL0mnp0V2jeBH9 s8YVxh4YoL3pfFVEYGXR/KoRrTdz2CMDhDjO+A4sUsidr7C5gy1CKTUKxUHoensA 0KJKMIJ3ZetslMnizSP2Y7600N8ryh4VC+tQWD8NRwYWxQIDAQABo4IBfDCCAXgw DAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCA6gwFgYDVR0lAQH/BAwwCgYIKwYB BQUHAwIwHQYDVR0OBBYEFJCO623l0AmEUOcvRYZ5TuX43LSjMF0GA1UdHwRWMFQw UqBQoE6GTGh0dHA6Ly9wa2ktY3JsLnN5bWF1dGguY29tL2NhXzZhOTM3NzM0YTM5 M2EwODA1YmYzM2NkYThiMzMxMDkzL0xhdGVzdENSTC5jcmwwNwYIKwYBBQUHAQEE KzApMCcGCCsGAQUFBzABhhtodHRwOi8vcGtpLW9jc3Auc3ltYXV0aC5jb20wHwYD VR0jBBgwFoAUa29LtvE3uis8fxjNuiuyuXwqN+swLQYKYIZIAYb4RQEQAwQfMB0G E2CGSAGG+EUBEAECAwEBgamQ4QMWBjk1NzYwODA5BgpghkgBhvhFARAFBCswKQIB ABYkYUhSMGNITTZMeTl3YTJrdGNtRXVjM2x0WVhWMGFDNWpiMjA9MA0GCSqGSIb3 DQEBCwUAA4ICAQAAZNS3JzZn5rOcWKtYe+6Eh7nao8FQaMTXtKPOPWat00GUZwYX mqy2tyRTGzKWf+dByiGhfC0IdNlhHZJ7fH0TdXabFX9MaySm25TUJsaAX5eUTVMM C4XZJEX9ngie2NHTPqJsJPS/7utRONizjFa3PbI4STRt8SQNA3L/yxrf3H/Qujnd F5L6KTdIRU0pP+4qs4qbcbGcEzaZieOyNoSP2r1z3MIn+JVOHQetOrPkXKpuwFcD bdzaFLnZqiPRkI3ibpsml5fFLWwE9QTn+PcORZXvURlT0Ndm88FvDQWzAZ8y/f32 Fj0dCIFk+ACSwQnZsdVIcSzkDRYzQtxOmQW282rMO3TCgrKCztHQ/so+t7Mg4Qf+ wN/DmyZAdjhuzqnyX3mOxxbvFTqveatVL5PGMIbjhzWmrEztMgwdSB5DsS6OeaBL H3MohqqDECtiD5/U5FziHTDqSr6LIljz7zLK/7aK9I/h0xuoqzQGCqhn5mrB+ube L7SFxT6nM5pw5ZPvqIS0h4lOTWCq5Y5j2aXmo23trDfMoWqRncOlX18cnAThlnT2 RydPPOVrcFk4JehM2oRgm3ldo+Pj4lhQQ5WnBdX9o7yvnZhn96KyVqiMU25TDf6M JNLrljdeiEAl3pNsqzXSJ7nREhWzVI2IWe+NXEOUN3z7PgeKH0sh2KdS7g==" + "-----END CERTIFICATE-----\r\n" + ""), "https://peppol-ap-test.qvalia.com/peppol/as4").validationConfiguration(PeppolValidation3_13_0.VID_OPENPEPPOL_INVOICE_V3, new Phase4PeppolValidatonResultHandler()).buildMessageCallback(aBuildMessageCallback).sendMessageAndCheckForReceipt();
        LOGGER.info("Peppol send result: " + eResult);
    } catch (final Exception ex) {
        LOGGER.error("Error sending Peppol message via AS4", ex);
    } finally {
        WebScopeManager.onGlobalEnd();
    }
}
Also used : IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) IAS4CryptoFactory(com.helger.phase4.crypto.IAS4CryptoFactory) Element(org.w3c.dom.Element) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) HttpRetrySettings(com.helger.phase4.http.HttpRetrySettings) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) File(java.io.File) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 19 with IAS4ClientBuildMessageCallback

use of com.helger.phase4.client.IAS4ClientBuildMessageCallback in project phase4 by phax.

the class MainPhase4PeppolSenderGovernikus method main.

public static void main(final String[] args) {
    WebScopeManager.onGlobalBegin(MockServletContext.create());
    // Dump (for debugging purpose only)
    AS4DumpManager.setIncomingDumper(new AS4IncomingDumperFileBased());
    AS4DumpManager.setOutgoingDumper(new AS4OutgoingDumperFileBased());
    try {
        final Element aPayloadElement = DOMReader.readXMLDOM(new File("src/test/resources/examples/base-example.xml")).getDocumentElement();
        if (aPayloadElement == null)
            throw new IllegalStateException("Failed to read XML file to be send");
        // Start configuring here
        // Alternative one: 0204:gov06test-85
        final IParticipantIdentifier aReceiverID = Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:peppol-test-governikus-01");
        final IAS4ClientBuildMessageCallback aBuildMessageCallback = new IAS4ClientBuildMessageCallback() {

            public void onAS4Message(final AbstractAS4Message<?> aMsg) {
                final AS4UserMessage aUserMsg = (AS4UserMessage) aMsg;
                LOGGER.info("Sending out AS4 message with message ID '" + aUserMsg.getEbms3UserMessage().getMessageInfo().getMessageId() + "'");
                LOGGER.info("Sending out AS4 message with conversation ID '" + aUserMsg.getEbms3UserMessage().getCollaborationInfo().getConversationId() + "'");
            }
        };
        final ESimpleUserMessageSendResult eResult = Phase4PeppolSender.builder().documentTypeID(Phase4PeppolSender.IF.createDocumentTypeIdentifierWithDefaultScheme(true ? "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1" : "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0::2.1")).processID(Phase4PeppolSender.IF.createProcessIdentifierWithDefaultScheme("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0")).senderParticipantID(Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:phase4-test-sender")).receiverParticipantID(aReceiverID).senderPartyID("POP000306").payload(aPayloadElement).smpClient(new SMPClientReadOnly(Phase4PeppolSender.URL_PROVIDER, aReceiverID, ESML.DIGIT_TEST)).rawResponseConsumer(new AS4RawResponseConsumerWriteToFile()).buildMessageCallback(aBuildMessageCallback).sendMessageAndCheckForReceipt();
        LOGGER.info("Peppol send result: " + eResult);
    } catch (final Exception ex) {
        LOGGER.error("Error sending Peppol message via AS4", ex);
    } finally {
        WebScopeManager.onGlobalEnd();
    }
}
Also used : IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) Element(org.w3c.dom.Element) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) File(java.io.File) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 20 with IAS4ClientBuildMessageCallback

use of com.helger.phase4.client.IAS4ClientBuildMessageCallback in project phase4 by phax.

the class MainPhase4PeppolSenderHelger method send.

public static void send() {
    try {
        final Element aPayloadElement = DOMReader.readXMLDOM(new File("src/test/resources/examples/base-example.xml")).getDocumentElement();
        if (aPayloadElement == null)
            throw new IllegalStateException("Failed to read XML file to be send");
        // Start configuring here
        final IParticipantIdentifier aReceiverID = Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:helger");
        final IAS4ClientBuildMessageCallback aBuildMessageCallback = new IAS4ClientBuildMessageCallback() {

            public void onAS4Message(final AbstractAS4Message<?> aMsg) {
                final AS4UserMessage aUserMsg = (AS4UserMessage) aMsg;
                LOGGER.info("Sending out AS4 message with message ID '" + aUserMsg.getEbms3UserMessage().getMessageInfo().getMessageId() + "'");
                LOGGER.info("Sending out AS4 message with conversation ID '" + aUserMsg.getEbms3UserMessage().getCollaborationInfo().getConversationId() + "'");
            }
        };
        final IAS4RawResponseConsumer aRRC = new AS4RawResponseConsumerWriteToFile().setHandleStatusLine(true).setHandleHttpHeaders(true).and(x -> {
            LOGGER.info("Response status line: " + x.getResponseStatusLine());
            LOGGER.info("Response headers:");
            x.getResponseHeaders().forEachSingleHeader((k, v) -> LOGGER.info("  " + k + "=" + v), false);
        });
        final ESimpleUserMessageSendResult eResult;
        eResult = Phase4PeppolSender.builder().documentTypeID(Phase4PeppolSender.IF.createDocumentTypeIdentifierWithDefaultScheme("urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1")).processID(Phase4PeppolSender.IF.createProcessIdentifierWithDefaultScheme("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0")).senderParticipantID(Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme("9915:phase4-test-sender")).receiverParticipantID(aReceiverID).senderPartyID("POP000306").payload(aPayloadElement).smpClient(new SMPClientReadOnly(Phase4PeppolSender.URL_PROVIDER, aReceiverID, ESML.DIGIT_TEST)).sbdDocumentConsumer(x -> {
            if (false)
                LOGGER.info(SBDHWriter.standardBusinessDocument().setFormattedOutput(true).getAsString(x));
        }).validationConfiguration(PeppolValidation3_13_0.VID_OPENPEPPOL_INVOICE_V3, new Phase4PeppolValidatonResultHandler()).buildMessageCallback(aBuildMessageCallback).rawResponseConsumer(aRRC).sendMessageAndCheckForReceipt();
        LOGGER.info("Peppol send result: " + eResult);
    } catch (final Exception ex) {
        LOGGER.error("Error sending Peppol message via AS4", ex);
    }
}
Also used : AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) Logger(org.slf4j.Logger) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) IAS4RawResponseConsumer(com.helger.phase4.client.IAS4RawResponseConsumer) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased) LoggerFactory(org.slf4j.LoggerFactory) File(java.io.File) AS4DumpManager(com.helger.phase4.dump.AS4DumpManager) PeppolValidation3_13_0(com.helger.phive.peppol.PeppolValidation3_13_0) IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) DOMReader(com.helger.xml.serialize.read.DOMReader) Element(org.w3c.dom.Element) MockServletContext(com.helger.servlet.mock.MockServletContext) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) WebScopeManager(com.helger.web.scope.mgr.WebScopeManager) SBDHWriter(com.helger.sbdh.builder.SBDHWriter) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) ESML(com.helger.peppol.sml.ESML) IAS4ClientBuildMessageCallback(com.helger.phase4.client.IAS4ClientBuildMessageCallback) SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) Element(org.w3c.dom.Element) IAS4RawResponseConsumer(com.helger.phase4.client.IAS4RawResponseConsumer) AS4UserMessage(com.helger.phase4.messaging.domain.AS4UserMessage) AbstractAS4Message(com.helger.phase4.messaging.domain.AbstractAS4Message) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) AS4RawResponseConsumerWriteToFile(com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile) File(java.io.File) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Aggregations

IAS4ClientBuildMessageCallback (com.helger.phase4.client.IAS4ClientBuildMessageCallback)19 AS4UserMessage (com.helger.phase4.messaging.domain.AS4UserMessage)17 File (java.io.File)17 AbstractAS4Message (com.helger.phase4.messaging.domain.AbstractAS4Message)16 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)15 AS4IncomingDumperFileBased (com.helger.phase4.dump.AS4IncomingDumperFileBased)15 AS4OutgoingDumperFileBased (com.helger.phase4.dump.AS4OutgoingDumperFileBased)15 ESimpleUserMessageSendResult (com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult)15 Element (org.w3c.dom.Element)14 AS4RawResponseConsumerWriteToFile (com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile)13 SMPClientReadOnly (com.helger.smpclient.peppol.SMPClientReadOnly)13 IAS4CryptoFactory (com.helger.phase4.crypto.IAS4CryptoFactory)10 HttpRetrySettings (com.helger.phase4.http.HttpRetrySettings)6 IAS4OutgoingDumper (com.helger.phase4.dump.IAS4OutgoingDumper)5 Nonnull (javax.annotation.Nonnull)5 Wrapper (com.helger.commons.wrapper.Wrapper)4 IAS4RawResponseConsumer (com.helger.phase4.client.IAS4RawResponseConsumer)4 AS4ClientUserMessage (com.helger.phase4.client.AS4ClientUserMessage)3 IAS4RetryCallback (com.helger.phase4.client.IAS4RetryCallback)3 Ebms3SignalMessage (com.helger.phase4.ebms3header.Ebms3SignalMessage)3