Search in sources :

Example 16 with AS4IncomingDumperFileBased

use of com.helger.phase4.dump.AS4IncomingDumperFileBased in project phase4 by phax.

the class MainPhase4PeppolSenderEdicom 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("9906:edicomtestes");
        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)).rawResponseConsumer(new AS4RawResponseConsumerWriteToFile()).validationConfiguration(PeppolValidation3_13_0.VID_OPENPEPPOL_INVOICE_V3, new Phase4PeppolValidatonResultHandler()).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 : SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) Element(org.w3c.dom.Element) 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 AS4IncomingDumperFileBased

use of com.helger.phase4.dump.AS4IncomingDumperFileBased in project phase4 by phax.

the class MainPhase4PeppolSenderElcom 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("0088:elcom-test");
        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)).rawResponseConsumer(new AS4RawResponseConsumerWriteToFile()).validationConfiguration(PeppolValidation3_13_0.VID_OPENPEPPOL_INVOICE_V3, new Phase4PeppolValidatonResultHandler()).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 : SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) Element(org.w3c.dom.Element) 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 AS4IncomingDumperFileBased

use of com.helger.phase4.dump.AS4IncomingDumperFileBased in project phase4 by phax.

the class MainPhase4PeppolSenderFujitsuConstantReceiver 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("0088:4026227000001");
        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).receiverEndpointDetails(CertificateHelper.convertStringToCertficate("-----BEGIN CERTIFICATE-----\r\n" + "MIIF2TCCA8GgAwIBAgIQT4nfwxxvMgudci9olw9WzjANBgkqhkiG9w0BAQsFADBr\r\n" + "MQswCQYDVQQGEwJCRTEZMBcGA1UEChMQT3BlblBFUFBPTCBBSVNCTDEWMBQGA1UE\r\n" + "CxMNRk9SIFRFU1QgT05MWTEpMCcGA1UEAxMgUEVQUE9MIEFDQ0VTUyBQT0lOVCBU\r\n" + "RVNUIENBIC0gRzIwHhcNMjEwNjA3MDAwMDAwWhcNMjMwNTI4MjM1OTU5WjBmMQsw\r\n" + "CQYDVQQGEwJERTEqMCgGA1UECgwhRnVqaXRzdSBUZWNobm9sb2d5IFNvbHV0aW9u\r\n" + "cyBHbWJIMRcwFQYDVQQLDA5QRVBQT0wgVEVTVCBBUDESMBAGA1UEAwwJUERFMDAw\r\n" + "NDY5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhcmqlHe5KXAKJfa\r\n" + "eklmjlVc1HYthwWdAaiVDWhfPEQpkQ0G8/c0iLSITVUWAqyrI2bWqykNaQnED0DW\r\n" + "nk7PCp775eYCPcXny4D/n2aII1OE6euL1b943gDmpK527mWIcTTkay9dzzTJD0Gw\r\n" + "z2wJwckN1MAss8Bwc5POqWOrP/5yQa8Wy+E8Ik6KNAOh3s5Ucx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uJkpvPrHKV65KN26ULbXA9xb/MRRPp\r\n" + "D5Q1eRYSw8xUybFUet1sBIG6BGgvIIdHj02o+PrS+7jRrJ/RWgXkNQWRs7gznFFp\r\n" + "H+2/qZChfp64OvD6RDxD8+zAl11acAfGQ8uaP6LdoTrog3jsa/y7EO7iNVdZZPxr\r\n" + "e04Kx5L3ZUWfv/Pc60bMWjnVbkPnfBzkwmwmr93YdjH4aw8XRk/sl33jdYs8Lwkg\r\n" + "imTcDDrts//eoTJZuZQZiGt9yWluOmkBIqjwWr92+GZmx7Sz9Gaw2HusMk07T4s2\r\n" + "IuS4/tVf+Dv+KWbzYlrm6BQhsBJEOE1SIpuCrLEjZZP+lrxjPug3OvbSO2si2usx\r\n" + "8+T/JLIQyQVksyIKmoMmvffY8izKqOktprbXW4bAgxN/j3vLPK7MGQYhV2EHE096\r\n" + "9woj7C7n+FanKIOpjQ==\r\n" + "-----END CERTIFICATE-----\r\n"), "https://testb2bportal.ts.fujitsu.com/ws/msh/receive").rawResponseConsumer(new AS4RawResponseConsumerWriteToFile()).validationConfiguration(PeppolValidation3_13_0.VID_OPENPEPPOL_INVOICE_V3, new Phase4PeppolValidatonResultHandler()).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 : ESimpleUserMessageSendResult(com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult) Element(org.w3c.dom.Element) 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 19 with AS4IncomingDumperFileBased

use of com.helger.phase4.dump.AS4IncomingDumperFileBased in project phase4 by phax.

the class MainPhase4PeppolSenderHelger method main.

public static void main(final String[] args) {
    // Enable in-memory managers
    // SystemProperties.setPropertyValue
    // (MetaAS4Manager.SYSTEM_PROPERTY_PHASE4_MANAGER_INMEMORY, true);
    WebScopeManager.onGlobalBegin(MockServletContext.create());
    // Dump (for debugging purpose only)
    AS4DumpManager.setIncomingDumper(new AS4IncomingDumperFileBased());
    AS4DumpManager.setOutgoingDumper(new AS4OutgoingDumperFileBased());
    try {
        send();
    } finally {
        WebScopeManager.onGlobalEnd();
    }
}
Also used : AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased)

Example 20 with AS4IncomingDumperFileBased

use of com.helger.phase4.dump.AS4IncomingDumperFileBased in project phase4 by phax.

the class MainPhase4PeppolSenderHelgerLargeFile 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 {
        send();
    } finally {
        WebScopeManager.onGlobalEnd();
    }
}
Also used : AS4IncomingDumperFileBased(com.helger.phase4.dump.AS4IncomingDumperFileBased) AS4OutgoingDumperFileBased(com.helger.phase4.dump.AS4OutgoingDumperFileBased)

Aggregations

AS4IncomingDumperFileBased (com.helger.phase4.dump.AS4IncomingDumperFileBased)42 AS4OutgoingDumperFileBased (com.helger.phase4.dump.AS4OutgoingDumperFileBased)42 File (java.io.File)36 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)33 ESimpleUserMessageSendResult (com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult)33 Element (org.w3c.dom.Element)32 AS4RawResponseConsumerWriteToFile (com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile)31 SMPClientReadOnly (com.helger.smpclient.peppol.SMPClientReadOnly)27 IAS4ClientBuildMessageCallback (com.helger.phase4.client.IAS4ClientBuildMessageCallback)14 AS4UserMessage (com.helger.phase4.messaging.domain.AS4UserMessage)14 AbstractAS4Message (com.helger.phase4.messaging.domain.AbstractAS4Message)14 HttpRetrySettings (com.helger.phase4.http.HttpRetrySettings)6 IAS4CryptoFactory (com.helger.phase4.crypto.IAS4CryptoFactory)4 IValidationSourceXML (com.helger.phive.engine.source.IValidationSourceXML)3 GlobalDebug (com.helger.commons.debug.GlobalDebug)2 SimpleFileIO (com.helger.commons.io.file.SimpleFileIO)2 CMimeType (com.helger.commons.mime.CMimeType)2 HttpDebugger (com.helger.httpclient.HttpDebugger)2 JsonWriterSettings (com.helger.json.serialize.JsonWriterSettings)2 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)2