Examples of WSIFException


Examples of org.apache.wsif.WSIFException

        try {
            Object result = null;
            // Need to get the stuff here because this also initializes fieldInParameterNames
            if (fieldIsConstructor) {
                if (fieldConstructors.length <= 0)
                    throw new WSIFException(
                        "No constructor found that match the parts specified");
            } else {
                if (fieldMethods.length <= 0)
                    throw new WSIFException("No method named '"
                        + fieldJavaOperationModel.getMethodName()
                        + "' found that match the parts specified");
            }

            Object[] arguments = null;
            Object part = null;
            if ((fieldInParameterNames != null) && (fieldInParameterNames.length > 0)) {
                arguments = new Object[fieldInParameterNames.length];
                for (int i = 0; i < fieldInParameterNames.length; i++) {
                    try {
                        part = input.getObjectPart(fieldInParameterNames[i]);
                        arguments[i] = part;
                    } catch (WSIFException e) {
                       Trc.exception(e);
                        arguments[i] = null;
                        if (fieldOutParameterNames.length > 0) {
                            String outParameterName = null;
                            for (int j = 0; j < fieldOutParameterNames.length; j++) {
                                outParameterName =
                                    fieldOutParameterNames[j];
                                if ((outParameterName != null)
                                    && (outParameterName
                                        .equals(fieldInParameterNames[i]))) {
                                    arguments[i] =
                                        (fieldMethods[0].getParameterTypes()[i])
                                            .newInstance();
                                    usedOutputParam = true;
                                }
                            }
                        }
                    }
                }
            }

            boolean invokedOK = false;
            if (fieldIsConstructor) {
                for (int a = 0; a < fieldConstructors.length; a++) {
                    try {
                        // Get a set of arguments which are compatible with the ctor
                        Object[] compatibleArguments =
                            getCompatibleArguments(fieldConstructors[a].getParameterTypes(), arguments);
                        // If we didn't get any arguments then the parts aren't compatible with the ctor
                        if (compatibleArguments == null)
                            break;
                        // Parts are compatible so invoke the ctor with the compatible set

                        Trc.event(
                            this,
                            "Invoking constructor ",
                            fieldConstructors[a],
                            " with arguments ",
                            compatibleArguments);

                        result =
                            fieldConstructors[a].newInstance(
                                compatibleArguments);

                        Trc.event(
                            this,
                            "Returned from constructor, result is ",
                            result);
                       
                        fieldPort.setObjectReference(result);
                        invokedOK = true;
                        break;
                    } catch (IllegalArgumentException ia) {
                      Trc.ignoredException(ia);
                        // Ignore and try next constructor
                    }
                }
                if (!invokedOK)
                    throw new WSIFException("Failed to call constructor for object in Java operation");
                // Side effect: Initialize port's object reference
            } else {
                if (fieldIsStatic) {
                    for (int a = 0; a < fieldMethods.length; a++) {
                        if (usedOutputParam) {
                            for (int i = 0; i < fieldInParameterNames.length; i++) {
                                String outParameterName = null;
                                for (int j = 0; j < fieldOutParameterNames.length; j++) {
                                    outParameterName = fieldOutParameterNames[j];
                                    if ((outParameterName != null)
                                        && (outParameterName.equals(fieldInParameterNames[i]))) {
                                        arguments[i] = (fieldMethods[a].getParameterTypes()[i]).newInstance();
                                    }
                                }
                            }
                        }
                        try {
                            // Get a set of arguments which are compatible with the method
                            Object[] compatibleArguments =
                                getCompatibleArguments(fieldMethods[a].getParameterTypes(), arguments);
                            // If we didn't get any arguments then the parts aren't compatible with the method
                            if (compatibleArguments == null)
                                break;
                            // Parts are compatible so invoke the method with the compatible set

                            Trc.event(
                                this,
                                "Invoking method ",
                                fieldMethods[a],
                                " with arguments ",
                                compatibleArguments);

                            result =
                                fieldMethods[a].invoke(
                                    null,
                                    compatibleArguments);

                            Trc.event(
                                this,
                                "Returned from method, result is ",
                                result);

                            chosenMethod = fieldMethods[a];
                            invokedOK = true;
                            break;
                        } catch (IllegalArgumentException ia) {
                             Trc.ignoredException(ia);
                            // Ignore and try next method
                        }
                    }
                    if (!invokedOK)
                        throw new WSIFException(
                            "Failed to invoke method '" + fieldJavaOperationModel.getMethodName() + "'");
                } else {
                    for (int a = 0; a < fieldMethods.length; a++) {
                        if (usedOutputParam) {
                            for (int i = 0; i < fieldInParameterNames.length; i++) {
                                String outParameterName = null;
                                for (int j = 0; j < fieldOutParameterNames.length; j++) {
                                    outParameterName = fieldOutParameterNames[j];
                                    if ((outParameterName != null)
                                        && (outParameterName.equals(fieldInParameterNames[i]))) {
                                        arguments[i] = (fieldMethods[a].getParameterTypes()[i]).newInstance();
                                    }
                                }
                            }
                        }
                        try {
                            // Get a set of arguments which are compatible with the method
                            Object[] compatibleArguments =
                                getCompatibleArguments(fieldMethods[a].getParameterTypes(), arguments);
                            // If we didn't get any arguments then the parts aren't compatible with the method
                            if (compatibleArguments == null)
                                break;
                            // Parts are compatible so invoke the method with the compatible set

                            Object objRef = fieldPort.getObjectReference();
                            Trc.event(
                                this,
                                "Invoking object ",
                                objRef,
                                " method ",
                                fieldMethods[a],
                                " with arguments ",
                                compatibleArguments);

                            result =
                                fieldMethods[a].invoke(
                                    objRef,
                                    compatibleArguments);

                            Trc.event(
                                this,
                                "Returned from method, result is ",
                                result);

                            chosenMethod = fieldMethods[a];
                            invokedOK = true;
                            break;
                        } catch (IllegalArgumentException ia) {
                            Trc.ignoredException(ia);
                            // Ignore and try next method
                        }
                    }
                    if (!invokedOK)
                        throw new WSIFException(
                            "Failed to invoke method '" + fieldJavaOperationModel.getMethodName() + "'");
                }

                String outParameterName = null;
                if (fieldOutParameterNames != null && fieldOutParameterNames.length > 0) {
                    output.setName(getOutputMessageName());
                    outParameterName = (String) fieldOutParameterNames[0];
                    if (outParameterName != null) {
                        output.setObjectPart(
                            outParameterName,
                            getCompatibleReturn(chosenMethod, result));
                        // Should we use the class of the method signature instead here ?
                    }

                    if (arguments != null) {
                        for (int i = 1; i < fieldOutParameterNames.length; i++) {
                            outParameterName = fieldOutParameterNames[i];
                            if (outParameterName != null) {
                              try {
                                for (int r = 0; r < fieldInParameterNames.length; r++) {
                                  if (outParameterName.equals(fieldInParameterNames[r])) {
                                    output.setObjectPart(outParameterName, arguments[r]);
                                    break;
                                  }
                                }
                              } catch (WSIFException e) {
                                  Trc.ignoredException(e);
                                //ignore
                              }
                            }
                        }
                    }
                }
            }
        } catch (InvocationTargetException ex) {
          Trc.exception(ex);
            Throwable invocationFault = ex.getTargetException();
            String className = invocationFault.getClass().getName();
            Map faultMessageInfos = getFaultMessageInfos();
            FaultMessageInfo faultMessageInfo =
                (FaultMessageInfo) faultMessageInfos.get(className);
            if ((faultMessageInfo != null)
                && (faultMessageInfo.fieldPartName != null)) { // Found fault
                Object faultPart = invocationFault;
                // Should we use the class of the method signature here ?
                fault.setObjectPart(faultMessageInfo.fieldPartName, faultPart);
                fault.setName(faultMessageInfo.fieldMessageName);
                if (faultMessageInfo.fieldMessageName != null) {
                  Fault wsdlFault = fieldBindingOperationModel.getOperation().getFault(faultMessageInfo.fieldMessageName);
                  if (wsdlFault != null) {
                      fault.setMessageDefinition(wsdlFault.getMessage());
                  }
                }
                operationSucceeded = false;
            } else {
                // Try to find a matching class:
                Class invocationFaultClass = invocationFault.getClass();
                Class tempClass = null;
                Iterator it = faultMessageInfos.values().iterator();
                boolean found = false;
                while (it.hasNext()) {
                    faultMessageInfo = (FaultMessageInfo) it.next();
                    try {
                        tempClass =
                            Class.forName(
                                faultMessageInfo.fieldFormatType,
                                true,
                                Thread.currentThread().getContextClassLoader());
                        if (tempClass.isAssignableFrom(invocationFaultClass)) {
                            found = true;
                            Object faultPart = invocationFault;
                            // Should we use the class of the method signature here ?
                            fault.setObjectPart(faultMessageInfo.fieldPartName, faultPart);
                            fault.setName(faultMessageInfo.fieldMessageName);
                            if (faultMessageInfo.fieldMessageName != null) {
                              Fault wsdlFault = fieldBindingOperationModel.getOperation().getFault(faultMessageInfo.fieldMessageName);
                              if (wsdlFault != null) {
                                fault.setMessageDefinition(wsdlFault.getMessage());
                              }
                            }
                            operationSucceeded = false;
                        }
                    } catch (Exception exc) { // Nothing to do - just try the next one...
                      Trc.ignoredException(exc);
                    }
                }
                if (!found) {
                    throw new WSIFException("Operation failed!", invocationFault);
                }
            }
        } catch (Exception ex) {
            Trc.exception(ex);

            // Log message
            MessageLogger.log(
                "WSIF.0005E",
                "Java",
                fieldJavaOperationModel.getMethodName());

            throw new WSIFException(
                this
                    + " : Could not invoke '"
                    + fieldJavaOperationModel.getMethodName()
                    + "'",
                ex);
View Full Code Here

Examples of org.apache.wsif.WSIFException

        try {
            Object result = null;
            // Need to get the stuff here because this also initializes fieldInParameterNames
            if (fieldIsConstructor) {
                if (fieldConstructors.length <= 0)
                    throw new WSIFException("No constructors found that match the parts specified");
            } else {
                if (fieldMethods.length <= 0)
                    throw new WSIFException("No methods named '"
                        + fieldJavaOperationModel.getMethodName()
                        + "' found that match the parts specified");
            }

            Object[] arguments = null;
            Object part = null;
            if ((fieldInParameterNames != null) && (fieldInParameterNames.length > 0)) {
                arguments = new Object[fieldInParameterNames.length];
                for (int i = 0; i < fieldInParameterNames.length; i++) {
                   try {
                        part = input.getObjectPart(fieldInParameterNames[i]);
                        arguments[i] = part;
                    } catch (WSIFException e) {
                       Trc.exception(e);
                        arguments[i] = null;
                    }
                }
            }

            boolean invokedOK = false;

            if (fieldIsConstructor) {
                for (int a = 0; a < fieldConstructors.length; a++) {
                    try {
                        // Get a set of arguments which are compatible with the ctor
                        Object[] compatibleArguments =
                            getCompatibleArguments(fieldConstructors[a].getParameterTypes(), arguments);
                        // If we didn't get any arguments then the parts aren't compatible with the ctor
                        if (compatibleArguments == null)
                            break;
                        // Parts are compatible so invoke the ctor with the compatible set

                        Trc.event(
                            this,
                            "Invoking constructor ",
                            fieldConstructors[a],
                            " with arguments ",
                            compatibleArguments);

                        result =
                            fieldConstructors[a].newInstance(
                                compatibleArguments);

                        Trc.event(
                            this,
                            "Returned from constructor, result is ",
                            result);

                        fieldPort.setObjectReference(result);
                        invokedOK = true;
                        break;
                    } catch (IllegalArgumentException ia) {
                      Trc.ignoredException(ia);
                        // Ignore and try next constructor
                    }
                }
                if (!invokedOK)
                    throw new WSIFException("Failed to call constructor for object in Java operation");
            } else {
                if (fieldIsStatic) {
                    for (int a = 0; a < fieldMethods.length; a++) {
                        try {
                            // Get a set of arguments which are compatible with the method
                            Object[] compatibleArguments =
                                getCompatibleArguments(fieldMethods[a].getParameterTypes(), arguments);
                            // If we didn't get any arguments then the parts aren't compatible with the method
                            if (compatibleArguments == null)
                                break;
                            // Parts are compatible so invoke the method with the compatible set

                            Trc.event(
                                this,
                                "Invoking method ",
                                fieldMethods[a],
                                " with arguments ",
                                compatibleArguments);

                            result =
                                fieldMethods[a].invoke(
                                    null,
                                    compatibleArguments);

                            Trc.event(
                                this,
                                "Returned from method, result is ",
                                result);

                            invokedOK = true;
                            break;
                        } catch (IllegalArgumentException ia) {
                          Trc.ignoredException(ia);
                            // Ignore and try next method
                        }
                    }
                    if (!invokedOK)
                        throw new WSIFException(
                            "Failed to invoke method '" + fieldJavaOperationModel.getMethodName() + "'");
                } else {
                    for (int a = 0; a < fieldMethods.length; a++) {
                        try {
                            // Get a set of arguments which are compatible with the method
                            Object[] compatibleArguments =
                                getCompatibleArguments(fieldMethods[a].getParameterTypes(), arguments);
                            // If we didn't get any arguments then the parts aren't compatible with the method
                            if (compatibleArguments == null)
                                break;
                            // Parts are compatible so invoke the method with the compatible set

                            Object objRef = fieldPort.getObjectReference();
                            Trc.event(
                                this,
                                "Invoking object ",
                                objRef,
                                " method ",
                                fieldMethods[a],
                                " with arguments ",
                                compatibleArguments);

                            result =
                                fieldMethods[a].invoke(
                                    objRef,
                                    compatibleArguments);

                            Trc.event(
                                this,
                                "Returned from method, result is ",
                                result);

                            invokedOK = true;
                            break;
                        } catch (IllegalArgumentException ia) {
                          Trc.ignoredException(ia);
                            // Ignore and try next method
                        }
                    }
                    if (!invokedOK)
                        throw new WSIFException(
                            "Failed to invoke method '" + fieldJavaOperationModel.getMethodName() + "'");
                }
            }
        } catch (InvocationTargetException ex) {
            Trc.exception(ex);

            // Log message
            MessageLogger.log(
                "WSIF.0005E",
                "Java",
                fieldJavaOperationModel.getMethodName());

            throw new WSIFException(
                this
                    + " : Invocation of '"
                    + fieldJavaOperationModel.getMethodName()
                    + "' failed.",
                ex);
        } catch (Exception ex) {
            Trc.exception(ex);

            // Log message
            MessageLogger.log(
                "WSIF.0005E",
                "Java",
                fieldJavaOperationModel.getMethodName());

            throw new WSIFException(
                this
                    + " : Could not invoke '"
                    + fieldJavaOperationModel.getMethodName()
                    + "'",
                ex);
View Full Code Here

Examples of org.apache.wsif.WSIFException

            session =
                connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

            Destination initDest = finder.getInitialDestination();
            if (initDest != null && altDestName != null)
                throw new WSIFException("Both jndiDestinationName and jmsproviderDestinationName cannot be specified");
            if (initDest == null && altDestName == null)
                throw new WSIFException("Either jndiDestinationName or jmsproviderDestinationName must be specified");

            if (altDestName != null)
                initDest = session.createQueue(altDestName);

            writeQ = (Queue) initDest;
View Full Code Here

Examples of org.apache.wsif.WSIFException

        String s = null;
        try {
            if (msg instanceof TextMessage)
                s = ((TextMessage) msg).getText();
            else
                throw new WSIFException(
                    "Reply message was not a TextMessage:msg="
                        + (msg == null ? "null" : msg.toString()));
        } catch (JMSException e) {
            Trc.exception(e);
            throw WSIFJMSConstants.ToWsifException(e);
View Full Code Here

Examples of org.apache.wsif.WSIFException

            msg = rec.receive(timeout);
            setLastMessage(msg);

            if (msg == null)
                throw new WSIFException(
                    "Receive timed out on JMS queue "
                        + readQ.getQueueName()
                        + ", timeout "
                        + timeout);
        } catch (JMSException e) {
View Full Code Here

Examples of org.apache.wsif.WSIFException

        return null;
    }

    protected void areWeClosed() throws WSIFException {
        if (session == null)
            throw new WSIFException("Cannot use a closed destination");
    }
View Full Code Here

Examples of org.apache.wsif.WSIFException

                        .jms
                        .JMSConstants
                        .MESSAGE_TYPE_TEXTMESSAGE)
                jmsMsg = session.createTextMessage();
            else
                throw new WSIFException("Unable to support message type");
        } catch (JMSException je) {
            Trc.exception(je);
            throw WSIFJMSConstants.ToWsifException(je);
        }
        Trc.exit(jmsMsg);
View Full Code Here

Examples of org.apache.wsif.WSIFException

     */
    public WSIFCorrelationId executeRequestResponseAsync(
        WSIFMessage input,
        WSIFResponseHandler handler)
        throws WSIFException {
        throw new WSIFException("asynchronous operations not supportted");
    }
View Full Code Here

Examples of org.apache.wsif.WSIFException

     * throws an exception.
     * @see WSIFOperation#executeRequestResponseAsync(WSIFMessage)
     */
    public WSIFCorrelationId executeRequestResponseAsync(WSIFMessage input)
        throws WSIFException {
        throw new WSIFException("asynchronous operations not supportted");
    }
View Full Code Here

Examples of org.apache.wsif.WSIFException

     * throws an exception.
     * @see WSIFOperation#fireAsyncResponse(Object)
     * @param response   an Object representing the response
     */
    public void fireAsyncResponse(Object response) throws WSIFException {
        throw new WSIFException("asynchronous operations not supportted");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.