use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class TwoWayMEPTest method testPModeWrongMPCLeg2.
@Test
public void testPModeWrongMPCLeg2() throws Exception {
final Ebms3UserMessage aEbms3UserMessage = new Ebms3UserMessage();
final Document aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
aEbms3UserMessage.setPayloadInfo(MessageHelperMethods.createEbms3PayloadInfo(aPayload != null, null));
// Default MessageInfo for testing
aEbms3UserMessage.setMessageInfo(MessageHelperMethods.createEbms3MessageInfo());
// Default CollaborationInfo for testing
aEbms3UserMessage.setCollaborationInfo(MessageHelperMethods.createEbms3CollaborationInfo(null, DEFAULT_AGREEMENT, null, CAS4.DEFAULT_SERVICE_URL, CAS4.DEFAULT_ACTION_URL, AS4TestConstants.TEST_CONVERSATION_ID));
// Default PartyInfo for testing
aEbms3UserMessage.setPartyInfo(MessageHelperMethods.createEbms3PartyInfo(CAS4.DEFAULT_INITIATOR_URL, DEFAULT_PARTY_ID, CAS4.DEFAULT_RESPONDER_URL, DEFAULT_PARTY_ID));
// Default MessageProperties for testing
aEbms3UserMessage.setMessageProperties(createDefaultProperties());
m_aPMode.getLeg2().getBusinessInfo().setMPCID("wrongmpc-id");
final IPMode aPMode = MetaAS4Manager.getPModeMgr().getPModeOfID(m_aPMode.getID());
aEbms3UserMessage.getCollaborationInfo().getAgreementRef().setPmode(aPMode.getID());
final Document aSignedDoc = AS4UserMessage.create(m_eSoapVersion, aEbms3UserMessage).setMustUnderstand(true).getAsSoapDocument(aPayload);
sendPlainMessageAndWait(new HttpXMLEntity(aSignedDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_PROCESSING_MODE_MISMATCH.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class TwoWayMEPTest method testPModeWithOnlyLeg2.
@Test
public void testPModeWithOnlyLeg2() throws Exception {
m_aPMode.setLeg1(null);
MetaAS4Manager.getPModeMgr().createOrUpdatePMode(m_aPMode);
final Document aDoc = modifyUserMessage(m_aPMode.getID(), null, null, createDefaultProperties(), null, null, null);
sendPlainMessageAndWait(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), false, EEbmsError.EBMS_PROCESSING_MODE_MISMATCH.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class TwoWayMEPTest method testReceiveUserMessageAsResponseSuccess.
@Test
public void testReceiveUserMessageAsResponseSuccess() throws Exception {
final Document aDoc = modifyUserMessage(m_aPMode.getID(), null, null, createDefaultProperties(), null, null, null);
final String sResponse = sendPlainMessageAndWait(new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType()), true, null);
assertTrue(sResponse.contains(AS4TestConstants.USERMESSAGE_ASSERTCHECK));
assertFalse(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
assertTrue(sResponse.contains(m_aPMode.getLeg2().getSecurity().getX509SignatureAlgorithm().getAlgorithmURI()));
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageDuplicateTest method testSendDuplicateMessageOnlyGetOneReceipt.
@Test
public void testSendDuplicateMessageOnlyGetOneReceipt() 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 HttpEntity aEntity = new HttpXMLEntity(aDoc, m_eSoapVersion.getMimeType());
// Send once
sendPlainMessageAndWait(aEntity, true, null);
// Send again
sendPlainMessageAndWait(aEntity, false, EEbmsError.EBMS_OTHER.getErrorCode());
}
use of com.helger.phase4.http.HttpXMLEntity in project phase4 by phax.
the class UserMessageDuplicateTest method testDuplicateSignedMessage.
@Test
public void testDuplicateSignedMessage() throws Exception {
final Node aPayload = DOMReader.readXMLDOM(new ClassPathResource(AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML));
final ESoapVersion eSOAPVersion = ESoapVersion.AS4_DEFAULT;
final Document aDoc = MockMessages.createUserMessageSigned(eSOAPVersion, aPayload, null, s_aResMgr);
final HttpEntity aEntity = new HttpXMLEntity(aDoc, eSOAPVersion.getMimeType());
// Send first
final String sResponse = sendPlainMessage(aEntity, true, null);
assertTrue(sResponse.contains(AS4TestConstants.RECEIPT_ASSERTCHECK));
// Send second
sendPlainMessage(aEntity, false, EEbmsError.EBMS_OTHER.getErrorCode());
}
Aggregations