Package org.objectweb.celtix.bus.bindings

Examples of org.objectweb.celtix.bus.bindings.WSDLOperationInfo$OperationWebParam


                                                            ObjectMessageContext objContext,
                                                            DataBindingCallback.Mode mode) {
        if (opMap.containsKey(operationName)) {
            return opMap.get(operationName);
        }
        WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName.getLocalPart());
        if (opInfo == null) {
            //REVISIT - really map the operation name to a WSDL operation
            for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
                if (operationName.getLocalPart().equalsIgnoreCase(opName)) {
                    opInfo = wsdlCache.getOperationInfo(opName);
View Full Code Here


     * @param operationName the name of the WS operation to invoke
     * @param args          the Java object arguments to the WS operation
     * @return the response from the WS as a Java object
     */
    public Object invoke(String operationName, Object[] args) {
        WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName);
        if (opInfo == null) {
            //REVISIT - really map the operation name to a WSDL operation
            for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
                if (operationName.equalsIgnoreCase(opName)) {
                    opInfo = wsdlCache.getOperationInfo(opName);
                    break;
                }
            }
        }
        ObjectMessageContext objMsgContext = clientBinding.createObjectContext();

        boolean hasInOut = false;
        int inOutCount = 0;
        Object realArgs[] = new Object[args.length];
        if (opInfo.getParamsLength() == 0) {
            //REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case.
            //Bug in Celtix
            realArgs = args;
        } else {
            for (int x = 0; x < args.length; x++) {
                if (opInfo.getWebParam(x).mode() == Mode.IN) {
                    realArgs[x] = args[x];
                } else {
                    realArgs[x] = new Holder<Object>(args[x]);
                    inOutCount++;
                    hasInOut = true;
                }
            }
        }

        objMsgContext.setMessageObjects(realArgs);

        boolean isOneway = opInfo.isOneWay();
        DataBindingCallback callback = new SCADataBindingCallback(opInfo, typeHelper,
                                                                  wsBinding.getResourceLoader(),
                                                                  hasInOut);

        try {
            if (isOneway) {
                clientBinding.invokeOneWay(objMsgContext,
                        callback);
            } else {
                objMsgContext = clientBinding.invoke(objMsgContext,
                        callback);
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        if (objMsgContext.getException() != null) {
            //REVISIT - Exceptions
            /*
            if (isValidException(objMsgContext)) {
                throw (Exception)objMsgContext.getException();
            } else {
                throw new ProtocolException(objMsgContext.getException());
            }
            */
            throw new ProtocolException(objMsgContext.getException());
        }

        if (hasInOut) {
            Object ret[] = new Object[inOutCount + 1];
            ret[0] = objMsgContext.getReturn();
            inOutCount = 1;
            for (int x = 0; x < args.length; x++) {
                if (opInfo.getWebParam(x).mode() != Mode.IN) {
                    Holder<?> holder = (Holder<?>)realArgs[x];
                    ret[inOutCount] = holder.value;
                    inOutCount++;
                }
            }
View Full Code Here

                                                            ObjectMessageContext objContext,
                                                            DataBindingCallback.Mode mode) {
        if (opMap.containsKey(operationName)) {
            return opMap.get(operationName);
        }
        WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName.getLocalPart());
        if (opInfo == null) {
            //REVISIT - really map the operation name to a WSDL operation
            for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
                if (operationName.getLocalPart().equalsIgnoreCase(opName)) {
                    opInfo = wsdlCache.getOperationInfo(opName);
View Full Code Here

     *
     * @param args the Java object arguments to the WS operation
     * @return the response from the WS as a Java object
     */
    public Object invokeTarget(final Object args) throws InvocationTargetException {
        WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName);
        if (opInfo == null) {
            // REVISIT - really map the operation name to a WSDL operation
            for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
                if (operationName.equalsIgnoreCase(opName)) {
                    opInfo = wsdlCache.getOperationInfo(opName);
                    break;
                }
            }
        }

        ObjectMessageContext objMsgContext = clientBinding.createObjectContext();

        boolean hasInOut = false;
        int inOutCount = 0;
        Object realArgs[];
        Object argsArray[];
        if (args.getClass().isArray()) {
            argsArray = (Object[]) args;
            realArgs = new Object[Array.getLength(args)];
        } else {
            argsArray = new Object[0];
            realArgs = new Object[0];
        }

        if (opInfo.getParamsLength() == 0) {
            // REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case.
            // Bug in Celtix
            realArgs = argsArray;
        } else {
            for (int x = 0; x < argsArray.length; x++) {
                if (opInfo.getWebParam(x).mode() == WebParam.Mode.IN) {
                    realArgs[x] = argsArray[x];
                } else {
                    realArgs[x] = new Holder<Object>(argsArray[x]);
                    inOutCount++;
                    hasInOut = true;
                }
            }
        }
        objMsgContext.setMessageObjects(realArgs);
        boolean isOneway = opInfo.isOneWay();
        DataBindingCallback callback = new SCADataBindingCallback(opInfo, hasInOut, typeHelper);
        try {
            if (isOneway) {
                clientBinding.invokeOneWay(objMsgContext, callback);
            } else {
                objMsgContext = clientBinding.invoke(objMsgContext, callback);
            }
        } catch (IOException e) {
            throw new InvocationTargetException(e);
        }

        if (objMsgContext.getException() != null) {
            // REVISIT - Exceptions
            /*
             * if (isValidException(objMsgContext)) { throw
             * (Exception)objMsgContext.getException(); } else { throw new
             * ProtocolException(objMsgContext.getException()); }
             */
            throw new InvocationTargetException(objMsgContext.getException());
        }

        if (hasInOut) {
            Object ret[] = new Object[inOutCount + 1];
            ret[0] = objMsgContext.getReturn();
            inOutCount = 1;
            for (int x = 0; x < argsArray.length; x++) {
                if (opInfo.getWebParam(x).mode() != WebParam.Mode.IN) {
                    Holder<?> holder = (Holder<?>) realArgs[x];
                    ret[inOutCount] = holder.value;
                    inOutCount++;
                }
            }
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.bus.bindings.WSDLOperationInfo$OperationWebParam

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.