private void processTOperation(TOperation op, BeehiveWsTypeMetadata wsm,
Map<String, BeehiveWsMethodMetadata> methodMap,
Map<String, TPart[]> messageMap, TBinding tBind, TTypes types) throws Exception {
String opName = op.getName();
TParam outputParam = op.getOutput();
Map<String, BeehiveWsParameterMetadata> outParamMap = null;
BeehiveWsParameterMetadata[] paraMeta = new BeehiveWsParameterMetadata[0]; // defualt value
if( null != outputParam ) {
TPart[] messageParts = messageMap.get(outputParam.getMessage()
.getLocalPart());
paraMeta = processParameters(opName, messageParts, tBind, types,
messageMap, wsm, true); // output parameters are not wrapped
}
Class returnType;
QName returnXMLType;
if (paraMeta == null) {
// Should not happen, may be need to send runtime exception, or
// define a new type of exception!
throw new Exception("Can't resolve the return type");
} else if (paraMeta.length == 1) {
returnType = paraMeta[0].getJavaType();
returnXMLType = paraMeta[0].getXmlType();
} else {
// either there is no return value or there are multiple so make
// this a
// void function and later set OUT parameters if needed.
returnType = Void.TYPE;
returnXMLType = null;
if (paraMeta.length > 1) {
outParamMap = new HashMap<String, BeehiveWsParameterMetadata>(
paraMeta.length);
boolean returnIsSet = false;
for (BeehiveWsParameterMetadata cpm : paraMeta) {
outParamMap.put(cpm.getWpName(), cpm);
}
}
}
BeehiveWsMethodMetadata wmm = new Jsr181MethodMetadataImpl(opName, returnType,
returnXMLType);
wmm.setWmOperationName(opName);
// FIXME jcolwell@bea.com 2004-Nov-10 --
// do something better with the action
wmm.setWmAction(opName);
if (Void.TYPE.equals(returnType)) {
if (paraMeta.length == 0) {
// FIXME jcolwell@bea.com 2004-Nov-22 --
// also check for faults before setting as oneway.
wmm.setOneWay(true);
}
} else {
wmm.setWrName(paraMeta[0].getWpName());
wmm.setWrTargetNamespace(paraMeta[0].getWpTargetNamespace());
}
methodMap.put(opName, wmm);
List paramOrder = op.getParameterOrder(); // this is the one used by
// rpc wsdls.
TParam inputParam = op.getInput();
if (inputParam != null) {
TPart[] messageParts = messageMap.get(inputParam.getMessage()
.getLocalPart());
BeehiveWsParameterMetadata[] params = processParameters(opName, messageParts, tBind, types,
messageMap, wsm, false);