use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageFailureForgeryTest method testTwoUserMessagesShouldFail.
@Test
public void testTwoUserMessagesShouldFail() throws Exception {
final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
// never forget this!
domFactory.setNamespaceAware(true);
final DocumentBuilder builder = domFactory.newDocumentBuilder();
final Document aDoc = builder.parse(new ClassPathResource("testfiles/TwoUserMessages.xml").getInputStream());
sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_VALUE_INCONSISTENT.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageSoapBodyPayloadTest method testSendUnsignedMessageSuccess.
@Test
public void testSendUnsignedMessageSuccess() throws Exception {
final Node aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
final Document aDoc = MockMessages.createUserMessageNotSigned(m_eSoapVersion, aPayload, null).getAsSoapDocument(aPayload);
final String sResponse = sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), true, null);
assertTrue(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageSoapBodyPayloadTest method testUserMessageSOAPBodyPayloadEncryptSuccess.
@Test
public void testUserMessageSOAPBodyPayloadEncryptSuccess() throws Exception {
final Node aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
final ICommonsList<WSS4JAttachment> aAttachments = new CommonsArrayList<>();
Document aDoc = MockMessages.createUserMessageNotSigned(m_eSoapVersion, aPayload, aAttachments).getAsSoapDocument(aPayload);
aDoc = AS4Encryptor.encryptSoapBodyPayload(m_aCryptoFactory, m_eSoapVersion, aDoc, false, m_aCryptParams);
final String sResponse = sendPlainMessage(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), true, null);
assertTrue(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class ErrorMessageTest method testSendErrorMessage.
@Test
public void testSendErrorMessage() throws Exception {
final Document aDoc = DOMReader.readXMLDOM(new ClassPathResource("testfiles/ErrorMessage.xml"));
sendPlainMessageAndWait(new HttpXMLEntity(aDoc, ESoapVersion.SOAP_12.getMimeType()), true, null);
}
use of com.helger.phase4.http.HttpXMLEntity 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());
}
Aggregations