AxisOperation axisOperation = service.getOperation(new QName(methodName));
if (axisOperation == null) {
axisOperation = Utils.getAxisOperationForJmethod(jMethod);
if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(
axisOperation.getMessageExchangePattern())){
AxisMessage outMessage = axisOperation.getMessage(
WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (outMessage !=null ){
outMessage.setName(methodName + RESULT);
}
}
addToService = true;
}
// Maintain a list of methods we actually work with
list.add(jMethod);
processException(jMethod,axisOperation);
uniqueMethods.put(getSimpleName(jMethod), jMethod);
//create the schema type for the method wrapper
uniqueMethods.put(getSimpleName(jMethod), jMethod);
JParameter[] paras = jMethod.getParameters();
String parameterNames[] = methodTable.getParameterNames(methodName);
AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (inMessage != null) {
inMessage.setName(methodName + "RequestMessage");
}
if (paras.length > 1) {
sequence = new XmlSchemaSequence();
methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod));
methodSchemaType.setParticle(sequence);
inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
axisOperation);
inMessage.setPartName(methodName);
for (int j = 0; j < paras.length; j++) {
JParameter methodParameter = paras[j];
if (generateRequestSchema(methodParameter, parameterNames, j, jMethod, sequence)) {
break;
}
}
} else if (paras.length == 1) {
if (paras[0].getType().isArrayType()) {
sequence = new XmlSchemaSequence();
methodSchemaType = createSchemaTypeForMethodPart(methodName);
methodSchemaType.setParticle(sequence);
JParameter methodParameter = paras[0];
inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
axisOperation);
inMessage.setPartName(methodName);
if (generateRequestSchema(methodParameter, parameterNames, 0, jMethod, sequence)) {
break;
}
} else {
String parameterName = null;
JParameter methodParameter = paras[0];
JAnnotation paramterAnnon =
methodParameter.getAnnotation(AnnotationConstants.WEB_PARAM);
if (paramterAnnon != null) {
parameterName =
paramterAnnon.getValue(AnnotationConstants.NAME).asString();
}
if (parameterName == null || "".equals(parameterName)) {
parameterName = (parameterNames != null && parameterNames[0] != null) ?
parameterNames[0] : getSimpleName(methodParameter);
}
JMethod processMethod = (JMethod) processedParameters.get(parameterName);
if (processMethod != null) {
throw new AxisFault("Inavalid Java class," +
" there are two methods [" + processMethod.getSimpleName() + " and " +
jMethod.getSimpleName() + " ]which have the same parameter names");
} else {
processedParameters.put(parameterName, jMethod);
generateSchemaForType(null, paras[0].getType(), parameterName);
inMessage.setElementQName(typeTable.getQNamefortheType(parameterName));
inMessage.setPartName(parameterName);
inMessage.setWrapped(false);
service.addMessageElementQNameToOperationMapping(typeTable.getQNamefortheType(parameterName),
axisOperation);
}
}
}
// for its return type
JClass returnType = jMethod.getReturnType();
if (!returnType.isVoidType()) {
AxisMessage outMessage = axisOperation.getMessage(
WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (returnType.isArrayType()) {
methodSchemaType =
createSchemaTypeForMethodPart(getSimpleName(jMethod) + RESULT);
sequence = new XmlSchemaSequence();
methodSchemaType.setParticle(sequence);
JAnnotation returnAnnon =
jMethod.getAnnotation(AnnotationConstants.WEB_RESULT);
String returnName = "return";
if (returnAnnon != null) {
returnName = returnAnnon.getValue(AnnotationConstants.NAME).asString();
if (returnName != null && !"".equals(returnName)) {
returnName = "return";
}
}
if (nonRpcMethods.contains(methodName)) {
generateSchemaForType(sequence, null, returnName);
} else {
generateSchemaForType(sequence, returnType, returnName);
}
} else {
generateSchemaForType(null, returnType, methodName + RESULT);
outMessage.setWrapped(false);
}
outMessage.setElementQName(typeTable.getQNamefortheType(methodName + RESULT));
outMessage.setName(methodName + "ResponseMessage");
outMessage.setPartName(methodName + RESULT);
service.addMessageElementQNameToOperationMapping(
typeTable.getQNamefortheType(methodName + RESULT),
axisOperation);
}
if (addToService) {