Search in sources :

Example 1 with AS4PullRequestMessage

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);
}
Also used : Ebms3SignalMessage(com.helger.phase4.ebms3header.Ebms3SignalMessage) Ebms3PullRequest(com.helger.phase4.ebms3header.Ebms3PullRequest) Nonnull(javax.annotation.Nonnull)

Example 2 with AS4PullRequestMessage

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()));
}
Also used : AS4PullRequestMessage(com.helger.phase4.messaging.domain.AS4PullRequestMessage) IAS4CryptoFactory(com.helger.phase4.crypto.IAS4CryptoFactory) HttpXMLEntity(com.helger.phase4.http.HttpXMLEntity) Document(org.w3c.dom.Document) Ebms3MessageInfo(com.helger.phase4.ebms3header.Ebms3MessageInfo)

Example 3 with AS4PullRequestMessage

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));
}
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)2 AS4PullRequestMessage (com.helger.phase4.messaging.domain.AS4PullRequestMessage)2 Document (org.w3c.dom.Document)2 IAS4CryptoFactory (com.helger.phase4.crypto.IAS4CryptoFactory)1 Ebms3MessageInfo (com.helger.phase4.ebms3header.Ebms3MessageInfo)1 Ebms3PullRequest (com.helger.phase4.ebms3header.Ebms3PullRequest)1 Ebms3SignalMessage (com.helger.phase4.ebms3header.Ebms3SignalMessage)1 Nonnull (javax.annotation.Nonnull)1 HttpEntity (org.apache.http.HttpEntity)1 Test (org.junit.Test)1