use of javax.wsdl.extensions.soap12.SOAP12Header in project hop by apache.
the class WsdlUtils method getSOAPHeaders.
/**
* Build a HashSet of SOAP header names for the specified operation and binding.
*
* @param binding WSDL Binding instance.
* @param operationName Name of the operation.
* @return HashSet of soap header names, empty set if no headers present.
*/
protected static HashSet<String> getSOAPHeaders(Binding binding, String operationName) {
List<ExtensibilityElement> headers = new ArrayList<>();
BindingOperation bindingOperation = binding.getBindingOperation(operationName, null, null);
if (bindingOperation == null) {
throw new IllegalArgumentException("Can not find operation: " + operationName);
}
BindingInput bindingInput = bindingOperation.getBindingInput();
if (bindingInput != null) {
headers.addAll(WsdlUtils.findExtensibilityElements((ElementExtensible) bindingInput, SOAP_HEADER_ELEMENT_NAME));
}
BindingOutput bindingOutput = bindingOperation.getBindingOutput();
if (bindingOutput != null) {
headers.addAll(WsdlUtils.findExtensibilityElements((ElementExtensible) bindingOutput, SOAP_HEADER_ELEMENT_NAME));
}
HashSet<String> headerSet = new HashSet<>(headers.size());
for (ExtensibilityElement element : headers) {
if (element instanceof SOAP12Header) {
headerSet.add(((SOAP12Header) element).getPart());
} else {
headerSet.add(((SOAPHeader) element).getPart());
}
}
return headerSet;
}
use of javax.wsdl.extensions.soap12.SOAP12Header 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);
}
}
use of javax.wsdl.extensions.soap12.SOAP12Header in project phase4 by phax.
the class Ebms3MessagingTest method _getMessagingAsSoapDocument.
@Nullable
private Document _getMessagingAsSoapDocument(@Nonnull final Ebms3Messaging aEbms3Messaging) {
final Document aEbms3Document = Ebms3WriterBuilder.ebms3Messaging().getAsDocument(aEbms3Messaging);
if (aEbms3Document == null)
throw new IllegalStateException("Failed to write EBMS3 Messaging to XML");
// Creating SOAP 12 Envelope
final Soap12Envelope aSoapEnv = new Soap12Envelope();
aSoapEnv.setHeader(new Soap12Header());
aSoapEnv.setBody(new Soap12Body());
aSoapEnv.getHeader().addAny(aEbms3Document.getDocumentElement());
return Ebms3WriterBuilder.soap12().getAsDocument(aSoapEnv);
}
use of javax.wsdl.extensions.soap12.SOAP12Header in project axis-axis2-java-core by apache.
the class DescriptionUtils method getNamespaceFromSOAPElement.
/**
* This method will loop through a list of extensibility elements looking for one
* of four objects: SOAPBody, SOAP12Body, SOAPHeader, SOAP12Header. If any of these
* objects are found the namespace URI from this object will be returned.
*/
public static String getNamespaceFromSOAPElement(List extElements) {
Iterator extIter = extElements.iterator();
while (extIter.hasNext()) {
Object extObj = extIter.next();
if (extObj instanceof SOAPBody) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAPBody namespace: " + ((SOAPBody) extObj).getNamespaceURI());
}
return ((SOAPBody) extObj).getNamespaceURI();
} else if (extObj instanceof SOAP12Body) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAP12Body namespace: " + ((SOAP12Body) extObj).getNamespaceURI());
}
return ((SOAP12Body) extObj).getNamespaceURI();
} else if (extObj instanceof SOAPHeader) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAPHeader namespace: " + ((SOAPHeader) extObj).getNamespaceURI());
}
return ((SOAPHeader) extObj).getNamespaceURI();
} else if (extObj instanceof SOAP12Header) {
if (log.isDebugEnabled()) {
log.debug("Returning SOAP12Header namespace: " + ((SOAP12Header) extObj).getNamespaceURI());
}
return ((SOAP12Header) extObj).getNamespaceURI();
} else if (extObj instanceof MIMEMultipartRelated) {
if (log.isDebugEnabled()) {
log.debug("Found a MIMEMultipartRelated element. Unwrapping to get SOAP binding.");
}
MIMEMultipartRelated mime = (MIMEMultipartRelated) extObj;
List mimeParts = mime.getMIMEParts();
Iterator itr = mimeParts.iterator();
while (itr.hasNext()) {
MIMEPart mimePart = (MIMEPart) itr.next();
List elements = mimePart.getExtensibilityElements();
String ns = getNamespaceFromSOAPElement(elements);
return ns;
}
}
}
return null;
}
use of javax.wsdl.extensions.soap12.SOAP12Header in project pentaho-kettle by pentaho.
the class WsdlUtils method getSOAPHeaders.
/**
* Build a HashSet of SOAP header names for the specified operation and binding.
*
* @param binding
* WSDL Binding instance.
* @param operationName
* Name of the operation.
* @return HashSet of soap header names, empty set if no headers present.
*/
protected static HashSet<String> getSOAPHeaders(Binding binding, String operationName) {
List<ExtensibilityElement> headers = new ArrayList<ExtensibilityElement>();
BindingOperation bindingOperation = binding.getBindingOperation(operationName, null, null);
if (bindingOperation == null) {
throw new IllegalArgumentException("Can not find operation: " + operationName);
}
BindingInput bindingInput = bindingOperation.getBindingInput();
if (bindingInput != null) {
headers.addAll(WsdlUtils.findExtensibilityElements(bindingInput, SOAP_HEADER_ELEMENT_NAME));
}
BindingOutput bindingOutput = bindingOperation.getBindingOutput();
if (bindingOutput != null) {
headers.addAll(WsdlUtils.findExtensibilityElements(bindingOutput, SOAP_HEADER_ELEMENT_NAME));
}
HashSet<String> headerSet = new HashSet<String>(headers.size());
for (ExtensibilityElement element : headers) {
if (element instanceof SOAP12Header) {
headerSet.add(((SOAP12Header) element).getPart());
} else {
headerSet.add(((SOAPHeader) element).getPart());
}
}
return headerSet;
}
Aggregations