use of javax.wsdl.extensions.soap.SOAPHeader in project cxf by apache.
the class ServiceProcessor method processMultipart.
public void processMultipart(JavaMethod jm, BindingOperationInfo operation, MIMEMultipartRelated ext, JavaType.Style style) throws ToolException {
List<MIMEPart> mimeParts = CastUtils.cast(ext.getMIMEParts());
for (MIMEPart mPart : mimeParts) {
List<ExtensibilityElement> extns = CastUtils.cast(mPart.getExtensibilityElements());
for (ExtensibilityElement extElement : extns) {
if (extElement instanceof MIMEContent) {
MIMEContent mimeContent = (MIMEContent) extElement;
String mimeJavaType = getJavaTypeForMimeType(mPart);
if (JavaType.Style.IN.equals(style)) {
String paramName = ProcessorUtil.mangleNameToVariableName(mimeContent.getPart());
JavaParameter jp = jm.getParameter(paramName);
if (jp == null) {
Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent.getPart());
throw new ToolException(message);
}
if (!jp.getClassName().equals(mimeJavaType)) {
// jp.setType(mimeJavaType);
jp.setClassName(mimeJavaType);
}
} else if (JavaType.Style.OUT.equals(style)) {
JavaType jp = null;
if (!"void".equals(jm.getReturn().getType()) && mimeContent.getPart().equals(jm.getReturn().getName())) {
jp = jm.getReturn();
jp.setClassName(mimeJavaType);
}
if (jp == null) {
for (JavaParameter para : jm.getParameters()) {
if (mimeContent.getPart().equals(para.getPartName())) {
jp = para;
}
}
if (jp != null) {
((JavaParameter) jp).setClassName(mimeJavaType);
}
}
if (jp == null) {
Message message = new Message("MIMEPART_CANNOT_MAP", LOG, mimeContent.getPart());
throw new ToolException(message);
}
}
} else if (extElement instanceof SOAPHeader) {
processSoapHeader(jm, operation, extElement);
}
}
}
}
use of javax.wsdl.extensions.soap.SOAPHeader in project cxf by apache.
the class UniqueBodyPartsValidator method isValid.
public boolean isValid() {
Collection<Binding> bindings = CastUtils.cast(def.getAllBindings().values());
for (Binding binding : bindings) {
uniqueBodyPartsMap = new HashMap<>();
List<BindingOperation> ops = CastUtils.cast(binding.getBindingOperations());
for (BindingOperation op : ops) {
Operation operation = op.getOperation();
if (operation != null && operation.getInput() != null) {
Message inMessage = operation.getInput().getMessage();
BindingInput bin = op.getBindingInput();
Set<String> headers = new HashSet<>();
if (bin != null) {
List<ExtensibilityElement> lst = CastUtils.cast(bin.getExtensibilityElements());
for (ExtensibilityElement ext : lst) {
if (!(ext instanceof SOAPHeader)) {
continue;
}
SOAPHeader header = (SOAPHeader) ext;
if (!header.getMessage().equals(inMessage.getQName())) {
continue;
}
headers.add(header.getPart());
}
}
if (inMessage != null && !isUniqueBodyPart(operation.getName(), inMessage, headers, binding.getQName())) {
return false;
}
}
}
}
return true;
}
Aggregations