use of com.helger.phase4.soap11.Soap11Header in project phase4 by phax.
the class AbstractAS4Message method getAsSoapDocument.
@Nonnull
public final Document getAsSoapDocument(@Nullable final Node aPayload) {
// Convert to DOM Node
final Document aEbms3Document = Ebms3WriterBuilder.ebms3Messaging().getAsDocument(m_aMessaging);
if (aEbms3Document == null)
throw new IllegalStateException("Failed to write EBMS3 Messaging to XML");
final Node aRealPayload = aPayload instanceof Document ? ((Document) aPayload).getDocumentElement() : aPayload;
switch(m_eSoapVersion) {
case SOAP_11:
{
// Creating SOAP 11 Envelope
final Soap11Envelope aSoapEnv = new Soap11Envelope();
aSoapEnv.setHeader(new Soap11Header());
aSoapEnv.setBody(new Soap11Body());
aSoapEnv.getHeader().addAny(aEbms3Document.getDocumentElement());
if (aRealPayload != null)
aSoapEnv.getBody().addAny(aRealPayload);
return Ebms3WriterBuilder.soap11().getAsDocument(aSoapEnv);
}
case SOAP_12:
{
// Creating SOAP 12 Envelope
final Soap12Envelope aSoapEnv = new Soap12Envelope();
aSoapEnv.setHeader(new Soap12Header());
aSoapEnv.setBody(new Soap12Body());
aSoapEnv.getHeader().addAny(aEbms3Document.getDocumentElement());
if (aRealPayload != null)
aSoapEnv.getBody().addAny(aRealPayload);
return Ebms3WriterBuilder.soap12().getAsDocument(aSoapEnv);
}
default:
throw new IllegalStateException("Unsupported SOAP version " + m_eSoapVersion);
}
}
Aggregations