use of javax.wsdl.extensions.ElementExtensible 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.ElementExtensible 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