use of com.helger.phase4.soap12.Soap12Body in project axis-axis2-java-core by apache.
the class DescriptionUtils method processBindingForMIME.
/**
* This method will loop through the extensibility elements for a given BindingInput or
* BindingOutput element and determine if it has any MIMEMultipartRelated content. If it
* does it will build up the appropriate AttachmentDescription objects.
*/
private static void processBindingForMIME(List extensibilityElements, OperationDescriptionImpl opDesc, Operation operation, boolean isRequest) {
Iterator extensibilityIter = extensibilityElements.iterator();
while (extensibilityIter.hasNext()) {
Object obj = extensibilityIter.next();
if (obj instanceof MIMEMultipartRelated) {
if (log.isDebugEnabled()) {
log.debug("Found a mime:multipartRelated extensiblity element.");
}
// Found mime information now process it and determine if we need to
// create an AttachmentDescription
MIMEMultipartRelated mime = (MIMEMultipartRelated) obj;
Iterator partIter = mime.getMIMEParts().iterator();
while (partIter.hasNext()) {
if (log.isDebugEnabled()) {
log.debug("Found a mime:part child element.");
}
MIMEPart mimePart = (MIMEPart) partIter.next();
Iterator mExtIter = mimePart.getExtensibilityElements().iterator();
// Process each mime part to determine if there is mime content
while (mExtIter.hasNext()) {
Object obj2 = mExtIter.next();
// For mime content we need to potentially create an AttachmentDescription
if (obj2 instanceof MIMEContent) {
MIMEContent mimeContent = (MIMEContent) obj2;
String part = mimeContent.getPart();
String type = mimeContent.getType();
// if we have not already processed this part for the operation
if (opDesc.getPartAttachmentDescription(part) == null) {
if (log.isDebugEnabled()) {
log.debug("Adding new AttachmentDescription for part: " + part + " on operation: " + opDesc.getOperationName());
}
AttachmentDescription attachmentDesc = new AttachmentDescriptionImpl(AttachmentType.SWA, new String[] { type });
opDesc.addPartAttachmentDescription(part, attachmentDesc);
} else {
if (log.isDebugEnabled()) {
log.debug("Already created AttachmentDescription for part: " + part + " of type: " + type);
}
}
} else if (obj2 instanceof SOAPBody || obj2 instanceof SOAP12Body) {
if (log.isDebugEnabled()) {
log.debug("Found a body element with potential nested mime content");
}
// Flag whether there's a potential nested attachment.
if (isRequest) {
opDesc.setHasRequestSwaRefAttachments(true);
} else {
opDesc.setHasResponseSwaRefAttachments(true);
}
}
}
}
}
}
}
use of com.helger.phase4.soap12.Soap12Body in project axis-axis2-java-core by apache.
the class WSDL11ToAxisServiceBuilder method getPartsListFromSoapBody.
private List getPartsListFromSoapBody(List extensibilityElements) {
List partsList = null;
ExtensibilityElement extElement;
for (Iterator iter = extensibilityElements.iterator(); iter.hasNext(); ) {
extElement = (ExtensibilityElement) iter.next();
if (log.isDebugEnabled()) {
log.debug("Extensibility Element type is:" + extElement.getElementType());
log.debug("Extensibility Element class is:" + extElement.getClass().getName());
}
// SOAP 1.1 body element found!
if (extElement instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) extElement;
partsList = soapBody.getParts();
} else if (extElement instanceof SOAP12Body) {
SOAP12Body soapBody = (SOAP12Body) extElement;
partsList = soapBody.getParts();
} else if (extElement instanceof MIMEMultipartRelated) {
MIMEMultipartRelated minMimeMultipartRelated = (MIMEMultipartRelated) extElement;
List mimePartsList = minMimeMultipartRelated.getMIMEParts();
MIMEPart mimePart = null;
Object object;
List mimePartElements;
ExtensibilityElement mimePartExtensibilityElement;
for (Iterator mimePartsIter = mimePartsList.iterator(); mimePartsIter.hasNext(); ) {
object = mimePartsIter.next();
if (object instanceof MIMEPart) {
mimePart = (MIMEPart) object;
mimePartElements = mimePart.getExtensibilityElements();
for (Iterator mimePartElementsIter = mimePartElements.iterator(); mimePartElementsIter.hasNext(); ) {
mimePartExtensibilityElement = (ExtensibilityElement) mimePartElementsIter.next();
if (mimePartExtensibilityElement instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) mimePartExtensibilityElement;
partsList = soapBody.getParts();
} else if (mimePartExtensibilityElement instanceof SOAP12Body) {
SOAP12Body soapBody = (SOAP12Body) mimePartExtensibilityElement;
partsList = soapBody.getParts();
}
}
}
}
}
}
if (partsList == null) {
log.debug("SOAP body parts have not been set. All the parts in the message were added to the message.");
}
return partsList;
}
use of com.helger.phase4.soap12.Soap12Body in project axis-axis2-java-core by apache.
the class WSDL11ToAxisServiceBuilder method getNamespaceFromSoapBody.
private String getNamespaceFromSoapBody(List extensibilityElements) {
ExtensibilityElement extElement;
String namespace = null;
for (Iterator iter = extensibilityElements.iterator(); iter.hasNext(); ) {
extElement = (ExtensibilityElement) iter.next();
// SOAP 1.1 body element found!
if (extElement instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) extElement;
namespace = soapBody.getNamespaceURI();
} else if (extElement instanceof SOAP12Body) {
SOAP12Body soapBody = (SOAP12Body) extElement;
namespace = soapBody.getNamespaceURI();
}
}
return namespace;
}
use of com.helger.phase4.soap12.Soap12Body in project esb0 by karalus.
the class WSDL4JUtil method getInputElementQName.
@SuppressWarnings("unchecked")
public static QName getInputElementQName(BindingOperation bindingOperation, boolean soap12) {
ElementExtensible bindingInput = bindingOperation.getBindingInput();
// According to http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html
MIMEMultipartRelated mmr = getExtensibilityElement(bindingInput, MIMEMultipartRelated.class);
if (mmr != null) {
bindingInput = (ElementExtensible) mmr.getMIMEParts().get(0);
}
List<String> parts;
if (soap12) {
SOAP12Body body = getExtensibilityElement(bindingInput, SOAP12Body.class);
if (body == null) {
throw new IllegalArgumentException("BindingOperation has no SOAP 1.2 Body: " + bindingOperation.getName());
}
parts = body.getParts();
} else {
SOAPBody body = getExtensibilityElement(bindingInput, SOAPBody.class);
if (body == null) {
throw new IllegalArgumentException("BindingOperation has no SOAP 1.1 Body: " + bindingOperation.getName());
}
parts = body.getParts();
}
Message message = bindingOperation.getOperation().getInput().getMessage();
Part part = parts == null || parts.isEmpty() ? (Part) message.getParts().values().iterator().next() : message.getPart(parts.get(0));
return part.getElementName();
}
Aggregations