Package org.apache.wsif

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


            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

        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

            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

        return null;
    }

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

                        .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

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

     * 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

     * 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

    public boolean processAsyncResponse(
        Object response,
        WSIFMessage output,
        WSIFMessage fault)
        throws WSIFException {
        throw new WSIFException("asynchronous operations not supportted");
    }
View Full Code Here

TOP

Related Classes of org.apache.wsif.WSIFException

Copyright © 2018 www.massapicom. 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.