Search in sources :

Example 31 with HttpXMLEntity

use of com.helger.phase4.http.HttpXMLEntity 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)

Example 32 with HttpXMLEntity

use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.

the class PModePingTest method testUsePModePingSuccessful.

// Can only check success, since we cannot check if SPIs got called or not
@Test
public void testUsePModePingSuccessful() throws Exception {
    final Document aDoc = modifyUserMessage(null, null, null, createDefaultProperties(), null, null, null);
    sendPlainMessageAndWait(new HttpXMLEntity(aDoc, ESoapVersion.AS4_DEFAULT.getMimeType()), true, null);
}
Also used : HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 33 with HttpXMLEntity

use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.

the class PullRequestTest method testSendPullRequestSuccessTwoWayPullPush.

@Test
public void testSendPullRequestSuccessTwoWayPullPush() throws Exception {
    // Depending on the payload a different EMEPBinding get chosen by
    // @MockPullRequestProcessorSPI
    // To Test the pull request part of the EMEPBinding
    final Document aPayload = DOMReader.readXMLDOM(new ClassPathResource("testfiles/PullPush.xml"));
    final ICommonsList<Object> aAny = new CommonsArrayList<>();
    aAny.add(aPayload.getDocumentElement());
    final Document aDoc = AS4PullRequestMessage.create(m_eSoapVersion, MessageHelperMethods.createEbms3MessageInfo(), AS4TestConstants.DEFAULT_MPC, aAny).getAsSoapDocument();
    final HttpEntity aEntity = new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType());
    final String sResponse = sendPlainMessageAndWait(aEntity, true, null);
    assertTrue(sResponse.contains(AS4TestConstants.USERMESSAGE_ASSERTCHECK));
}
Also used : HttpEntity(org.apache.http.HttpEntity) HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Document(org.w3c.dom.Document) ClassPathResource(com.helger.commons.io.resource.ClassPathResource) CommonsArrayList(com.helger.commons.collection.impl.CommonsArrayList) Test(org.junit.Test)

Example 34 with HttpXMLEntity

use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.

the class PullRequestTest method testSendPullRequestWithNoMPC.

@Test
public void testSendPullRequestWithNoMPC() throws Exception {
    final Document aDoc = AS4PullRequestMessage.create(m_eSoapVersion, MessageHelperMethods.createEbms3MessageInfo(), null, null).getAsSoapDocument();
    final HttpEntity aEntity = new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType());
    sendPlainMessageAndWait(aEntity, false, EEbmsError.EBMS_VALUE_NOT_RECOGNIZED.getErrorCode());
}
Also used : HttpEntity(org.apache.http.HttpEntity) HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 35 with HttpXMLEntity

use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.

the class PullRequestTest method testSendPullRequestSuccess.

@Test
public void testSendPullRequestSuccess() throws Exception {
    final AS4PullRequestMessage aPullReqMsg = AS4PullRequestMessage.create(m_eSoapVersion, MessageHelperMethods.createEbms3MessageInfo(), AS4TestConstants.DEFAULT_MPC, null);
    Document aDoc = aPullReqMsg.getAsSoapDocument();
    final boolean bMustUnderstand = true;
    aDoc = AS4Signer.createSignedMessage(m_aCryptoFactory, aDoc, m_eSoapVersion, aPullReqMsg.getMessagingID(), null, s_aResMgr, bMustUnderstand, AS4SigningParams.createDefault());
    final HttpEntity aEntity = new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType());
    final String sResponse = sendPlainMessageAndWait(aEntity, true, null);
    assertTrue(sResponse.contains(AS4TestConstants.USERMESSAGE_ASSERTCHECK));
}
Also used : AS4PullRequestMessage(com.helger.phase4.messaging.domain.AS4PullRequestMessage) HttpEntity(org.apache.http.HttpEntity) HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

HttpXMLEntity (com.helger.phase4.http.HttpXMLEntity)65 Document (org.w3c.dom.Document)61 Test (org.junit.Test)60 ClassPathResource (com.helger.commons.io.resource.ClassPathResource)30 Node (org.w3c.dom.Node)18 HttpEntity (org.apache.http.HttpEntity)16 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)10 NodeList (org.w3c.dom.NodeList)10 Ebms3MessageProperties (com.helger.phase4.ebms3header.Ebms3MessageProperties)9 Ebms3Property (com.helger.phase4.ebms3header.Ebms3Property)8 Ebms3CollaborationInfo (com.helger.phase4.ebms3header.Ebms3CollaborationInfo)7 Ebms3PartyInfo (com.helger.phase4.ebms3header.Ebms3PartyInfo)7 Ebms3PayloadInfo (com.helger.phase4.ebms3header.Ebms3PayloadInfo)7 AS4UserMessage (com.helger.phase4.messaging.domain.AS4UserMessage)7 Ebms3MessageInfo (com.helger.phase4.ebms3header.Ebms3MessageInfo)6 DocumentBuilder (javax.xml.parsers.DocumentBuilder)6 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)6 WSS4JAttachment (com.helger.phase4.attachment.WSS4JAttachment)5 Ebms3UserMessage (com.helger.phase4.ebms3header.Ebms3UserMessage)5 IAS4CryptoFactory (com.helger.phase4.crypto.IAS4CryptoFactory)4