in rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java [1525:1661]
protected void createMessageParts(InterfaceInfo intf, OperationInfo op, Method method) {
final Class<?>[] paramClasses = method.getParameterTypes();
// Setup the input message
op.setProperty(METHOD, method);
MessageInfo inMsg = op.createMessage(this.getInputMessageName(op, method), MessageInfo.Type.INPUT);
op.setInput(inMsg.getName().getLocalPart(), inMsg);
final Annotation[][] parAnnotations = method.getParameterAnnotations();
final Type[] genParTypes = method.getGenericParameterTypes();
for (int j = 0; j < paramClasses.length; j++) {
if (Exchange.class.equals(paramClasses[j])) {
continue;
}
if (isInParam(method, j)) {
QName q = getInParameterName(op, method, j);
QName partName = getInPartName(op, method, j);
if (!isRPC(method) && !isWrapped(method)
&& inMsg.getMessagePartsMap().containsKey(partName)) {
LOG.log(Level.WARNING, "INVALID_BARE_METHOD", getServiceClass() + "." + method.getName());
partName = new QName(partName.getNamespaceURI(), partName.getLocalPart() + j);
q = new QName(q.getNamespaceURI(), q.getLocalPart() + j);
}
MessagePartInfo part = inMsg.addMessagePart(partName);
if (isHolder(paramClasses[j], genParTypes[j]) && !isInOutParam(method, j)) {
LOG.log(Level.WARNING, "INVALID_WEBPARAM_MODE", getServiceClass().getName() + "."
+ method.getName());
}
initializeParameter(part, paramClasses[j], genParTypes[j]);
part.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
part.setProperty(PARAM_ANNOTATION, parAnnotations[j]);
if (!getJaxbAnnoMap(part).isEmpty()) {
op.setProperty(WRAPPERGEN_NEEDED, true);
}
if (!isWrapped(method) && !isRPC(method)) {
part.setProperty(ELEMENT_NAME, q);
}
if (isHeader(method, j)) {
part.setProperty(HEADER, Boolean.TRUE);
if (isRPC(method) || !isWrapped(method)) {
part.setElementQName(q);
} else {
part.setProperty(ELEMENT_NAME, q);
}
}
part.setIndex(j);
}
}
sendEvent(Event.OPERATIONINFO_IN_MESSAGE_SET, op, method, inMsg);
boolean hasOut = hasOutMessage(method);
if (hasOut) {
// Setup the output message
MessageInfo outMsg = op.createMessage(createOutputMessageName(op, method),
MessageInfo.Type.OUTPUT);
op.setOutput(outMsg.getName().getLocalPart(), outMsg);
final Class<?> returnType = method.getReturnType();
if (!returnType.isAssignableFrom(void.class)) {
final QName q = getOutPartName(op, method, -1);
final QName q2 = getOutParameterName(op, method, -1);
MessagePartInfo part = outMsg.addMessagePart(q);
initializeParameter(part, method.getReturnType(), method.getGenericReturnType());
if (!isRPC(method) && !isWrapped(method)) {
part.setProperty(ELEMENT_NAME, q2);
}
final Annotation[] annotations = method.getAnnotations();
part.setProperty(METHOD_ANNOTATIONS, annotations);
part.setProperty(PARAM_ANNOTATION, annotations);
if (isHeader(method, -1)) {
part.setProperty(HEADER, Boolean.TRUE);
if (isRPC(method) || !isWrapped(method)) {
part.setElementQName(q2);
} else {
part.setProperty(ELEMENT_NAME, q2);
}
}
part.setIndex(0);
}
for (int j = 0; j < paramClasses.length; j++) {
if (Exchange.class.equals(paramClasses[j])) {
continue;
}
if (isOutParam(method, j)) {
if (outMsg == null) {
outMsg = op.createMessage(createOutputMessageName(op, method),
MessageInfo.Type.OUTPUT);
}
QName q = getOutPartName(op, method, j);
QName q2 = getOutParameterName(op, method, j);
if (isInParam(method, j)) {
MessagePartInfo mpi = op.getInput().getMessagePartByIndex(j);
q = mpi.getName();
q2 = (QName)mpi.getProperty(ELEMENT_NAME);
if (q2 == null) {
q2 = mpi.getElementQName();
}
}
MessagePartInfo part = outMsg.addMessagePart(q);
part.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
part.setProperty(PARAM_ANNOTATION, parAnnotations[j]);
initializeParameter(part, paramClasses[j], genParTypes[j]);
part.setIndex(j + 1);
if (!isRPC(method) && !isWrapped(method)) {
part.setProperty(ELEMENT_NAME, q2);
}
if (isInParam(method, j)) {
part.setProperty(MODE_INOUT, Boolean.TRUE);
}
if (isHeader(method, j)) {
part.setProperty(HEADER, Boolean.TRUE);
if (isRPC(method) || !isWrapped(method)) {
part.setElementQName(q2);
} else {
part.setProperty(ELEMENT_NAME, q2);
}
}
}
}
sendEvent(Event.OPERATIONINFO_OUT_MESSAGE_SET, op, method, outMsg);
}
//setting the parameterOrder that
//allows preservation of method signatures
//when doing java->wsdl->java
setParameterOrder(method, paramClasses, op);
if (hasOut) {
// Faults are only valid if not a one-way operation
initializeFaults(intf, op, method);
}
}