0001: /*
0002: * The Apache Software License, Version 1.1
0003: *
0004: *
0005: * Copyright (c) 2002 The Apache Software Foundation. All rights
0006: * reserved.
0007: *
0008: * Redistribution and use in source and binary forms, with or without
0009: * modification, are permitted provided that the following conditions
0010: * are met:
0011: *
0012: * 1. Redistributions of source code must retain the above copyright
0013: * notice, this list of conditions and the following disclaimer.
0014: *
0015: * 2. Redistributions in binary form must reproduce the above copyright
0016: * notice, this list of conditions and the following disclaimer in
0017: * the documentation and/or other materials provided with the
0018: * distribution.
0019: *
0020: * 3. The end-user documentation included with the redistribution,
0021: * if any, must include the following acknowledgment:
0022: * "This product includes software developed by the
0023: * Apache Software Foundation (http://www.apache.org/)."
0024: * Alternately, this acknowledgment may appear in the software itself,
0025: * if and wherever such third-party acknowledgments normally appear.
0026: *
0027: * 4. The names "WSIF" and "Apache Software Foundation" must
0028: * not be used to endorse or promote products derived from this
0029: * software without prior written permission. For written
0030: * permission, please contact apache@apache.org.
0031: *
0032: * 5. Products derived from this software may not be called "Apache",
0033: * nor may "Apache" appear in their name, without prior written
0034: * permission of the Apache Software Foundation.
0035: *
0036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
0037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0039: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
0040: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0047: * SUCH DAMAGE.
0048: * ====================================================================
0049: *
0050: * This software consists of voluntary contributions made by many
0051: * individuals on behalf of the Apache Software Foundation and was
0052: * originally based on software copyright (c) 2001, 2002, International
0053: * Business Machines, Inc., http://www.apache.org. For more
0054: * information on the Apache Software Foundation, please see
0055: * <http://www.apache.org/>.
0056: */
0057:
0058: package org.apache.wsif.providers.ejb;
0059:
0060: import java.lang.reflect.Constructor;
0061: import java.lang.reflect.InvocationTargetException;
0062: import java.lang.reflect.Method;
0063: import java.util.ArrayList;
0064: import java.util.Enumeration;
0065: import java.util.HashMap;
0066: import java.util.Iterator;
0067: import java.util.List;
0068: import java.util.Map;
0069: import java.util.Vector;
0070:
0071: import javax.ejb.EJBHome;
0072: import javax.ejb.EJBObject;
0073: import javax.wsdl.BindingFault;
0074: import javax.wsdl.BindingInput;
0075: import javax.wsdl.BindingOperation;
0076: import javax.wsdl.BindingOutput;
0077: import javax.wsdl.Fault;
0078: import javax.wsdl.Message;
0079: import javax.wsdl.Operation;
0080: import javax.wsdl.OperationType;
0081: import javax.wsdl.Part;
0082: import javax.xml.namespace.QName;
0083:
0084: import org.apache.wsif.WSIFException;
0085: import org.apache.wsif.WSIFMessage;
0086: import org.apache.wsif.WSIFOperation;
0087: import org.apache.wsif.WSIFPort;
0088: import org.apache.wsif.base.WSIFDefaultOperation;
0089: import org.apache.wsif.logging.MessageLogger;
0090: import org.apache.wsif.logging.Trc;
0091: import org.apache.wsif.providers.ProviderUtils;
0092: import org.apache.wsif.wsdl.extensions.ejb.EJBOperation;
0093: import org.apache.wsif.wsdl.extensions.format.TypeMap;
0094: import org.apache.wsif.wsdl.extensions.format.TypeMapping;
0095:
0096: /**
0097: * EJB operation.
0098: * @see WSIFPort_EJB
0099: * @author <a href="mailto:gpfau@de.ibm.com">Gerhard Pfau</a>
0100: * @author Owen Burroughs <owenb@apache.org>
0101: * @author Jeremy Hughes <hughesj@apache.org>
0102: */
0103: public class WSIFOperation_EJB extends WSIFDefaultOperation implements
0104: WSIFOperation {
0105:
0106: private static final long serialVersionUID = 1L;
0107:
0108: protected javax.wsdl.Port fieldPortModel;
0109: protected WSIFPort_EJB fieldPort;
0110: protected javax.wsdl.BindingOperation fieldBindingOperationModel;
0111: protected EJBOperation fieldEJBOperationModel;
0112: protected Method fieldMethod = null;
0113: protected Method[] fieldAllMethods = null;
0114: protected String[] fieldInParameterNames = null;
0115: protected String[] fieldOutParameterNames = null;
0116: // key: position, value: name
0117:
0118: protected String fieldOutputMessageName = null;
0119: protected String fieldInputMessageName = null;
0120: protected Map fieldFaultMessageInfos = null;
0121: // key: class name, value: FaultMessageInfo instance
0122:
0123: protected boolean fieldIsHomeInterface = false;
0124: protected Map fieldTypeMaps = new HashMap();
0125: protected boolean fieldTypeMapBuilt = false;
0126:
0127: private class FaultMessageInfo {
0128: String fieldMessageName;
0129: String fieldPartName;
0130: String fieldFormatType;
0131:
0132: // Note: In Java fault messages contain only one part: the Java exception
0133:
0134: FaultMessageInfo(String messageName, String partName,
0135: String formatType) {
0136: fieldMessageName = messageName;
0137: fieldPartName = partName;
0138: fieldFormatType = formatType;
0139: }
0140: }
0141:
0142: public WSIFOperation_EJB(javax.wsdl.Port portModel,
0143: BindingOperation bindingOperationModel, WSIFPort_EJB port)
0144: throws WSIFException {
0145: Trc.entry(this , portModel, bindingOperationModel, port);
0146:
0147: fieldPortModel = portModel;
0148: fieldBindingOperationModel = bindingOperationModel;
0149: fieldPort = port;
0150:
0151: try {
0152: fieldEJBOperationModel = (EJBOperation) fieldBindingOperationModel
0153: .getExtensibilityElements().get(0);
0154: } catch (Exception e) {
0155: Trc.exception(e);
0156: throw new WSIFException(
0157: "Unable to resolve EJB binding for operation '"
0158: + bindingOperationModel.getName() + "'");
0159: }
0160:
0161: // Check what kind of method we have...
0162: String ejbInterface = fieldEJBOperationModel.getEjbInterface();
0163: if (ejbInterface != null) {
0164: if (ejbInterface.equals("home")) {
0165: fieldIsHomeInterface = true;
0166: } else if (!ejbInterface.equals("remote")) {
0167: throw new WSIFException(
0168: "EJB binding interface not recognized for operation '"
0169: + bindingOperationModel.getName()
0170: + "'. Valid values are 'home' and 'remote'");
0171: }
0172: }
0173:
0174: if (fieldIsHomeInterface) {
0175: fieldAllMethods = fieldPort.getEjbHome().getClass()
0176: .getMethods();
0177: } else {
0178: fieldAllMethods = fieldPort.getEjbObject().getClass()
0179: .getMethods();
0180: }
0181:
0182: if (Trc.ON)
0183: Trc.exit(deep());
0184: }
0185:
0186: /**
0187: * Create a new copy of this object. This is not a clone, since
0188: * it does not copy the referenced objects as well.
0189: */
0190: public WSIFOperation_EJB copy() throws WSIFException {
0191: Trc.entry(this );
0192: WSIFOperation_EJB woe = new WSIFOperation_EJB(fieldPortModel,
0193: fieldBindingOperationModel, fieldPort);
0194: Trc.exit(woe);
0195: return woe;
0196: }
0197:
0198: private static Class getClassForName(String classname)
0199: throws WSIFException {
0200: Trc.entry(null, classname);
0201: Class cls = null;
0202:
0203: if (classname == null) {
0204: throw new WSIFException(
0205: "Error in getClassForName(): No class name specified!");
0206: }
0207:
0208: try {
0209: if (classname.lastIndexOf('.') == -1) {
0210: // Have to check for built in data types
0211: if (classname.equals("char")) {
0212: cls = char.class;
0213: } else if (classname.equals("boolean")) {
0214: cls = boolean.class;
0215: } else if (classname.equals("byte")) {
0216: cls = byte.class;
0217: } else if (classname.equals("short")) {
0218: cls = short.class;
0219: } else if (classname.equals("int")) {
0220: cls = int.class;
0221: } else if (classname.equals("long")) {
0222: cls = long.class;
0223: } else if (classname.equals("float")) {
0224: cls = float.class;
0225: } else if (classname.equals("double")) {
0226: cls = double.class;
0227: } else {
0228: cls = Class.forName(classname, true, Thread
0229: .currentThread().getContextClassLoader());
0230: }
0231: } else {
0232: cls = Class.forName(classname, true, Thread
0233: .currentThread().getContextClassLoader());
0234: }
0235: } catch (ClassNotFoundException ex) {
0236: Trc.exception(ex);
0237: throw new WSIFException("Could not instantiate class '"
0238: + classname + "'", ex);
0239: }
0240:
0241: Trc.exit(cls);
0242: return cls;
0243: }
0244:
0245: protected Map getFaultMessageInfos() throws WSIFException {
0246: Trc.entry(this );
0247: // Get the current operation
0248: Operation operation = null;
0249: try {
0250: operation = getOperation();
0251: } catch (Exception e) {
0252: Trc.exception(e);
0253: throw new WSIFException("Failed to get Operation", e);
0254: }
0255:
0256: if (fieldFaultMessageInfos == null) {
0257: fieldFaultMessageInfos = new HashMap();
0258: }
0259:
0260: BindingFault bindingFaultModel = null;
0261: Map bindingFaultModels = fieldBindingOperationModel.getBindingFaults();
0262: List parts = null;
0263: TypeMap typeMap = null;
0264: Iterator modelsIterator = bindingFaultModels.values().iterator();
0265:
0266: while (modelsIterator.hasNext()) {
0267: bindingFaultModel = (BindingFault) modelsIterator.next();
0268: String name = bindingFaultModel.getName();
0269: if (name == null) {
0270: throw new WSIFException("Fault name not found in binding");
0271: }
0272:
0273: Map map = operation.getFault(name).getMessage().getParts();
0274: if (map.size() >= 1) {
0275: Part part = (Part) map.values().iterator().next();
0276: QName partType = part.getTypeName();
0277: if (partType == null) partType = part.getElementName();
0278: Object formatType = fieldTypeMaps.get(partType);
0279: if (formatType == null) {
0280: throw new WSIFException(
0281: "formatType for typeName '"
0282: + part.getName()
0283: + "' not found in document");
0284: }
0285:
0286: if (formatType instanceof Vector) {
0287: Vector types = (Vector) formatType;
0288: Enumeration enum = types.elements();
0289: while (enum.hasMoreElements()) {
0290: String type = (String) enum.nextElement();
0291: // Add new fault message information to the map
0292: fieldFaultMessageInfos.put(
0293: type,
0294: new FaultMessageInfo(name, part.getName(), type));
0295: }
0296: } else {
0297: String type = (String) formatType;
0298: // Add new fault message information to the map
0299: fieldFaultMessageInfos.put(
0300: type,
0301: new FaultMessageInfo(name, part.getName(), type));
0302: }
0303: }
0304: }
0305:
0306: Trc.exit(fieldFaultMessageInfos);
0307: return fieldFaultMessageInfos;
0308: }
0309:
0310: protected String getInputMessageName() throws WSIFException {
0311: Trc.entry(this );
0312: if (fieldInputMessageName == null) {
0313: BindingInput bindingInputModel = fieldBindingOperationModel
0314: .getBindingInput();
0315: if (bindingInputModel != null) {
0316: fieldInputMessageName = bindingInputModel.getName();
0317: }
0318: }
0319: Trc.exit(fieldInputMessageName);
0320: return fieldInputMessageName;
0321: }
0322:
0323: protected Method[] getMethods() throws WSIFException {
0324: Trc.entry(this );
0325: Method[] candidates;
0326: try {
0327: // Get the possible methods with the argument classes we've found.
0328: Object[] args = getMethodArgumentClasses();
0329: Object retClass = getMethodReturnClass();
0330: Vector possibles = new Vector();
0331: for (int i = 0; i < fieldAllMethods.length; i++) {
0332: if (!fieldAllMethods[i].getName().equals(
0333: fieldEJBOperationModel.getMethodName()))
0334: continue;
0335: Class[] params = fieldAllMethods[i].getParameterTypes();
0336: if (params.length != args.length)
0337: continue;
0338: Class retType = fieldAllMethods[i].getReturnType();
0339: if (retClass != null && retClass instanceof Vector) {
0340: Vector vec = (Vector) retClass;
0341: boolean found = false;
0342: for (int p = 0; p < vec.size(); p++) {
0343: Class cl = (Class) vec.get(p);
0344: if (cl.getName().equals(retType.getName())) {
0345: found = true;
0346: break;
0347: } else if (cl.isAssignableFrom(retType)) {
0348: found = true;
0349: break;
0350: }
0351: }
0352: if (!found)
0353: continue;
0354: } else {
0355: if (retType != null && retClass != null) {
0356: if (!(((Class) retClass).getName()
0357: .equals(retType.getName()))
0358: && !(((Class) retClass)
0359: .isAssignableFrom(retType)))
0360: continue;
0361: }
0362: }
0363:
0364: boolean match = true;
0365: for (int j = 0; j < params.length; j++) {
0366: Object obj = args[j];
0367: if (obj instanceof Vector) {
0368: Vector vec = (Vector) obj;
0369: boolean found = false;
0370: for (int p = 0; p < vec.size(); p++) {
0371: Class cl = (Class) vec.get(p);
0372: if (cl.getName()
0373: .equals(params[j].getName())) {
0374: found = true;
0375: break;
0376: } else if (params[j].isAssignableFrom(cl)) {
0377: found = true;
0378: break;
0379: }
0380: }
0381: if (!found) {
0382: match = false;
0383: break;
0384: }
0385: } else {
0386: if (!(((Class) obj).getName().equals(params[j]
0387: .getName()))
0388: && !(params[j]
0389: .isAssignableFrom((Class) obj))) {
0390: match = false;
0391: break;
0392: }
0393: }
0394: }
0395: if (match) {
0396: possibles.addElement(fieldAllMethods[i]);
0397: }
0398: }
0399: candidates = new Method[possibles.size()];
0400: for (int k = 0; k < candidates.length; k++) {
0401: candidates[k] = (Method) possibles.get(k);
0402: }
0403: Trc.exit(candidates);
0404: return candidates;
0405: } catch (WSIFException ex) {
0406: Trc.exception(ex);
0407: throw ex;
0408: } catch (Exception ex) {
0409: Trc.exception(ex);
0410: throw new WSIFException(
0411: "Error while resolving meta information of method "
0412: + fieldEJBOperationModel.getMethodName()
0413: + " : The meta information is not consistent.",
0414: ex);
0415: }
0416: }
0417:
0418: private void buildTypeMap() throws WSIFException {
0419: Trc.entry(this );
0420: // Only build once!
0421: if (fieldTypeMapBuilt) {
0422: Trc.exit();
0423: return;
0424: }
0425:
0426: TypeMapping typeMapping = null;
0427:
0428: // Get the TypeMappings from the binding
0429: Iterator bindingIterator = fieldPortModel.getBinding()
0430: .getExtensibilityElements().iterator();
0431:
0432: /*
0433: * Choose the first typeMap that has encoding=Java|EJB and style=Java.
0434: * Ignore any other typeMap's that have other encodings and styles.
0435: * We allow both encoding="Java" and encoding="EJB" because originally
0436: * WSIF did not check the encoding and our samples assumed Java, whereas
0437: * the tooling assumed EJB, and now because of backwards compatibility
0438: * we end up supporting both.
0439: */
0440: while (bindingIterator.hasNext()) {
0441: Object next = bindingIterator.next();
0442: if (next instanceof TypeMapping) {
0443: typeMapping = (TypeMapping) next;
0444: if (("Java".equals(typeMapping.getEncoding()) || "EJB"
0445: .equals(typeMapping.getEncoding()))
0446: && "Java".equals(typeMapping.getStyle()))
0447: break;
0448: Trc.event(this , "Silently ignoring typemapping",
0449: typeMapping);
0450: typeMapping = null;
0451: }
0452: Trc
0453: .event(
0454: this ,
0455: "Silently ignoring something that was not a typemapping",
0456: next);
0457: }
0458:
0459: if (typeMapping == null) {
0460: QName bindingName = fieldPortModel.getBinding().getQName();
0461: throw new WSIFException(
0462: "Binding "
0463: + (bindingName == null ? "<null>"
0464: : bindingName.toString())
0465: + " does not contain a typeMap with encoding=Java or encoding=EJB and style=Java");
0466: }
0467:
0468: // Build the hashmap
0469: bindingIterator = typeMapping.getMaps().iterator();
0470: while (bindingIterator.hasNext()) {
0471: TypeMap typeMap = (TypeMap) bindingIterator.next();
0472: ///////////////////////////////////
0473: QName typeName = typeMap.getTypeName();
0474: if (typeName == null)
0475: typeName = typeMap.getElementName();
0476: String type = typeMap.getFormatType();
0477: if (typeName != null && type != null) {
0478: if (fieldTypeMaps.containsKey(typeName)) {
0479: Vector v = null;
0480: Object obj = fieldTypeMaps.get(typeName);
0481: if (obj instanceof Vector) {
0482: v = (Vector) obj;
0483: } else {
0484: v = new Vector();
0485: v.addElement(obj);
0486: }
0487: v.addElement(type);
0488: this .fieldTypeMaps.put(typeName, v);
0489: } else {
0490: this .fieldTypeMaps.put(typeName, type);
0491: }
0492: } else {
0493: throw new WSIFException(
0494: "Error in binding TypeMap. Key or Value is null");
0495: }
0496: }
0497: fieldTypeMapBuilt = true;
0498: Trc.exit();
0499: }
0500:
0501: protected Operation getOperation() throws Exception {
0502: Trc.entry(this );
0503: Operation operation = null;
0504: buildTypeMap();
0505:
0506: // <input> and <output> tags in binding operations are not mandatory
0507: // so deal with null BindingInputs or BindingOutputs
0508: String inputName = null;
0509: try {
0510: inputName = this .fieldBindingOperationModel
0511: .getBindingInput().getName();
0512: } catch (NullPointerException e) {
0513: Trc.ignoredException(e);
0514: inputName = null;
0515: }
0516:
0517: String outputName = null;
0518: try {
0519: outputName = this .fieldBindingOperationModel
0520: .getBindingOutput().getName();
0521: } catch (NullPointerException e) {
0522: Trc.ignoredException(e);
0523: outputName = null;
0524: }
0525:
0526: // Build the parts list
0527: operation = this .fieldPortModel.getBinding().getPortType()
0528: .getOperation(
0529: this .fieldBindingOperationModel.getName(),
0530: inputName, outputName);
0531: //this.fieldBindingOperationModel.getBindingInput().getName(),
0532: Trc.exit(operation);
0533: return operation;
0534: }
0535:
0536: protected Object getMethodReturnClass() throws WSIFException {
0537: Trc.entry(this );
0538: Object methodReturnClass = null;
0539: try {
0540: String returnPartString = fieldEJBOperationModel.getReturnPart();
0541: if (returnPartString != null) {
0542: // A returnPart has been specified so check that this method has the correct
0543: // return type
0544: Part returnPart =
0545: getOperation().getOutput().getMessage().getPart(
0546: returnPartString);
0547:
0548: // If there is no returnPart specified then not interested in return value
0549: if (returnPart != null) {
0550: QName partType = returnPart.getTypeName();
0551: if (partType == null) partType = returnPart.getElementName();
0552:
0553: Object obj = this .fieldTypeMaps.get(partType);
0554: if (obj == null)
0555: throw new WSIFException(
0556: "Could not map type "
0557: + partType
0558: + " to a java type. Part name was "
0559: + returnPart.getName() == null
0560: ? "<null>" : returnPart.getName());
0561:
0562: if (obj instanceof Vector) {
0563: Vector v = (Vector) obj;
0564: Vector argv = new Vector();
0565: Enumeration enum = v.elements();
0566: while (enum.hasMoreElements()) {
0567: String cls = (String) enum.nextElement();
0568: argv.addElement(getClassForName(cls));
0569: }
0570: methodReturnClass = argv;
0571: } else {
0572: methodReturnClass = getClassForName((String) obj);
0573: }
0574: } else {
0575: // If we get here then the return part specified on the java operation was not
0576: // in the output message
0577: throw new WSIFException(
0578: "returnPart '"
0579: + returnPartString
0580: + "' was not in the output message");
0581: }
0582: }
0583: // returnPart attribute was not present so return methodReturnClass as default null
0584: } catch (Exception ex) {
0585: Trc.exception(ex);
0586: throw new WSIFException(
0587: "Error while determining return class of method "
0588: + fieldEJBOperationModel.getMethodName()
0589: + " : The meta information is not consistent.",
0590: ex);
0591: }
0592:
0593: Trc.exit(methodReturnClass);
0594: return methodReturnClass;
0595: }
0596:
0597: protected Object[] getMethodArgumentClasses() throws WSIFException {
0598: Trc.entry(this );
0599: Object[] methodArgClasses = null;
0600: try {
0601:
0602: Operation operation = getOperation();
0603:
0604: /*
0605: The order of the parameters as passed to the Java method is
0606: determined in this way:
0607: 1. from the <wsdl:operation parameterOrder="xxx yyy"> attribute if present
0608: 2. from the <java:operation parameterOrder="xxx yyy"> attribute if present
0609: 3. from the order the parts are specified in the input message
0610: */
0611:
0612: // Get the parameter order according to the above rules
0613: List parameterOrder = null;
0614:
0615: parameterOrder = fieldEJBOperationModel.getParameterOrder();
0616:
0617: if (parameterOrder == null) {
0618: parameterOrder = operation.getParameterOrdering();
0619: }
0620:
0621: /*
0622: The MessageImpl actually the order the parts were added in a List, but
0623: this can only be accessed via the getOrderedParts() methods which
0624: of course returns a List of Parts!
0625: So here I (rather inefficiently) convert the list of parts to a list of
0626: string part names.
0627: */
0628: if (parameterOrder == null) {
0629: List partList =
0630: operation.getInput().getMessage().getOrderedParts(null);
0631: parameterOrder = new Vector();
0632: Iterator partListIterator = partList.iterator();
0633: while (partListIterator.hasNext()) {
0634: Part part = (Part) partListIterator.next();
0635: parameterOrder.add(part.getName());
0636: }
0637: }
0638:
0639: /*
0640: Operations do not specify whether they are to be used with RPC-like bindings
0641: or not. However, when using an operation with an RPC-binding, it is useful to
0642: be able to capture the original RPC function signature. For this reason,
0643: a request-response or solicit-response operation MAY specify a list of parameter
0644: names via the parameterOrder attribute (of type nmtokens). The value of the
0645: attribute is a list of message part names separated by a single space.
0646: The value of the parameterOrder attribute MUST follow the following rules:
0647:
0648: * The part name order reflects the order of the parameters in the RPC signature
0649: * The return value part is not present in the list
0650: * If a part name appears in both the input and output message, it is an in/out parameter
0651: * If a part name appears in only the input message, it is an in parameter
0652: * If a part name appears in only the output message, it is an out parameter
0653:
0654: Note that this information serves as a "hint" and may safely be ignored by
0655: those not concerned with RPC signatures. Also, it is not required to be present,
0656: even if the operation is to be used with an RPC-like binding.
0657: */
0658:
0659: ArrayList argNames = new ArrayList();
0660: ArrayList argTypes = new ArrayList();
0661:
0662: Iterator parameterIterator = parameterOrder.iterator();
0663: while (parameterIterator.hasNext()) {
0664: String param = (String) parameterIterator.next();
0665: Part part =
0666: (Part) operation.getInput().getMessage().getPart(param);
0667: if (part == null) {
0668: part =
0669: (Part) operation.getOutput().getMessage().getPart(
0670: param);
0671: }
0672: if (part == null)
0673: throw new WSIFException(
0674: "Part '"
0675: + param
0676: + "' from parameterOrder not found in input or output message");
0677: argNames.add((String) part.getName());
0678:
0679: // should also check for the element
0680: QName partType = part.getTypeName();
0681: if (partType == null) partType = part.getElementName();
0682: Object obj = this .fieldTypeMaps.get(partType);
0683: if (obj == null)
0684: throw new WSIFException(
0685: "Could not map type "
0686: + partType
0687: + " to a java type. Part name was "
0688: + part.getName() == null ? "<null>" : part.getName());
0689:
0690: if (obj instanceof Vector) {
0691: Vector v = (Vector) obj;
0692: Vector argv = new Vector();
0693: Enumeration enum = v.elements();
0694: while (enum.hasMoreElements()) {
0695: String cls = (String) enum.nextElement();
0696: argv.addElement(getClassForName(cls));
0697: }
0698: argTypes.add(argv);
0699: } else {
0700: argTypes.add(getClassForName((String) obj));
0701: }
0702:
0703: }
0704:
0705: methodArgClasses = new Object[argTypes.size()];
0706: for (int i = 0; i < argTypes.size(); i++) {
0707: methodArgClasses[i] = argTypes.get(i);
0708: }
0709:
0710: fieldInParameterNames = new String[argNames.size()];
0711: for (int i = 0; i < argNames.size(); i++) {
0712: fieldInParameterNames[i] = (String) argNames.get(i);
0713: }
0714:
0715: // Deal with output parts if operation is Request-Response
0716: if (operation.getStyle().equals(OperationType.REQUEST_RESPONSE)) {
0717: argNames = new ArrayList();
0718: // Get the returnPart attribute if it exists
0719: String returnPart = fieldEJBOperationModel.getReturnPart();
0720: Message outputMessage = operation.getOutput().getMessage();
0721: Iterator outputPartsIterator =
0722: outputMessage.getOrderedParts(null).iterator();
0723: while (outputPartsIterator.hasNext()) {
0724: Part part = (Part) outputPartsIterator.next();
0725: String partName = part.getName();
0726: if (partName != null
0727: && returnPart != null
0728: && partName.equals(returnPart)) {
0729: // Put return part first in the list
0730: argNames.add(0, partName);
0731: } else {
0732: argNames.add((String) part.getName());
0733: }
0734: }
0735:
0736: // Populate an array of output message part names
0737: fieldOutParameterNames = new String[argNames.size()];
0738: for (int i = 0; i < argNames.size(); i++) {
0739: fieldOutParameterNames[i] = (String) argNames.get(i);
0740: }
0741: } else {
0742: fieldOutParameterNames = new String[0];
0743: }
0744: } catch (Exception ex) {
0745: Trc.exception(ex);
0746: throw new WSIFException(
0747: "Error while determining signature of method "
0748: + fieldEJBOperationModel.getMethodName()
0749: + " : The meta information is not consistent.",
0750: ex);
0751: }
0752:
0753: Trc.exit(methodArgClasses);
0754: return methodArgClasses;
0755: }
0756:
0757: // Turns an array of arguments into a form compatible with a method
0758: // If they are compatible, the object array is populated
0759: // otherwise returns null
0760: protected Object[] getCompatibleArguments(Class[] parmTypes,
0761: Object[] args) {
0762: Trc.entry(this , parmTypes, args);
0763: // Go through each argument checking it's compatability with the method arg
0764: // creating a compatible set along the way.
0765: // In essence this just converts from String to Character when necessary
0766: // if there are further special case classes such as these which are dependent
0767: // on the object value, PUT THEM HERE :-)
0768: if (args == null || parmTypes == null) {
0769: Object[] compatibleArgs = new Object[0];
0770: Trc.exit(compatibleArgs);
0771: return compatibleArgs;
0772: }
0773:
0774: Object[] compatibleArgs = new Object[args.length];
0775: for (int i = 0; i < parmTypes.length; i++) {
0776: // If the arg is a null then skip it
0777: if (args[i] == null) {
0778: compatibleArgs[i] = ProviderUtils
0779: .getDefaultObject(parmTypes[i]);
0780: continue;
0781: }
0782: // Consider the special cas, squeezing a String into a Character
0783: Object convertedArg = getCompatibleObject(parmTypes[i],
0784: args[i]);
0785: if (convertedArg == null) {
0786: // can't convert one of the arguments so return null
0787: Trc.exit(null);
0788: return null;
0789: } else {
0790: compatibleArgs[i] = convertedArg;
0791: }
0792:
0793: }
0794: Trc.exit(compatibleArgs);
0795: return compatibleArgs;
0796: }
0797:
0798: protected Object getCompatibleReturn(Method method, Object returnObj) {
0799: Trc.entry(this , method, returnObj);
0800: Object o = null;
0801: Class rt = method.getReturnType();
0802: Class ct = null;
0803: int dims = 0;
0804: if (rt.isArray()) {
0805: ct = rt.getComponentType();
0806: dims++;
0807: while (ct.isArray()) {
0808: ct = ct.getComponentType();
0809: dims++;
0810: }
0811: }
0812: if (returnObj instanceof java.lang.Character) {
0813: o = getCompatibleObject(java.lang.String.class, returnObj);
0814: } else if (ct != null
0815: && (ct.equals(java.lang.Character.class) || ct
0816: .equals(char.class))) {
0817: String stringArrayClassName = "[Ljava.lang.String;";
0818: for (int d = 1; d < dims; d++) {
0819: stringArrayClassName = "[" + stringArrayClassName;
0820: }
0821: try {
0822: Class stringArrayClass = Class.forName(
0823: stringArrayClassName, true, Thread
0824: .currentThread()
0825: .getContextClassLoader());
0826: o = getCompatibleObject(stringArrayClass, returnObj);
0827: } catch (ClassNotFoundException cnf) {
0828: Trc.ignoredException(cnf);
0829: o = returnObj;
0830: }
0831: } else {
0832: o = returnObj;
0833: }
0834: Trc.exit(o);
0835: return o;
0836: }
0837:
0838: // Usually cls1.isAssignableFrom(cls2) returning false means you can't cast
0839: // instance of cls1 to cls2. There are some special cases we need to cover ...
0840: // String->Character and Character->String
0841: // If a conversion is known then the obj is converted to class cls
0842: // if that conversion failed, null is returned
0843: // else the converted obj is returned
0844: // If a conversion is not known about then the obj is returned
0845: // Note: if you are adding other cases ensure you add both directions since the
0846: // this conversion may be needed on method args AND returns
0847: protected Object getCompatibleObject(Class cls, Object obj) {
0848: Trc.entry(this , cls, obj);
0849:
0850: if (cls.getName().equals(obj.getClass().getName()))
0851: return obj;
0852:
0853: // String -> Character
0854: if ((cls.equals(java.lang.Character.class) || cls
0855: .equals(char.class))
0856: && obj.getClass().equals(java.lang.String.class)) {
0857: Character charArg = ProviderUtils
0858: .stringToCharacter((String) obj);
0859: if (charArg == null) {
0860: // Can't convert this string to character so return null
0861: Trc.exit(null);
0862: return null;
0863: }
0864: Trc.exit(charArg);
0865: return charArg;
0866: }
0867:
0868: // String arrays -> char/Character arrays and Character arrays -> String arrays
0869: if (cls.isArray() && obj.getClass().isArray()) {
0870: Class cct = cls.getComponentType();
0871: Class objct = obj.getClass().getComponentType();
0872: while (cct.isArray()) {
0873: cct = cct.getComponentType();
0874: }
0875: while (objct.isArray()) {
0876: objct = objct.getComponentType();
0877: }
0878: if (objct.equals(java.lang.String.class)
0879: && cct.equals(char.class)) {
0880: try {
0881: Object charArray = ProviderUtils
0882: .stringArrayToCharArray(obj);
0883: Trc.exit(charArray);
0884: return charArray;
0885: } catch (Exception e) {
0886: Trc.ignoredException(e);
0887: Trc.exit(null);
0888: return null;
0889: }
0890: } else if (objct.equals(java.lang.String.class)
0891: && cct.equals(java.lang.Character.class)) {
0892: try {
0893: Object charArray = ProviderUtils
0894: .stringArrayToCharacterArray(obj);
0895: Trc.exit(charArray);
0896: return charArray;
0897: } catch (Exception e) {
0898: Trc.ignoredException(e);
0899: Trc.exit(null);
0900: return null;
0901: }
0902: } else if (objct.equals(java.lang.Character.class)
0903: && cct.equals(java.lang.String.class)) {
0904: try {
0905: Object charArray = ProviderUtils
0906: .characterArrayToStringArray(obj);
0907: Trc.exit(charArray);
0908: return charArray;
0909: } catch (Exception e) {
0910: Trc.ignoredException(e);
0911: Trc.exit(null);
0912: return null;
0913: }
0914: } else if (objct.equals(char.class)
0915: && cct.equals(java.lang.String.class)) {
0916: try {
0917: Object charArray = ProviderUtils
0918: .charArrayToStringArray(obj);
0919: Trc.exit(charArray);
0920: return charArray;
0921: } catch (Exception e) {
0922: Trc.ignoredException(e);
0923: Trc.exit(null);
0924: return null;
0925: }
0926: }
0927: }
0928:
0929: if (cls.equals(java.lang.String.class)
0930: && obj.getClass().equals(java.lang.Character.class)) {
0931: Trc.exit(obj.toString());
0932: return (obj.toString());
0933: }
0934:
0935: Trc.exit(obj);
0936: return obj;
0937: }
0938:
0939: protected String getOutputMessageName() throws WSIFException {
0940: Trc.entry(this );
0941: if (fieldOutputMessageName == null) {
0942: BindingOutput bindingOutputModel = fieldBindingOperationModel
0943: .getBindingOutput();
0944: if (bindingOutputModel != null) {
0945: fieldOutputMessageName = bindingOutputModel.getName();
0946: }
0947: }
0948: Trc.exit(fieldOutputMessageName);
0949: return fieldOutputMessageName;
0950: }
0951:
0952: public WSIFPort getWSIFPort() {
0953: Trc.entry(this );
0954: Trc.exit(fieldPort);
0955: return fieldPort;
0956: }
0957:
0958: public boolean executeRequestResponseOperation(WSIFMessage input,
0959: WSIFMessage output, WSIFMessage fault) throws WSIFException {
0960:
0961: Trc.entry(this , input, output, fault);
0962: close();
0963:
0964: boolean operationSucceeded = true;
0965: boolean foundInputParameter = false;
0966: boolean usedOutputParam = false;
0967:
0968: try {
0969: Object result = null;
0970: Method[] methods = null;
0971: Constructor constructor = null;
0972:
0973: methods = getMethods();
0974: if (methods.length <= 0)
0975: throw new WSIFException("No method named '"
0976: + fieldEJBOperationModel.getMethodName()
0977: + "' found that match the parts specified");
0978:
0979: Object[] arguments = null;
0980: Object part = null;
0981: if ((fieldInParameterNames != null)
0982: && (fieldInParameterNames.length > 0)) {
0983: arguments = new Object[fieldInParameterNames.length];
0984: for (int i = 0; i < fieldInParameterNames.length; i++) {
0985: try {
0986: part = input
0987: .getObjectPart(fieldInParameterNames[i]);
0988: arguments[i] = part;
0989: foundInputParameter = true;
0990: } catch (WSIFException e) {
0991: Trc.exception(e);
0992: if (fieldOutParameterNames.length > 0) {
0993: String outParameterName = null;
0994: for (int j = 0; j < fieldOutParameterNames.length; j++) {
0995: outParameterName = fieldOutParameterNames[j];
0996: if ((outParameterName != null)
0997: && (outParameterName
0998: .equals(fieldInParameterNames[i]))) {
0999: arguments[i] = (methods[0]
1000: .getParameterTypes()[i])
1001: .newInstance();
1002: foundInputParameter = true;
1003: usedOutputParam = true;
1004: }
1005: }
1006: }
1007: }
1008: if (!foundInputParameter) {
1009: throw new WSIFException(this
1010: + " : Could not set input parameter '"
1011: + fieldInParameterNames[i] + "'");
1012: }
1013: }
1014: }
1015:
1016: boolean invokedOK = false;
1017: for (int a = 0; a < methods.length; a++) {
1018: if (fieldIsHomeInterface
1019: && methods[a].getName().equals("create")) // only handle create methods -> entity EJB finders not supported
1020: {
1021: try {
1022: // Get a set of arguments which are compatible with the ctor
1023: Object[] compatibleArguments = getCompatibleArguments(
1024: methods[a].getParameterTypes(),
1025: arguments);
1026: // If we didn't get any arguments then the parts aren't compatible with the ctor
1027: if (compatibleArguments == null)
1028: break;
1029: // Parts are compatible so invoke the ctor with the compatible set
1030:
1031: EJBHome home = fieldPort.getEjbHome();
1032: Trc
1033: .event(this , "Invoking EJB method ",
1034: methods[a], " home ", home,
1035: " with arguments ",
1036: compatibleArguments);
1037:
1038: result = methods[a].invoke(home,
1039: compatibleArguments);
1040:
1041: Trc.event(this , "Returned from EJB result is ",
1042: result);
1043:
1044: fieldPort.setEjbObject((EJBObject) result);
1045: fieldMethod = methods[a];
1046: invokedOK = true;
1047: break;
1048: } catch (IllegalArgumentException ia) {
1049: Trc.ignoredException(ia);
1050: // Ignore and try next method
1051: }
1052: // Side effect: Initialize port's object reference
1053: } else {
1054: if (usedOutputParam) {
1055: for (int i = 0; i < fieldInParameterNames.length; i++) {
1056: String outParameterName = null;
1057: for (int j = 0; j < fieldOutParameterNames.length; j++) {
1058: outParameterName = fieldOutParameterNames[j];
1059: if ((outParameterName != null)
1060: && (outParameterName
1061: .equals(fieldInParameterNames[i]))) {
1062: arguments[i] = (methods[a]
1063: .getParameterTypes()[i])
1064: .newInstance();
1065: }
1066: }
1067: }
1068: }
1069:
1070: try {
1071: // Get a set of arguments which are compatible with the ctor
1072: Object[] compatibleArguments = getCompatibleArguments(
1073: methods[a].getParameterTypes(),
1074: arguments);
1075: // If we didn't get any arguments then the parts aren't compatible with the ctor
1076: if (compatibleArguments == null)
1077: break;
1078: // Parts are compatible so invoke the ctor with the compatible set
1079:
1080: EJBObject obj = fieldPort.getEjbObject();
1081: Trc
1082: .event(this , "Invoking EJB method ",
1083: methods[a], " object ", obj,
1084: " with arguments ",
1085: compatibleArguments);
1086:
1087: result = methods[a].invoke(obj,
1088: compatibleArguments);
1089:
1090: Trc.event(this , "Returned from EJB result is ",
1091: result);
1092:
1093: invokedOK = true;
1094: fieldMethod = methods[a];
1095:
1096: String outParameterName = null;
1097: if (fieldOutParameterNames.length > 0) {
1098: output.setName(getOutputMessageName());
1099: outParameterName = (String) fieldOutParameterNames[0];
1100: if (outParameterName != null) {
1101: output.setObjectPart(outParameterName,
1102: getCompatibleReturn(
1103: fieldMethod, result));
1104: // Should we use the class of the method signature instead here ?
1105: }
1106:
1107: if (arguments != null) {
1108: for (int i = 1; i < fieldOutParameterNames.length; i++) {
1109: outParameterName = fieldOutParameterNames[i];
1110: if (outParameterName != null) {
1111: try {
1112: for (int r = 0; r < fieldInParameterNames.length; r++) {
1113: if (outParameterName
1114: .equals(fieldInParameterNames[r])) {
1115: output
1116: .setObjectPart(
1117: outParameterName,
1118: arguments[r]);
1119: break;
1120: }
1121: }
1122: } catch (WSIFException e) {
1123: Trc.ignoredException(e);
1124: //ignore
1125: }
1126: }
1127: }
1128: }
1129: }
1130: break;
1131: } catch (IllegalArgumentException ia) {
1132: Trc.ignoredException(ia);
1133: // Ingore and try next method
1134: }
1135: }
1136: }
1137: if (!invokedOK)
1138: throw new WSIFException("Failed to invoke method '"
1139: + fieldEJBOperationModel.getMethodName() + "'");
1140: } catch (InvocationTargetException ex) {
1141: Trc.exception(ex);
1142: Throwable invocationFault = ex.getTargetException();
1143: String className = invocationFault.getClass().getName();
1144: Map faultMessageInfos = getFaultMessageInfos();
1145: FaultMessageInfo faultMessageInfo = (FaultMessageInfo) faultMessageInfos
1146: .get(className);
1147:
1148: if ((faultMessageInfo != null)
1149: && (faultMessageInfo.fieldPartName != null)) {
1150: // Found fault
1151: Object faultPart = invocationFault;
1152: // Should we use the class of the method signature here ?
1153: fault.setObjectPart(faultMessageInfo.fieldPartName,
1154: faultPart);
1155: fault.setName(faultMessageInfo.fieldMessageName);
1156: if (faultMessageInfo.fieldMessageName != null) {
1157: Fault wsdlFault = fieldBindingOperationModel
1158: .getOperation().getFault(
1159: faultMessageInfo.fieldMessageName);
1160: if (wsdlFault != null) {
1161: fault.setMessageDefinition(wsdlFault
1162: .getMessage());
1163: }
1164: }
1165: operationSucceeded = false;
1166: } else {
1167: // Try to find a matching class:
1168: Class invocationFaultClass = invocationFault.getClass();
1169: Class tempClass = null;
1170: Iterator it = faultMessageInfos.values().iterator();
1171: boolean found = false;
1172: while (it.hasNext()) {
1173: faultMessageInfo = (FaultMessageInfo) it.next();
1174: try {
1175: tempClass = Class.forName(
1176: faultMessageInfo.fieldFormatType, true,
1177: Thread.currentThread()
1178: .getContextClassLoader());
1179: if (tempClass
1180: .isAssignableFrom(invocationFaultClass)) {
1181: found = true;
1182: Object faultPart = invocationFault;
1183: // Should we use the class of the method signature here ?
1184: fault.setObjectPart(
1185: faultMessageInfo.fieldPartName,
1186: faultPart);
1187: fault
1188: .setName(faultMessageInfo.fieldMessageName);
1189: if (faultMessageInfo.fieldMessageName != null) {
1190: Fault wsdlFault = fieldBindingOperationModel
1191: .getOperation()
1192: .getFault(
1193: faultMessageInfo.fieldMessageName);
1194: if (wsdlFault != null) {
1195: fault
1196: .setMessageDefinition(wsdlFault
1197: .getMessage());
1198: }
1199: }
1200: operationSucceeded = false;
1201: }
1202: } catch (Exception exc) {
1203: Trc.ignoredException(exc);
1204: // Nothing to do - just try the next one...
1205: }
1206: }
1207: if (!found) {
1208: // Log message
1209: MessageLogger.log("WSIF.0005E", "EJB",
1210: fieldEJBOperationModel.getMethodName());
1211:
1212: // End message
1213: throw new WSIFException("Operation failed!",
1214: invocationFault);
1215: }
1216: }
1217:
1218: } catch (Exception ex) {
1219: Trc.exception(ex);
1220:
1221: // Log message
1222: MessageLogger.log("WSIF.0005E", "EJB",
1223: fieldEJBOperationModel.getMethodName());
1224:
1225: throw new WSIFException(this + " : Could not invoke '"
1226: + fieldEJBOperationModel.getMethodName() + "'", ex);
1227: }
1228:
1229: Trc.exit(operationSucceeded);
1230: return operationSucceeded;
1231: }
1232:
1233: public void executeInputOnlyOperation(WSIFMessage input)
1234: throws WSIFException {
1235:
1236: Trc.entry(this , input);
1237: close();
1238:
1239: boolean foundInputParameter = false;
1240:
1241: try {
1242: Object result = null;
1243: Method[] methods = null;
1244: Constructor constructor = null;
1245:
1246: methods = getMethods();
1247: if (methods.length <= 0)
1248: throw new WSIFException("No method named '"
1249: + fieldEJBOperationModel.getMethodName()
1250: + "' found that match the parts specified");
1251:
1252: Object[] arguments = null;
1253: Object part = null;
1254: if ((fieldInParameterNames != null)
1255: && (fieldInParameterNames.length > 0)) {
1256: arguments = new Object[fieldInParameterNames.length];
1257: for (int i = 0; i < fieldInParameterNames.length; i++) {
1258: try {
1259: part = input
1260: .getObjectPart(fieldInParameterNames[i]);
1261: arguments[i] = part;
1262: foundInputParameter = true;
1263: } catch (WSIFException e) {
1264: Trc.ignoredException(e);
1265: }
1266:
1267: if (!foundInputParameter) {
1268: throw new WSIFException(this
1269: + " : Could not set input parameter '"
1270: + fieldInParameterNames[i] + "'");
1271: }
1272: }
1273: }
1274:
1275: boolean invokedOK = false;
1276: for (int a = 0; a < methods.length; a++) {
1277: if (fieldIsHomeInterface
1278: && methods[a].getName().equals("create")) // only handle create methods -> entity EJB finders not supported
1279: {
1280: try {
1281: // Get a set of arguments which are compatible with the ctor
1282: Object[] compatibleArguments = getCompatibleArguments(
1283: methods[a].getParameterTypes(),
1284: arguments);
1285: // If we didn't get any arguments then the parts aren't compatible with the ctor
1286: if (compatibleArguments == null)
1287: break;
1288: // Parts are compatible so invoke the ctor with the compatible set
1289:
1290: EJBHome home = fieldPort.getEjbHome();
1291: Trc
1292: .event(this , "Invoking EJB method ",
1293: methods[a], " home ", home,
1294: " with arguments ",
1295: compatibleArguments);
1296:
1297: result = methods[a].invoke(home,
1298: compatibleArguments);
1299:
1300: Trc.event(this , "Returned from EJB result is ",
1301: result);
1302:
1303: fieldPort.setEjbObject((EJBObject) result);
1304: fieldMethod = methods[a];
1305: invokedOK = true;
1306: break;
1307: } catch (IllegalArgumentException ia) {
1308: Trc.ignoredException(ia);
1309: // Ignore and try next method
1310: }
1311: // Side effect: Initialize port's object reference
1312: } else {
1313: try {
1314: // Get a set of arguments which are compatible with the ctor
1315: Object[] compatibleArguments = getCompatibleArguments(
1316: methods[a].getParameterTypes(),
1317: arguments);
1318: // If we didn't get any arguments then the parts aren't compatible with the ctor
1319: if (compatibleArguments == null)
1320: break;
1321: // Parts are compatible so invoke the ctor with the compatible set
1322:
1323: EJBObject obj = fieldPort.getEjbObject();
1324: Trc
1325: .event(this , "Invoking EJB method ",
1326: methods[a], " object ", obj,
1327: " with arguments ",
1328: compatibleArguments);
1329:
1330: result = methods[a].invoke(obj,
1331: compatibleArguments);
1332:
1333: Trc.event(this , "Returned from EJB result is ",
1334: result);
1335:
1336: fieldMethod = methods[a];
1337: invokedOK = true;
1338: break;
1339: } catch (IllegalArgumentException ia) {
1340: Trc.ignoredException(ia);
1341: // Ignore and try next method
1342: }
1343: }
1344: }
1345: if (!invokedOK)
1346: throw new WSIFException("Failed to invoke method '"
1347: + fieldEJBOperationModel.getMethodName() + "'");
1348: } catch (InvocationTargetException ex) {
1349: Trc.exception(ex);
1350:
1351: // Log message
1352: MessageLogger.log("WSIF.0005E", "EJB",
1353: fieldEJBOperationModel.getMethodName());
1354:
1355: throw new WSIFException(this + " : Invocation of '"
1356: + fieldEJBOperationModel.getMethodName()
1357: + "' failed.", ex);
1358: } catch (Exception ex) {
1359: Trc.exception(ex);
1360:
1361: // Log message
1362: MessageLogger.log("WSIF.0005E", "EJB",
1363: fieldEJBOperationModel.getMethodName());
1364:
1365: throw new WSIFException(this + " : Could not invoke '"
1366: + fieldEJBOperationModel.getMethodName() + "'", ex);
1367: }
1368:
1369: Trc.exit();
1370: }
1371:
1372: public String deep() {
1373: String buff = "";
1374: try {
1375: buff = new String(super .toString() + ":\n");
1376: buff += "portModel:" + Trc.brief(fieldPortModel);
1377: buff += " wsifPort_EJB:" + fieldPort;
1378:
1379: buff += " bindingOperationModel:"
1380: + Trc.brief(fieldBindingOperationModel);
1381: buff += " EJBOperation:"
1382: + (fieldEJBOperationModel == null ? "null"
1383: : fieldEJBOperationModel.toString());
1384: buff += " method:"
1385: + (fieldMethod == null ? "null" : fieldMethod
1386: .toString());
1387: buff += Trc
1388: .brief("inParameterNames", fieldInParameterNames);
1389: buff += Trc.brief("outParameterNames",
1390: fieldOutParameterNames);
1391:
1392: buff += " outputMessageName:" + fieldOutputMessageName;
1393: buff += " inputMessageName:" + fieldInputMessageName;
1394:
1395: if (fieldFaultMessageInfos == null) {
1396: buff += " faultMessageInfos:null";
1397: } else {
1398: Iterator it = fieldFaultMessageInfos.keySet()
1399: .iterator();
1400: int i = 0;
1401: while (it.hasNext()) {
1402: String key = (String) it.next();
1403: buff += " faultMessageInfos[" + i + "]:" + key
1404: + " " + fieldFaultMessageInfos.get(key);
1405: i++;
1406: }
1407: }
1408:
1409: buff += " isHomeInterface:" + fieldIsHomeInterface;
1410:
1411: if (fieldTypeMaps == null) {
1412: buff += " typeMaps:null";
1413: } else {
1414: Iterator it = fieldTypeMaps.keySet().iterator();
1415: int i = 0;
1416: while (it.hasNext()) {
1417: QName key = (QName) it.next();
1418: buff += " typeMaps[" + i + "]:" + key + " "
1419: + fieldTypeMaps.get(key);
1420: i++;
1421: }
1422: }
1423:
1424: buff += " typeMapBuilt:" + fieldTypeMapBuilt;
1425: } catch (Exception e) {
1426: Trc.exceptionInTrace(e);
1427: }
1428: return buff;
1429: }
1430: }
|