Package javax.wsdl

Examples of javax.wsdl.Operation


        AxisOperation axisOperation;
        List operationNames = new ArrayList();

        QName opName;
        Operation wsdl4jOperation;

        for (Iterator iterator = wsdl4jOperations.iterator(); iterator.hasNext();) {
            wsdl4jOperation = (Operation) iterator.next();

            axisOperation = populateOperations(wsdl4jOperation, wsdl4jPortType, portTypeWSDL);
            addDocumentation(axisOperation, wsdl4jOperation.getDocumentationElement());
            if (wsdl4jOperation.getInput() != null) {
                addMessageDocumentation(axisOperation, wsdl4jOperation.getInput().getDocumentationElement(), WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            }
            if (wsdl4jOperation.getOutput() != null) {
                addMessageDocumentation(axisOperation, wsdl4jOperation.getOutput().getDocumentationElement(), WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
            }
            axisOperation.setParent(axisService);
            axisService.addChild(axisOperation);
            operationNames.add(axisOperation.getName());
        }
View Full Code Here


        }

        addDocumentation(axisBinding, wsdl4jBinding.getDocumentationElement());

        AxisOperation axisOperation;
        Operation wsdl4jOperation;

        AxisBindingOperation axisBindingOperation;
        BindingOperation wsdl4jBindingOperation;

        Map httpLocationMap = createHttpLocationTable();
        String httpLocation = null;

        for (Iterator iterator = wsdl4jBidingOperations.iterator(); iterator.hasNext();) {

            axisBindingOperation = new AxisBindingOperation();
            wsdl4jBindingOperation = (BindingOperation) iterator.next();
            wsdl4jOperation = findOperation(portType, wsdl4jBindingOperation);

            axisBindingOperation.setName(new QName(bindingWSDL.getTargetNamespace(), wsdl4jBindingOperation.getName()));
            addDocumentation(axisBindingOperation, wsdl4jBindingOperation.getDocumentationElement());

            axisOperation = axisService.getOperation(new QName(portTypeWSDL.getTargetNamespace(), wsdl4jOperation.getName()));
            axisBindingOperation.setAxisOperation(axisOperation);

            // process ExtensibilityElements of the wsdl4jBinding
            copyExtensibleElements(wsdl4jBindingOperation.getExtensibilityElements(),
                                   wsdl4jDefinition, axisBindingOperation, BINDING_OPERATION);

            httpLocation =
                    (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION);
            String httpMethod =
                    (String) axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD);
            if (httpMethod == null || "".equals(httpMethod)) {
                httpMethod = HTTPConstants.HEADER_POST;
            }
            if (httpLocation != null) {
                httpLocationMap.put(WSDLUtil.getConstantFromHTTPLocation(httpLocation, httpMethod),
                                    axisBindingOperation.getAxisOperation());
            }

            BindingInput wsdl4jBindingInput = wsdl4jBindingOperation.getBindingInput();

            if (isServerSide) {
                if (wsdl4jBindingInput != null &&
                        WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())) {
                    AxisBindingMessage axisBindingInMessage = new AxisBindingMessage();
                    axisBindingInMessage.setParent(axisBindingOperation);
                    addDocumentation(axisBindingInMessage, wsdl4jBindingInput.getDocumentationElement());
                    copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(),
                            wsdl4jDefinition,
                            axisBindingInMessage, BINDING_OPERATION_INPUT);

                    AxisMessage axisInMessage =
                            axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                    //This is a hack to get AXIS2-2771 working , I had to copy soap headers
                    //  from binding message to AxisMessage
                    List soapHeaders = (List) axisBindingInMessage.getProperty(
                            WSDL2Constants.ATTR_WSOAP_HEADER);
                    if (soapHeaders != null) {
                        for (int i = 0; i < soapHeaders.size(); i++) {
                            SOAPHeaderMessage headerMessage = (SOAPHeaderMessage) soapHeaders.get(i);
                            axisInMessage.addSoapHeader(headerMessage);
                        }
                    }

                    if (isSetMessageQNames) {
                        BindingOperationEntry boe = find(wrappableBOEs, wsdl4jBindingOperation);
                        boolean isWrapped = (boe == null) ? false : boe.isWrappedInput();
                        addQNameReference(axisInMessage, wsdl4jOperation,
                                wsdl4jBindingInput,
                                isWrapped);
                    }

                    axisBindingInMessage.setAxisMessage(axisInMessage);
                    axisBindingInMessage.setName(axisInMessage.getName());
                    axisBindingInMessage.setDirection(axisInMessage.getDirection());

                    axisBindingOperation
                            .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisBindingInMessage);
                }
            } else {
                if (wsdl4jBindingInput != null &&
                        WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())) {
                    AxisBindingMessage axisBindingOutMessage = new AxisBindingMessage();
                    axisBindingOutMessage.setParent(axisBindingOperation);
                    addDocumentation(axisBindingOutMessage, wsdl4jBindingInput.getDocumentationElement());
                    copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(),
                            wsdl4jDefinition,
                            axisBindingOutMessage, BINDING_OPERATION_OUTPUT);

                    AxisMessage axisOutMessage =
                            axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                    //This is a hack to get AXIS2-2771 working , I had to copy soap headers
                    //  from binding message to AxisMessage
                    List soapHeaders = (List) axisBindingOutMessage.getProperty(
                            WSDL2Constants.ATTR_WSOAP_HEADER);
                    if (soapHeaders != null) {
                        for (int i = 0; i < soapHeaders.size(); i++) {
                            SOAPHeaderMessage headerMessage = (SOAPHeaderMessage) soapHeaders.get(i);
                            axisOutMessage.addSoapHeader(headerMessage);
                        }
                    }

                    if (isSetMessageQNames) {
                        BindingOperationEntry boe = find(wrappableBOEs, wsdl4jBindingOperation);
                        boolean isWrapped = (boe == null) ? false : boe.isWrappedInput();
                        addQNameReference(axisOutMessage, wsdl4jOperation,
                                wsdl4jBindingInput,
                                isWrapped);
                    }

                    axisBindingOutMessage.setAxisMessage(axisOutMessage);
                    axisBindingOutMessage.setName(axisOutMessage.getName());
                    axisBindingOutMessage.setDirection(axisOutMessage.getDirection());

                    axisBindingOperation
                            .addChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE, axisBindingOutMessage);
                }
            }

            BindingOutput wsdl4jBindingOutput = wsdl4jBindingOperation.getBindingOutput();

            if (isServerSide) {
                if (wsdl4jBindingOutput != null &&
                        WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())) {

                    AxisBindingMessage axisBindingOutMessage = new AxisBindingMessage();
                    axisBindingOutMessage.setParent(axisBindingOperation);
                    addDocumentation(axisBindingOutMessage, wsdl4jBindingOutput.getDocumentationElement());
                    AxisMessage axisOutMessage =
                            axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);

                    copyExtensibleElements(wsdl4jBindingOutput.getExtensibilityElements(),
                            wsdl4jDefinition,
                            axisBindingOutMessage, BINDING_OPERATION_OUTPUT);

                    //This is a hack to get AXIS2-2771 working , I had to copy soap headers
                    //  from binding message to AxisMessage
                    List soapHeaders =
                            (List) axisBindingOutMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER);
                    if (soapHeaders != null) {
                        for (int i = 0; i < soapHeaders.size(); i++) {
                            SOAPHeaderMessage headerMessage = (SOAPHeaderMessage) soapHeaders.get(i);
                            axisOutMessage.addSoapHeader(headerMessage);
                        }
                    }

                    if (isSetMessageQNames) {
                        BindingOperationEntry boe = find(wrappableBOEs, wsdl4jBindingOperation);
                        boolean isWrapped = (boe == null) ? false : boe.isWrappedOutput();
                        axisOutMessage.setWrapped(isWrapped);
                        addQNameReference(axisOutMessage, wsdl4jOperation,
                                wsdl4jBindingOutput,
                                isWrapped);
                    }


                    axisBindingOutMessage.setAxisMessage(axisOutMessage);
                    axisBindingOutMessage.setName(axisOutMessage.getName());
                    axisBindingOutMessage.setDirection(axisOutMessage.getDirection());

                    axisBindingOperation
                            .addChild(WSDLConstants.MESSAGE_LABEL_OUT_VALUE, axisBindingOutMessage);
                }
            } else {
                if (wsdl4jBindingOutput != null &&
                        WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())) {

                    AxisBindingMessage axisBindingInMessage = new AxisBindingMessage();
                    axisBindingInMessage.setParent(axisBindingOperation);
                    addDocumentation(axisBindingInMessage, wsdl4jBindingOutput.getDocumentationElement());
                    AxisMessage axisInMessage =
                            axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);

                    copyExtensibleElements(wsdl4jBindingOutput.getExtensibilityElements(),
                            wsdl4jDefinition,
                            axisBindingInMessage, BINDING_OPERATION_INPUT);

                    //This is a hack to get AXIS2-2771 working , I had to copy soap headers
                    //  from binding message to AxisMessage
                    List soapHeaders =
                            (List) axisBindingInMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER);
                    if (soapHeaders != null) {
                        for (int i = 0; i < soapHeaders.size(); i++) {
                            SOAPHeaderMessage headerMessage = (SOAPHeaderMessage) soapHeaders.get(i);
                            axisInMessage.addSoapHeader(headerMessage);
                        }
                    }

                    if (isSetMessageQNames) {
                        BindingOperationEntry boe = find(wrappableBOEs, wsdl4jBindingOperation);
                        boolean isWrapped = (boe == null) ? false : boe.isWrappedOutput();
                        axisInMessage.setWrapped(isWrapped);
                        addQNameReference(axisInMessage, wsdl4jOperation,
                                wsdl4jBindingOutput,
                                isWrapped);
                    }


                    axisBindingInMessage.setAxisMessage(axisInMessage);
                    axisBindingInMessage.setName(axisInMessage.getName());
                    axisBindingInMessage.setDirection(axisInMessage.getDirection());

                    axisBindingOperation
                            .addChild(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisBindingInMessage);
                }
            }

            Map bindingFaultsMap = wsdl4jBindingOperation.getBindingFaults();

            /* process the binding faults */
            for (Iterator bindingFaults = bindingFaultsMap.values().iterator();
                 bindingFaults.hasNext();) {

                BindingFault bindingFault = (BindingFault) bindingFaults.next();
                if (bindingFault.getName() == null) {
                    throw new AxisFault("Binding name is null for the binding fault in " +
                            " binding operation ==> " + wsdl4jBindingOperation.getName());
                } else {
                    Fault wsdl4jFault = wsdl4jOperation.getFault(bindingFault.getName());
                    if (wsdl4jFault == null){
                        throw new AxisFault("Can not find the corresponding fault element in " +
                                "wsdl operation " + wsdl4jOperation.getName() + " for the fault" +
                                " name " + bindingFault.getName());
                    } else {
                        Message wsdl4jFaultMessge = wsdl4jFault.getMessage();

                        AxisMessage faultMessage = findFaultMessage(
View Full Code Here

        return returnPort;
    }

    private Operation findOperation(PortType portType,
                                    BindingOperation wsdl4jBindingOperation) {
        Operation op = wsdl4jBindingOperation.getOperation();
        String input = null;
        if (op != null && op.getInput() != null) {
            input = op.getInput().getName();
            if (":none".equals(input)) {
                input = null;
            }
        }
        String output = null;
        if (op != null && op.getOutput() != null) {
            output = op.getOutput().getName();
            if (":none".equals(output)) {
                output = null;
            }
        }
        Operation op2 = portType.getOperation(op.getName(), input, output);
        return ((op2 == null) ? op : op2);
    }
View Full Code Here

        List<String> opNameList = new ArrayList<String>();
        Iterator wsdlOpIter = wsdlOperationList.iterator();
        while (wsdlOpIter.hasNext()) {
            Object obj = wsdlOpIter.next();
            if (obj instanceof Operation) {
                Operation operation = (Operation)obj;
                opNameList.add(operation.getName());
            }
        }
        return opNameList;
    }
View Full Code Here

        o.setProperty(Method.class.getName(), method);
        o.setProperty(METHOD, method);
        initializeWrapping(o, method);

        // rpc out-message-part-info class mapping
        Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION);

        initializeClassInfo(o, method, op == null ? null
            : CastUtils.cast(op.getParameterOrdering(), String.class));

        bindOperation(o, method);

        sendEvent(Event.INTERFACE_OPERATION_BOUND, o, method);
    }
View Full Code Here

        int i = 0;
        Set wrapperElementQNames = new HashSet();
        JavaXmlTypeMappingType[] javaXmlTypeMappings = mapping.getJavaXmlTypeMappingArray();
        boolean hasEncoded = false;
        for (Iterator ops = operations.iterator(); ops.hasNext();) {
            Operation operation = (Operation) ops.next();
            String operationName = operation.getName();
            //the obvious method seems to be buggy
//            BindingOperation bindingOperation = binding.getBindingOperation(operationName, operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
            BindingOperation bindingOperation = null;
            List bops = binding.getBindingOperations();
            for (Iterator iterator = bops.iterator(); iterator.hasNext();) {
                BindingOperation bindingOperation1 = (BindingOperation) iterator.next();
                if (bindingOperation1.getOperation().equals(operation)) {
                    bindingOperation = bindingOperation1;
                    break;
                }
            }
            if (bindingOperation == null) {
                throw new DeploymentException("No BindingOperation for operation: " + operationName + ", input: " + operation.getInput().getName() + ", output: " + (operation.getOutput() == null ? "<none>" : operation.getOutput().getName()));
            }
            ServiceEndpointMethodMappingType methodMapping = WSDescriptorParser.getMethodMappingForOperation(operationName, methodMappings);
            HeavyweightOperationDescBuilder operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation, mapping, methodMapping, portStyle, exceptionMap, schemaInfoBuilder, javaXmlTypeMappings, classLoader, enhancedServiceEndpointClass);
            OperationInfo operationInfo = operationDescBuilder.buildOperationInfo(soapVersion);
            operationInfos[i++] = operationInfo;
View Full Code Here

        serviceEndpointInterface = getServiceEndpointInterfaceLightweight(portType, mapping, classLoader);
        Class enhancedServiceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointInterface, context, module, classLoader);

        int i = 0;
        for (Iterator ops = operations.iterator(); ops.hasNext();) {
            Operation operation = (Operation) ops.next();
            Method method = WSDescriptorParser.getMethodForOperation(enhancedServiceEndpointClass, operation);
            BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(), operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
            OperationInfo operationInfo = buildOperationInfoLightweight(method, bindingOperation, portStyle, soapVersion);
            operationInfos[i++] = operationInfo;
        }
        LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap(), Collections.EMPTY_SET);
        List typeInfo = builder.buildTypeInfo(mapping);
View Full Code Here

    }

    private void createBindingOperations(Definition definition, Binding binding) throws WSDLException {
        PortType portType = binding.getPortType();
        for (Iterator<?> operationIterator = portType.getOperations().iterator(); operationIterator.hasNext();) {
            Operation operation = (Operation) operationIterator.next();
            BindingOperation bindingOperation = definition.createBindingOperation();
            bindingOperation.setOperation(operation);
            populateBindingOperation(definition, bindingOperation);
            if (OperationType.REQUEST_RESPONSE.equals(operation.getStyle())) {
                createBindingInput(definition, operation, bindingOperation);
                createBindingOutput(definition, operation, bindingOperation);
            }
            else if (OperationType.ONE_WAY.equals(operation.getStyle())) {
                createBindingInput(definition, operation, bindingOperation);
            }
            else if (OperationType.NOTIFICATION.equals(operation.getStyle())) {
                createBindingOutput(definition, operation, bindingOperation);
            }
            else if (OperationType.SOLICIT_RESPONSE.equals(operation.getStyle())) {
                createBindingOutput(definition, operation, bindingOperation);
                createBindingInput(definition, operation, bindingOperation);
            }
            for (Iterator<?> faultIterator = operation.getFaults().values().iterator(); faultIterator.hasNext();) {
                Fault fault = (Fault) faultIterator.next();
                BindingFault bindingFault = definition.createBindingFault();
                populateBindingFault(definition, bindingFault, fault);
                if (StringUtils.hasText(bindingFault.getName())) {
                    bindingOperation.addBindingFault(bindingFault);
View Full Code Here

        }
        if (operations.isEmpty() && logger.isWarnEnabled()) {
            logger.warn("No operations were created, make sure the WSDL contains messages");
        }
        for (String operationName : operations.keySet()) {
            Operation operation = definition.createOperation();
            operation.setName(operationName);
            List<Message> messages = operations.get(operationName);
            for (Message message : messages) {
                if (isInputMessage(message)) {
                    Input input = definition.createInput();
                    input.setMessage(message);
                    populateInput(definition, input);
                    operation.setInput(input);
                }
                else if (isOutputMessage(message)) {
                    Output output = definition.createOutput();
                    output.setMessage(message);
                    populateOutput(definition, output);
                    operation.setOutput(output);
                }
                else if (isFaultMessage(message)) {
                    Fault fault = definition.createFault();
                    fault.setMessage(message);
                    populateFault(definition, fault);
                    operation.addFault(fault);
                }
            }
            operation.setStyle(getOperationType(operation));
            operation.setUndefined(false);
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "Adding operation [" + operation.getName() + "] to port type [" + portType.getQName() + "]");
            }
            portType.addOperation(operation);
        }
    }
View Full Code Here

        o.setProperty(Method.class.getName(), method);
        o.setProperty(METHOD, method);
        initializeWrapping(o, method);

        // rpc out-message-part-info class mapping
        Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION);

        initializeClassInfo(o, method, op == null ? null
            : CastUtils.cast(op.getParameterOrdering(), String.class));

        bindOperation(o, method);
    }
View Full Code Here

TOP

Related Classes of javax.wsdl.Operation

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.