Search in sources :

Example 21 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class SMPClientWithDNSFuncTest method testGetByDNS.

@Test
public void testGetByDNS() throws Exception {
    // Make sure that the dns exists.
    final String sParticipantID = "0088:5798000000001";
    final String sDocumentID = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::InvoiceDisputeDisputeInvoice##UBL-2.0";
    final IParticipantIdentifier aServiceGroupID = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(sParticipantID);
    final IDocumentTypeIdentifier aDocumentTypeID = PeppolIdentifierFactory.INSTANCE.createDocumentTypeIdentifierWithDefaultScheme(sDocumentID);
    final ServiceGroupType aGroup = SMPClientReadOnly.getServiceGroupByDNS(URL_PROVIDER, SML_INFO, aServiceGroupID);
    assertNotNull(aGroup);
    final SignedServiceMetadataType aMetadata = SMPClientReadOnly.getServiceRegistrationByDNS(URL_PROVIDER, SML_INFO, aServiceGroupID, aDocumentTypeID);
    assertNotNull(aMetadata);
}
Also used : IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) SignedServiceMetadataType(com.helger.xsds.peppol.smp1.SignedServiceMetadataType) ServiceGroupType(com.helger.xsds.peppol.smp1.ServiceGroupType) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 22 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class SMPClientWithDNSFuncTest method testGetByDNSForDocs.

@Test
public void testGetByDNSForDocs() throws Exception {
    // ServiceGroup = participant identifier; GLN = 0088
    final IParticipantIdentifier aServiceGroupID = EPredefinedParticipantIdentifierScheme.GLN.createParticipantIdentifier("5798000000001");
    // Document type identifier from enumeration
    @SuppressWarnings("deprecation") final IDocumentTypeIdentifier aDocumentTypeID = EPredefinedDocumentTypeIdentifier.INVOICE_T010_BIS4A_V20.getAsDocumentTypeIdentifier();
    // Main call to the SMP client with the correct SML to use
    final SignedServiceMetadataType aMetadata = SMPClientReadOnly.getServiceRegistrationByDNS(URL_PROVIDER, ESML.DIGIT_TEST, aServiceGroupID, aDocumentTypeID);
    assertNotNull(aMetadata);
}
Also used : IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) SignedServiceMetadataType(com.helger.xsds.peppol.smp1.SignedServiceMetadataType) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier) Test(org.junit.Test)

Example 23 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainSMPClientCaseSensitivity method main.

public static void main(final String[] args) throws Exception {
    final IParticipantIdentifier participantId = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("0088:5060510050006");
    LOGGER.info("Participant: " + participantId.getURIEncoded());
    LOGGER.info("Participant ID case INsensitive: " + PeppolIdentifierFactory.INSTANCE.isParticipantIdentifierCaseInsensitive(participantId.getScheme()));
    final SMPClientReadOnly smpClient = new SMPClientReadOnly(PeppolURLProvider.INSTANCE, participantId, ESML.DIGIT_PRODUCTION);
    smpClient.setXMLSchemaValidation(false);
    final IDocumentTypeIdentifier doctypeId = PeppolIdentifierFactory.INSTANCE.createDocumentTypeIdentifierWithDefaultScheme("urn:oasis:names:specification:ubl:schema:xsd:Order-2::Order##urn:www.cenbii.eu:transaction:biitrns001:ver2.0:extended:urn:www.peppol.eu:bis:peppol28a:ver1.0::2.1");
    LOGGER.info("DocType: " + doctypeId.getURIEncoded());
    LOGGER.info("DocType ID case INsensitive: " + PeppolIdentifierFactory.INSTANCE.isDocumentTypeIdentifierCaseInsensitive(doctypeId.getScheme()));
    IProcessIdentifier processId = PeppolIdentifierFactory.INSTANCE.createProcessIdentifierWithDefaultScheme("URN:WWW.CENBII.EU:PROFILE:BII28:VER2.0");
    LOGGER.info("Process[1]: " + processId.getURIEncoded());
    LOGGER.info("Process ID case INsensitive: " + PeppolIdentifierFactory.INSTANCE.isProcessIdentifierCaseInsensitive(processId.getScheme()));
    EndpointType endpoint = smpClient.getEndpoint(participantId, doctypeId, processId, ESMPTransportProfile.TRANSPORT_PROFILE_AS2);
    LOGGER.info("1 - " + endpoint);
    // Won't work, because process identifiers in PEPPOL are case sensitive!
    processId = PeppolIdentifierFactory.INSTANCE.createProcessIdentifierWithDefaultScheme("urn:www.cenbii.eu:profile:bii28:ver2.0");
    LOGGER.info("Process[2]: " + processId.getURIEncoded());
    LOGGER.info("Process ID case INsensitive: " + PeppolIdentifierFactory.INSTANCE.isProcessIdentifierCaseInsensitive(processId.getScheme()));
    endpoint = smpClient.getEndpoint(participantId, doctypeId, processId, ESMPTransportProfile.TRANSPORT_PROFILE_AS2);
    LOGGER.info("2 - " + endpoint);
}
Also used : SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) EndpointType(com.helger.xsds.peppol.smp1.EndpointType) IDocumentTypeIdentifier(com.helger.peppolid.IDocumentTypeIdentifier) IProcessIdentifier(com.helger.peppolid.IProcessIdentifier) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 24 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainSMPClientExample method main.

public static void main(final String[] args) throws Exception {
    // The PEPPOL participant identifier
    final IParticipantIdentifier aPI_AT_Test = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9915:test");
    // Create the main SMP client using the production SML
    final SMPClientReadOnly aSMPClient = new SMPClientReadOnly(PeppolURLProvider.INSTANCE, aPI_AT_Test, ESML.DIGIT_TEST);
    final String sEndpointAddress = aSMPClient.getEndpointAddress(aPI_AT_Test, EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30, EPredefinedProcessIdentifier.BIS3_BILLING, ESMPTransportProfile.TRANSPORT_PROFILE_PEPPOL_AS4_V2);
    // Endpoint address should be "https://testap.erechnung.gv.at/as4"
    LOGGER.info("The Austrian government test AS4 AP that handles invoices according to Billing BIS 3 is located at: " + sEndpointAddress);
}
Also used : SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 25 with IParticipantIdentifier

use of com.helger.peppolid.IParticipantIdentifier in project peppol-commons by phax.

the class MainSMPClientExampleNoDNSLookup method main.

public static void main(final String[] args) throws Exception {
    // The PEPPOL participant identifier
    final IParticipantIdentifier aPI_AT_Test = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9915:test");
    // Create the main SMP client using the production SML
    final SMPClientReadOnly aSMPClient = new SMPClientReadOnly(URLHelper.getAsURI("http://B-85008b8279e07ab0392da75fa55856a2.iso6523-actorid-upis.acc.edelivery.tech.ec.europa.eu"));
    final String sEndpointAddress = aSMPClient.getEndpointAddress(aPI_AT_Test, EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30, EPredefinedProcessIdentifier.BIS3_BILLING, ESMPTransportProfile.TRANSPORT_PROFILE_PEPPOL_AS4_V2);
    // Endpoint address should be "https://testap.erechnung.gv.at/as4"
    LOGGER.info("The Austrian government test AS4 AP that handles invoices according to Billing BIS 3 is located at: " + sEndpointAddress);
}
Also used : SMPClientReadOnly(com.helger.smpclient.peppol.SMPClientReadOnly) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Aggregations

IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)218 Test (org.junit.Test)70 IDocumentTypeIdentifier (com.helger.peppolid.IDocumentTypeIdentifier)58 IIdentifierFactory (com.helger.peppolid.factory.IIdentifierFactory)57 ISMPServiceGroupManager (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroupManager)51 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)47 File (java.io.File)46 Nonnull (javax.annotation.Nonnull)43 ESimpleUserMessageSendResult (com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult)42 Element (org.w3c.dom.Element)41 SMPClientReadOnly (com.helger.smpclient.peppol.SMPClientReadOnly)40 AS4RawResponseConsumerWriteToFile (com.helger.phase4.dump.AS4RawResponseConsumerWriteToFile)38 AS4IncomingDumperFileBased (com.helger.phase4.dump.AS4IncomingDumperFileBased)35 AS4OutgoingDumperFileBased (com.helger.phase4.dump.AS4OutgoingDumperFileBased)35 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)30 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)24 ISMPServiceInformationManager (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformationManager)24 SMPServerException (com.helger.phoss.smp.exception.SMPServerException)24 ISMPServiceInformation (com.helger.phoss.smp.domain.serviceinfo.ISMPServiceInformation)19 ICommonsList (com.helger.commons.collection.impl.ICommonsList)18