use of com.helger.phase4.messaging.domain.AS4PullRequestMessage in project phase4 by phax.
the class AS4PullRequestMessage method create.
@Nonnull
public static AS4PullRequestMessage create(@Nonnull final ESoapVersion eSoapVersion, @Nonnull final Ebms3MessageInfo aEbms3MessageInfo, @Nullable final String sMPC, @Nullable final List<Object> aAny) {
final Ebms3SignalMessage aSignalMessage = new Ebms3SignalMessage();
// Message Info
aSignalMessage.setMessageInfo(aEbms3MessageInfo);
// PullRequest
if (StringHelper.hasText(sMPC)) {
final Ebms3PullRequest aEbms3PullRequest = new Ebms3PullRequest();
aEbms3PullRequest.setMpc(sMPC);
aSignalMessage.setPullRequest(aEbms3PullRequest);
}
aSignalMessage.setAny(aAny);
return new AS4PullRequestMessage(eSoapVersion, aSignalMessage);
}
use of com.helger.phase4.messaging.domain.AS4PullRequestMessage in project phase4 by phax.
the class AS4ClientPullRequestMessage method buildMessage.
@Override
public AS4ClientBuiltMessage buildMessage(@Nonnull @Nonempty final String sMessageID, @Nullable final IAS4ClientBuildMessageCallback aCallback) throws WSSecurityException {
_checkMandatoryAttributes();
final Ebms3MessageInfo aEbms3MessageInfo = MessageHelperMethods.createEbms3MessageInfo(sMessageID, getRefToMessageID(), getSendingDateTimeOrNow());
final AS4PullRequestMessage aPullRequest = AS4PullRequestMessage.create(getSoapVersion(), aEbms3MessageInfo, m_sMPC, any().getClone());
if (aCallback != null)
aCallback.onAS4Message(aPullRequest);
final Document aPureDoc = aPullRequest.getAsSoapDocument();
if (aCallback != null)
aCallback.onSoapDocument(aPureDoc);
Document aDoc = aPureDoc;
if (signingParams().isSigningEnabled()) {
final IAS4CryptoFactory aCryptoFactory = internalCreateCryptoFactory();
final boolean bMustUnderstand = true;
final Document aSignedDoc = AS4Signer.createSignedMessage(aCryptoFactory, aDoc, getSoapVersion(), aPullRequest.getMessagingID(), null, getAS4ResourceHelper(), bMustUnderstand, signingParams().getClone());
if (aCallback != null)
aCallback.onSignedSoapDocument(aSignedDoc);
aDoc = aSignedDoc;
}
// Wrap SOAP XML
return new AS4ClientBuiltMessage(sMessageID, new HttpXMLEntity(aDoc, getSoapVersion().getMimeType()));
}
use of com.helger.phase4.messaging.domain.AS4PullRequestMessage 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));
}
Aggregations