Search in sources :

Example 1 with Ebms3Service

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

the class MessageHelperMethods method createEbms3CollaborationInfo.

@Nonnull
public static Ebms3CollaborationInfo createEbms3CollaborationInfo(@Nullable final String sAgreementRefPMode, @Nullable final String sAgreementRefValue, @Nullable final String sServiceType, @Nonnull @Nonempty final String sServiceValue, @Nonnull @Nonempty final String sAction, @Nonnull final String sConversationID) {
    ValueEnforcer.notEmpty(sServiceValue, "ServiceValue");
    ValueEnforcer.notEmpty(sAction, "Action");
    ValueEnforcer.notNull(sConversationID, "ConversationID");
    final Ebms3CollaborationInfo aEbms3CollaborationInfo = new Ebms3CollaborationInfo();
    if (StringHelper.hasText(sAgreementRefValue)) {
        final Ebms3AgreementRef aEbms3AgreementRef = new Ebms3AgreementRef();
        if (StringHelper.hasText(sAgreementRefPMode))
            aEbms3AgreementRef.setPmode(sAgreementRefPMode);
        aEbms3AgreementRef.setValue(sAgreementRefValue);
        aEbms3CollaborationInfo.setAgreementRef(aEbms3AgreementRef);
    }
    {
        final Ebms3Service aEbms3Service = new Ebms3Service();
        aEbms3Service.setType(sServiceType);
        aEbms3Service.setValue(sServiceValue);
        aEbms3CollaborationInfo.setService(aEbms3Service);
    }
    aEbms3CollaborationInfo.setAction(sAction);
    aEbms3CollaborationInfo.setConversationId(sConversationID);
    return aEbms3CollaborationInfo;
}
Also used : Ebms3CollaborationInfo(com.helger.phase4.ebms3header.Ebms3CollaborationInfo) Ebms3Service(com.helger.phase4.ebms3header.Ebms3Service) Ebms3AgreementRef(com.helger.phase4.ebms3header.Ebms3AgreementRef) Nonnull(javax.annotation.Nonnull)

Example 2 with Ebms3Service

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

the class PModeCheckTest method testWrongPModeID.

// Can not do that anymore since everything gets accepted with default profile
// pmode
@Test
@Ignore("The PMode resolution is not done based on PMode ID - therefore this cannot fail")
public void testWrongPModeID() throws Exception {
    m_aEbms3UserMessage.getCollaborationInfo().getAgreementRef().setPmode("this-is-a-wrong-id");
    // Needed to set since also Action and Service combination gets checked if
    // they are already in the pmode pool
    final Ebms3Service aService = new Ebms3Service();
    aService.setValue("Random Value");
    m_aEbms3UserMessage.getCollaborationInfo().setService(aService);
    final Document aDoc = AS4UserMessage.create(SOAP_VERSION, m_aEbms3UserMessage).setMustUnderstand(true).getAsSoapDocument(m_aPayload);
    assertNotNull(aDoc);
    sendPlainMessageAndWait(new HttpXMLEntity(aDoc, SOAP_VERSION.getMimeType()), false, EEbmsError.EBMS_PROCESSING_MODE_MISMATCH.getErrorCode());
}
Also used : HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Ebms3Service(com.helger.phase4.ebms3header.Ebms3Service) Document(org.w3c.dom.Document) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with Ebms3Service

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

the class PModeCheckTest method testNullPModeID.

@Test
public void testNullPModeID() throws Exception {
    m_aEbms3UserMessage.getCollaborationInfo().getAgreementRef().setPmode(null);
    // Needed to set since also Action and Service combination gets checked if
    // they are already in the pmode pool
    final Ebms3Service aService = new Ebms3Service();
    aService.setValue("urn:www.cenbii.eu:profile:bii04:ver2.0");
    aService.setType("cenbii-procid-ubl");
    m_aEbms3UserMessage.getCollaborationInfo().setService(aService);
    m_aEbms3UserMessage.getCollaborationInfo().setAction("urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0::2.1");
    final Document aDoc = AS4UserMessage.create(SOAP_VERSION, m_aEbms3UserMessage).setMustUnderstand(true).getAsSoapDocument(m_aPayload);
    assertNotNull(aDoc);
    sendPlainMessageAndWait(new HttpXMLEntity(aDoc, SOAP_VERSION.getMimeType()), true, null);
}
Also used : HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Ebms3Service(com.helger.phase4.ebms3header.Ebms3Service) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

Ebms3Service (com.helger.phase4.ebms3header.Ebms3Service)3 HttpXMLEntity (com.helger.phase4.http.HttpXMLEntity)2 Test (org.junit.Test)2 Document (org.w3c.dom.Document)2 Ebms3AgreementRef (com.helger.phase4.ebms3header.Ebms3AgreementRef)1 Ebms3CollaborationInfo (com.helger.phase4.ebms3header.Ebms3CollaborationInfo)1 Nonnull (javax.annotation.Nonnull)1 Ignore (org.junit.Ignore)1