Package javax.wsdl

Examples of javax.wsdl.BindingOperation


            // - headers
            HashMap attributes = new HashMap();
            List bindList = binding.getBindingOperations();
            HashMap faultMap = new HashMap(); // name to SOAPFault from WSDL4J
            for (Iterator opIterator = bindList.iterator(); opIterator.hasNext();) {
                BindingOperation bindOp = (BindingOperation) opIterator.next();
                Operation operation = bindOp.getOperation();
                BindingInput bindingInput = bindOp.getBindingInput();
                BindingOutput bindingOutput = bindOp.getBindingOutput();
                String opName = bindOp.getName();

                // First, make sure the binding operation matches a portType operation
                String inputName = bindingInput == null ? null :
                        bindingInput.getName();
                String outputName = bindingOutput == null ? null :
                        bindingOutput.getName();
                if (binding.getPortType().getOperation(
                        opName, inputName, outputName) == null) {
                    throw new IOException(Messages.getMessage("unmatchedOp",
                            new String[] {opName, inputName, outputName}));
                }

                ArrayList faults = new ArrayList();

                // input
                if (bindingInput != null) {
                    if (bindingInput.getExtensibilityElements() != null) {
                        Iterator inIter = bindingInput.
                                getExtensibilityElements().iterator();
                        fillInBindingInfo(bEntry, operation, inIter, faults,
                                true);
                    }
                }

                // output
                if (bindingOutput != null) {
                    if (bindingOutput.getExtensibilityElements() != null) {
                        Iterator outIter = bindingOutput.
                                getExtensibilityElements().iterator();
                        fillInBindingInfo(bEntry, operation, outIter, faults,
                                false);
                    }
                }

                // faults
                faultsFromSOAPFault(binding, bindOp, operation, faults);

                // Add this fault name and info to the map
                faultMap.put(bindOp, faults);
               
                Use inputBodyType = bEntry.getInputBodyType(operation);
                Use outputBodyType = bEntry.getOutputBodyType(operation);

                // Associate the portType operation that goes with this binding
                // with the body types.
                attributes.put(bindOp.getOperation(),
                        new BindingEntry.OperationAttr(inputBodyType, outputBodyType, faultMap));

                // If the input or output body uses literal, flag the binding as using literal.
                // NOTE:  should I include faultBodyType in this check?
                if (inputBodyType == Use.LITERAL ||
View Full Code Here


            }
        }

        List operations = binding.getBindingOperations();
        for (int i = 0; i < operations.size(); ++i) {
            BindingOperation operation = (BindingOperation) operations.get(i);
            Parameters parameters = (Parameters) portTypeInfo.get(operation.getOperation());

            // Get the soapAction from the <soap:operation>
            String soapAction = "";
            Iterator operationExtensibilityIterator = operation.getExtensibilityElements().iterator();
            for (; operationExtensibilityIterator.hasNext();) {
                Object obj = operationExtensibilityIterator.next();
                if (obj instanceof SOAPOperation) {
                    soapAction = ((SOAPOperation) obj).getSoapActionURI();
                    break;
                }
            }
            // Get the namespace for the operation from the <soap:body>
            String namespace = "";
            Iterator bindingInputIterator
                    = operation.getBindingInput().getExtensibilityElements().iterator();
            for (; bindingInputIterator.hasNext();) {
                Object obj = bindingInputIterator.next();
                if (obj instanceof SOAPBody) {
                    namespace = ((SOAPBody) obj).getNamespaceURI();
                    if (namespace == null)
View Full Code Here

                binding.getQName().getLocalPart() + "Skeleton" + "\"/>");

        String methodList = "";
        Iterator operationsIterator = binding.getBindingOperations().iterator();
        for (; operationsIterator.hasNext();) {
            BindingOperation op = (BindingOperation) operationsIterator.next();
            methodList = methodList + " " + op.getName();
        }

        deployPW.println("      <option name=\"methodName\" value=\"" + methodList + "\"/>");
    } //writeDeployBinding
View Full Code Here

            int inputBodyType = USE_ENCODED;
            int outputBodyType = USE_ENCODED;
            int faultBodyType = USE_ENCODED;
            List bindList = binding.getBindingOperations();
            for (Iterator opIterator = bindList.iterator(); opIterator.hasNext();) {
                BindingOperation bindOp = (BindingOperation) opIterator.next();

                // input
                Iterator inIter = bindOp.getBindingInput().getExtensibilityElements().iterator();
                for (; inIter.hasNext();) {
                    Object obj = inIter.next();
                    if (obj instanceof SOAPBody) {
                        String use = ((SOAPBody) obj).getUse();
                        if (use.equalsIgnoreCase("literal")) {
                            inputBodyType = USE_LITERAL;
                        }
                        else {
                            inputBodyType = USE_ENCODED;
                        }
                    }
                }
                // output
                Iterator outIter = bindOp.getBindingOutput().getExtensibilityElements().iterator();
                for (; outIter.hasNext();) {
                    Object obj = outIter.next();
                    if (obj instanceof SOAPBody) {
                        String use = ((SOAPBody) obj).getUse();
                        if (use.equalsIgnoreCase("literal")) {
                            if (use.equalsIgnoreCase("literal")) {
                                outputBodyType = USE_LITERAL;
                            }
                            else {
                                outputBodyType = USE_ENCODED;
                            }
                        }
                    }
                }
                // fault
                Iterator faultIter = bindOp.getBindingOutput().getExtensibilityElements().iterator();
                for (; faultIter.hasNext();) {
                    Object obj = faultIter.next();
                    if (obj instanceof SOAPBody) {
                        String use = ((SOAPBody) obj).getUse();
                        if (use.equalsIgnoreCase("literal")) {
                            if (use.equalsIgnoreCase("literal")) {
                                faultBodyType = USE_LITERAL;
                            }
                            else {
                                faultBodyType = USE_ENCODED;
                            }
                        }
                    }
                }
                // Associate the portType operation that goes with this binding
                // with the body types.
                attributes.put(bindOp.getOperation(),
                        new OperationAttr(inputBodyType, outputBodyType, faultBodyType));

            } // binding operations
        } // bindings
View Full Code Here

        Map<QName, List<ElementInfo>> wrappers = new HashMap<QName, List<ElementInfo>>();
        for (Operation op : interfaze.getOperations()) {
            javax.wsdl.Operation operation = generateOperation(definition, op, helpers, wrappers);
            portType.addOperation(operation);
            String action = ((JavaOperation)op).getAction();
            BindingOperation bindingOp = definitionGenerator.createBindingOperation(definition, operation, action);
            binding.addBindingOperation(bindingOp);
        }
        portType.setUndefined(false);
        definition.addPortType(portType);
        binding.setUndefined(false);
View Full Code Here

    @SuppressWarnings("unchecked")
    public void createBindingOperations(Definition definition, Binding binding, PortType portType) {
        try {
            for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) {
                Operation operation = (Operation)oi.next();
                BindingOperation bindingOperation = createBindingOperation(definition, operation, "");
                binding.addBindingOperation(bindingOperation);
            }
        } catch (WSDLException e) {
            throw new WSDLGenerationException(e);
        }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public BindingOperation createBindingOperation(Definition definition, Operation operation, String action)
        throws WSDLException {
        BindingOperation bindingOperation = definition.createBindingOperation();
        bindingOperation.setOperation(operation);
        configureBindingOperation(bindingOperation, operation);
        ExtensibilityElement operationExtension =
            definition.getExtensionRegistry().createExtension(BindingOperation.class, soapOperation);
        if (requiresSOAP12) {
            ((SOAP12Operation)operationExtension).setSoapActionURI(action);
        } else {
            ((SOAPOperation)operationExtension).setSoapActionURI(action);
        }
        bindingOperation.addExtensibilityElement(operationExtension);
        if (operation.getInput() != null) {
            BindingInput bindingInput = definition.createBindingInput();
            configureBindingInput(bindingInput, operation.getInput());
            ExtensibilityElement inputExtension =
                definition.getExtensionRegistry().createExtension(BindingInput.class, soapBody);
            if (requiresSOAP12) {
                ((SOAP12Body)inputExtension).setUse("literal");
            } else {
                ((SOAPBody)inputExtension).setUse("literal");
            }
            bindingInput.addExtensibilityElement(inputExtension);
            bindingOperation.setBindingInput(bindingInput);
        }
        if (operation.getOutput() != null) {
            BindingOutput bindingOutput = definition.createBindingOutput();
            configureBindingOutput(bindingOutput, operation.getOutput());
            ExtensibilityElement outputExtension =
                definition.getExtensionRegistry().createExtension(BindingOutput.class, soapBody);
            if (requiresSOAP12) {
                ((SOAP12Body)outputExtension).setUse("literal");
            } else {
                ((SOAPBody)outputExtension).setUse("literal");
            }
            bindingOutput.addExtensibilityElement(outputExtension);
            bindingOperation.setBindingOutput(bindingOutput);
        }
        for (Iterator fi = operation.getFaults().values().iterator(); fi.hasNext();) {
            Fault fault = (Fault)fi.next();
            BindingFault bindingFault = definition.createBindingFault();
            ExtensibilityElement faultExtension =
                definition.getExtensionRegistry().createExtension(BindingFault.class, soapFault);
            configureBindingFault(bindingFault, faultExtension, fault);
            bindingFault.addExtensibilityElement(faultExtension);
            bindingOperation.addBindingFault(bindingFault);
        }
        return bindingOperation;
    }
View Full Code Here

    }
    private static void createOperation(Definition def, PortType portType, boolean soap11, Binding binding) {
        List operations = portType.getOperations();
        for (Iterator iter = operations.iterator(); iter.hasNext();) {
            Operation operation = (Operation) iter.next();
            BindingOperation bindingOp = def.createBindingOperation();
            bindingOp.setName(operation.getName());
            if (soap11) {
                SOAPOperation op = new SOAPOperationImpl();
                op.setSoapActionURI("");
                bindingOp.addExtensibilityElement(op);
            } else {
                SOAP12Operation op = new SOAP12OperationImpl();
                op.setSoapActionURI("");
                bindingOp.addExtensibilityElement(op);
            }
            if (operation.getInput() != null) {
                BindingInput in = def.createBindingInput();
                in.setName(operation.getInput().getName());
                if (soap11) {
                    SOAPBody body = new SOAPBodyImpl();
                    body.setUse("literal");
                    in.addExtensibilityElement(body);
                } else {
                    SOAP12Body body = new SOAP12BodyImpl();
                    body.setUse("literal");
                    in.addExtensibilityElement(body);
                }
                bindingOp.setBindingInput(in);
            }
            if (operation.getOutput() != null) {
                BindingOutput out = def.createBindingOutput();
                out.setName(operation.getOutput().getName());
                if (soap11) {
                    SOAPBody body = new SOAPBodyImpl();
                    body.setUse("literal");
                    out.addExtensibilityElement(body);
                } else {
                    SOAP12Body body = new SOAP12BodyImpl();
                    body.setUse("literal");
                    out.addExtensibilityElement(body);
                }
                bindingOp.setBindingOutput(out);
            }
            for (Iterator itf = operation.getFaults().values().iterator(); itf
                    .hasNext();) {
                Fault fault = (Fault) itf.next();
                BindingFault bindingFault = def.createBindingFault();
                bindingFault.setName(fault.getName());
                if (soap11) {
                    SOAPFault soapFault = new SOAPFaultImpl();
                    soapFault.setUse("literal");
                    soapFault.setName(fault.getName());
                    bindingFault.addExtensibilityElement(soapFault);
                } else {
                    SOAP12Fault soapFault = new SOAP12FaultImpl();
                    soapFault.setUse("literal");
                    soapFault.setName(fault.getName());
                    bindingFault.addExtensibilityElement(soapFault);
                }
                bindingOp.addBindingFault(bindingFault);
            }
            binding.addBindingOperation(bindingOp);
        }
        def.addBinding(binding);
    }
View Full Code Here

            }
        }
        PortType wsdlPortType = wsdlBinding.getPortType();
        for (Iterator iter = wsdlPortType.getOperations().iterator(); iter.hasNext();) {
            Operation wsdlOperation = (Operation) iter.next();
            BindingOperation wsdlBindingOperation = wsdlBinding.getBindingOperation(wsdlOperation.getName(), null, null);
            SOAP12Operation wsdlSoapOperation = WSDLUtils.getExtension(wsdlBindingOperation, SOAP12Operation.class);
            Wsdl1SoapOperationImpl operation = new Wsdl1SoapOperationImpl();
            operation.setName(new QName(wsdlPortType.getQName().getNamespaceURI(), wsdlOperation.getName()));
            if (wsdlSoapOperation != null) {
                operation.setSoapAction(wsdlSoapOperation.getSoapActionURI());
                operation.setStyle(getStyle(wsdlSoapOperation.getStyle()));
            } else {
                operation.setSoapAction("");
            }
            if (operation.getStyle() == null) {
                operation.setStyle(binding.getStyle() != null ? binding.getStyle() : Style.DOCUMENT);
            }
            if (wsdlOperation.getStyle() == OperationType.ONE_WAY) {
                operation.setMep(JbiConstants.IN_ONLY);
            } else if (wsdlOperation.getStyle() == OperationType.REQUEST_RESPONSE) {
                operation.setMep(JbiConstants.IN_OUT);
            }
           
            // Create input
            createInput(operation, wsdlBindingOperation);
            // Create output
            createOutput(operation, wsdlBindingOperation);
            // Create faults
            Collection faults = wsdlOperation.getFaults().values();
            for (Iterator itFault = faults.iterator(); itFault.hasNext();) {
                Fault fault = (Fault) itFault.next();
                createFault(operation, wsdlBindingOperation.getBindingFaults().get(fault.getName()));
            }
            // Add operation
            binding.addOperation(operation);
        }
       
View Full Code Here

                error(Code.R2702, binding);
            }
           
            // R2706
            for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                BindingOperation bop = (BindingOperation) itBop.next();
                if (!ensureLiteral(bop)) {
                    error(Code.R2706, binding);
                    break;
                }
            }
           
            // R2705
            Style bindingStyle = null;
            for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                BindingOperation bop = (BindingOperation) itBop.next();
                SOAPOperation soapBop = WSDLUtils.getExtension(bop, SOAPOperation.class);
                Style opStyle = soapBop != null ? getStyle(soapBop.getStyle()) : null;
                if (opStyle == null) {
                    opStyle = getStyle(soapBinding.getStyle());
                    if (opStyle == null) {
                        opStyle = Style.DOCUMENT;
                    }
                }
                if (bindingStyle == null) {
                    bindingStyle = opStyle;
                } else if (bindingStyle != opStyle) {
                    error(Code.R2705, binding);
                    break;
                }
            }
           
            // R2201, R2204, R2209
            if (bindingStyle == Style.DOCUMENT) {
                for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                    BindingOperation bop = (BindingOperation) itBop.next();
                    validateDocLitBodyParts(binding,
                                            WSDLUtils.getExtension(bop.getBindingInput(), SOAPBody.class),
                                            bop.getOperation().getInput().getMessage());
                    validateDocLitBodyParts(binding,
                                            WSDLUtils.getExtension(bop.getBindingOutput(), SOAPBody.class),
                                            bop.getOperation().getOutput().getMessage());
                }
            }
           
            // R2203
            if (bindingStyle == Style.RPC) {
               
            }
           
            // R2205
            for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                BindingOperation bop = (BindingOperation) itBop.next();
                validateHeaderParts(binding,
                                    WSDLUtils.getExtensions(bop.getBindingInput(), SOAPHeader.class),
                                    bop.getOperation().getInput().getMessage());
                if (bop.getOperation().getOutput() != null) {
                    validateHeaderParts(binding,
                                        WSDLUtils.getExtensions(bop.getBindingOutput(), SOAPHeader.class),
                                        bop.getOperation().getOutput().getMessage());
                }
                /*
                for (BindingFault fault : getBindingFaults(bop)) {
                    validateFaultParts(binding,
                                       getExtension(fault, SOAPFault.class),
                                       bop.getOperation().getFault(fault.getName()).getMessage());
                }
                */
            }
           
            // R2716
            if (bindingStyle == Style.DOCUMENT) {
                for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                    BindingOperation bop = (BindingOperation) itBop.next();
                    if (!ensureNamespace(bop, false, false) || !ensureNamespace(bop, true, false)) {
                        error(Code.R2716, binding);
                        break;
                    }
                }
            }
            // R2717
            if (bindingStyle == Style.RPC) {
                for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                    BindingOperation bop = (BindingOperation) itBop.next();
                    if (!ensureNamespace(bop, true, true)) {
                        error(Code.R2717, binding);
                        break;
                    }
                }
            }
            // R2726
            if (bindingStyle == Style.RPC) {
                for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                    BindingOperation bop = (BindingOperation) itBop.next();
                    if (!ensureNamespace(bop, false, false)) {
                        error(Code.R2726, binding);
                        break;
                    }
                }
            }
           
            // R2718
            {
                Set<String> opNames = new HashSet<String>();
                for (Iterator itOp = binding.getPortType().getOperations().iterator(); itOp.hasNext();) {
                    opNames.add(((Operation) itOp.next()).getName());
                }
                Set<String> bopNames = new HashSet<String>();
                for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                    bopNames.add(((BindingOperation) itBop.next()).getName());
                }
                if (!opNames.equals(bopNames)) {
                    error(Code.R2718, binding);
                }
            }
           
            // R2720
            for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                BindingOperation bop = (BindingOperation) itBop.next();
                List<ElementExtensible> els = WSDLUtils.getElements(bop);
                boolean error = false;
                for (SOAPHeader sh : WSDLUtils.getExtensions(els, SOAPHeader.class)) {
                    error |= (sh.getPart() == null);
                    for (SOAPHeaderFault shf : WSDLUtils.getSOAPHeaderFaults(sh)) {
                        error |= (shf.getPart() == null);
                    }
                }
                if (error) {
                    error(Code.R2720, binding);
                }
            }
           
            // R2721, R2754
            for (Iterator itBop = binding.getBindingOperations().iterator(); itBop.hasNext();) {
                BindingOperation bop = (BindingOperation) itBop.next();
                for (BindingFault fault : WSDLUtils.getBindingFaults(bop)) {
                    for (SOAPFault sf : WSDLUtils.getExtensions(fault, SOAPFault.class)) {
                        if (sf.getName() == null) {
                            error(Code.R2721, binding);
                        } else if (!sf.getName().equals(fault.getName())) {
View Full Code Here

TOP

Related Classes of javax.wsdl.BindingOperation

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.