Package org.apache.wsif

Examples of org.apache.wsif.WSIFException


        Trc.entry(this, operationName, inputName, outputName);

        WSIFOperation_Jms op =
            getDynamicWSIFOperation(operationName, inputName, outputName);
        if (op == null) {
            throw new WSIFException(
                "Could not create operation: "
                    + operationName
                    + ":"
                    + inputName
                    + ":"
View Full Code Here


            try {
                ExtensibilityElement portExtension =
                    (ExtensibilityElement) fieldPortModel.getExtensibilityElements().get(0);

                if (portExtension == null) {
                    throw new WSIFException("Jms missing port extension");
                }

                fieldObjectReference = (JMSAddress) portExtension;

            } catch (Exception ex) {
            Trc.exception(ex);
                throw new WSIFException(
                    "Could not create object of class '???todo??? " + "'",
                    ex);
            }
        }
        Trc.exit(fieldObjectReference);
View Full Code Here

            portTypeNS,
            portTypeName,
            typeMap);

        if (!iface.isInterface())
            throw new WSIFException(
                "Cannot get a stub for " + iface + " because it is not an interface");

        WSIFClientProxy clientProxy =
            new WSIFClientProxy(
                iface,
View Full Code Here

                    String name = (String) it.next();
                    sb.append(name).append(":").append(
                        wsifFaultMessage.getObjectPart(name)).append(
                        " ");
                }
                throw new WSIFException(sb.toString());
            }
        }

        // Copy the output part out of the message.
        Object result = null;
View Full Code Here

        int i;
        for (i = 0; i < allMethods.length; i++)
            if (allMethods[i].equals(method))
                break;
        if (i >= allMethods.length || !method.equals(allMethods[i]))
            throw new WSIFException(
                "Method "
                    + method.getName()
                    + " is not in interface "
                    + iface.getName());

        String methodName = method.getName();
        Class[] types = method.getParameterTypes();
        List opList = portType.getOperations();
        Iterator opIt = opList.iterator();
        Operation matchingOperation = null;

        // First try to find this method in the portType's list of operations.
        // Be careful of overloaded operations.
        while (opIt.hasNext()) {
            Operation operation = (Operation) opIt.next();
            // If the method name doesn't match the operation name this isn't the operation
            if (!methodName.equalsIgnoreCase(operation.getName()))
                continue;

            Input input = operation.getInput();
            Message inputMessage = (input == null) ? null : input.getMessage();
            List inputParts = (inputMessage == null)
               ? new ArrayList()
               : inputMessage.getOrderedParts(null);
           
            int numInputParts = inputParts.size();

            // Check for a match if neither args nor the operation has any parameters
            if (numInputParts == 0 && types.length == 0) {
                wsdlOperationTable.put(key, operation);
                return operation;
            }

            // No match if there are different numbers of parameters
            if (types != null && (numInputParts != types.length)) {
                unWrapIfWrappedDocLit(inputParts, operation.getName());
                numInputParts = inputParts.size();
                if (numInputParts != types.length) {
                    continue;
                }
            }

            // Go through all the parameters making sure all their datatypes match
            Iterator partIt = inputParts.iterator();
            boolean foundAllArgs = true;
            boolean exactMatchAllArgs = true;
            for (int argIndex = 0;
                partIt.hasNext() && foundAllArgs;
                argIndex++) {
                 
                Part part = (Part) partIt.next();
                QName partTypeName = part.getTypeName();
                if (partTypeName==null) {
                    partTypeName = part.getElementName();
                }

                /* for wrapped document literal operations AXIS uses a wrapper
                 * element class with ">" prefixed to the namespace local part
                 */
                QName partTypeNameWrapped =
                   new QName(partTypeName.getNamespaceURI(), ">" + partTypeName.getLocalPart());

                boolean foundThisArg = false;
                boolean exactMatchThisArg = false;

                // Look this parameter up in the typeMap.
                for (Iterator mapIt = typeMap.iterator();
                    mapIt.hasNext() && !foundThisArg;
                    ) {
                    WSIFDynamicTypeMapping mapping =
                        (WSIFDynamicTypeMapping) mapIt.next();
                    if (mapping.getXmlType().equals(partTypeName)
                    || (mapping.getXmlType().equals(partTypeNameWrapped))) {
                        if (mapping
                            .getJavaType()
                            .isAssignableFrom(types[argIndex])
                            || (args[argIndex] != null
                                && mapping.getJavaType().isAssignableFrom(
                                    args[argIndex].getClass()))) {
                            foundThisArg = true;
                            if (mapping.getJavaType().equals(types[argIndex])
                                || (args[argIndex] != null
                                    && mapping.getJavaType().equals(
                                        args[argIndex].getClass())))
                                exactMatchThisArg = true;
                        } else
                            break;
                    }
                }

                // Look for a simple type that matches
                TypeMapping tm =
                    (TypeMapping) (simpleTypeReg.get(partTypeName));
                if (!foundThisArg) {
                    if (tm != null) {
                        String simpleType = tm.javaType;
                        if (types[argIndex].toString().equals(simpleType)) {
                            // this works for simple types (float, int)
                            foundThisArg = true;
                            exactMatchThisArg = true;
                        } else
                            try // this works for String, Date
                                {
                                Class simpleClass =
                                    Class.forName(
                                        simpleType,
                                        true,
                                        Thread
                                            .currentThread()
                                            .getContextClassLoader());
                                if (simpleClass
                                    .isAssignableFrom(types[argIndex])) {
                                    foundThisArg = true;
                                    if (simpleClass.equals(types[argIndex]))
                                        exactMatchThisArg = true;
                                }
                            } catch (ClassNotFoundException ignored) {
                                Trc.ignoredException(ignored);
                            }
                    } else if (types[argIndex].equals(DataHandler.class))
                        // There is no (simple or complex) type mapping for
                        // this argument. If it's a DataHandler, then assume
                        // it's a mime type, since we do automatic registering
                        // of DataHandlers for Mime types. We should really look
                        // in the WSDL binding to make sure it is a mime part.
                        foundThisArg = true;
                }

                if (!foundThisArg)
                    foundAllArgs = false;
                if (!exactMatchThisArg)
                    exactMatchAllArgs = false;
            }

            if (foundAllArgs) {
                if (exactMatchAllArgs) {
                    wsdlOperationTable.put(key, operation);
                    return operation;
                }

                // if matchingOperation!=null then write trace statement.
                matchingOperation = operation;
            }
        } // end while

        if (matchingOperation != null) {
            wsdlOperationTable.put(key, matchingOperation);
            return matchingOperation;
        }

        // if we get here then we haven't found a matching operation      
        String argString = new String();
        if (types != null)
            for (i = 0; i < types.length; i++) {
                if (i != 0)
                    argString += ", ";
                argString += types[i];
            }

        throw new WSIFException(
            "Method "
                + methodName
                + "("
                + argString
                + ") was not found in portType "
View Full Code Here

        String s = (String) obj;
        if (s.length() == 1) {
          ret = new Character(s.charAt(0));
          return ret;
        } else {
          throw new WSIFException("String is longer than 1 character");
        }
      } else {
        throw new WSIFException("Array entry is not a String or another array");
      }
    }
View Full Code Here

        String s = (String) obj;
        if (s.length() == 1) {
          ret = new Character(s.charAt(0));
          return ret;
        } else {
          throw new WSIFException("String is longer than 1 character");
        }
      } else {
        throw new WSIFException("Array entry is not a String or another array");
      }
    }
View Full Code Here

        return ret;
      } else if (obj instanceof Character) {
        String s = obj.toString();
      return s;
      } else {
        throw new WSIFException("Array entry is not a Character or another array");
      }
    }
View Full Code Here

        return ret;
      } else if (obj instanceof Character) {
        String s = obj.toString();
      return s;
      } else {
        throw new WSIFException("Array entry is not a char or another array");
      }
    }
View Full Code Here

            correlator,
            new Long(System.currentTimeMillis() + timeout));
        }
      } catch (IOException ex) {
        Trc.exception(ex);
        throw new WSIFException(ex.toString());
      }
    } else {
      throw new IllegalArgumentException(
        "cannot put null "
          + ((correlator == null) ? "correlator" : "state"));
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.