Package javax.wsdl

Examples of javax.wsdl.Operation


    wsdlParser = new WSDLParser(wsdlDefinition);
  }

  public void testParse() throws Exception
  {
    Operation op = wsdlParser.getDocLitOperation(serviceName, portName, messageElementName);
    assertNotNull(op);

    System.out.println("WSDL Operation: " +op.getName());
  }
View Full Code Here


    public boolean checkR2201() {
        for (PortType portType : wsdlHelper.getPortTypes(def)) {
            Iterator ite = portType.getOperations().iterator();
            while (ite.hasNext()) {
                Operation operation = (Operation)ite.next();
                if (isOverloading(operation.getName())) {
                    continue;
                }
                BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
                Binding binding = wsdlHelper.getBinding(bop, def);
                String bindingStyle = binding != null ? wsdlHelper.getBindingStyle(binding) : "";

                String style = "".equals(wsdlHelper.getSOAPOperationStyle(bop))
                    ? bindingStyle : wsdlHelper.getSOAPOperationStyle(bop);

                if ("DOCUMENT".equalsIgnoreCase(style)) {
                    List<Part> partsList = wsdlHelper.getInMessageParts(operation);
                    int inmessagePartsCount = partsList.size();
                    SOAPBody soapBody = wsdlHelper.getBindingInputSOAPBody(bop);
                    if (soapBody != null) {
                        List parts = soapBody.getParts();
                        int boundPartSize = parts == null ? inmessagePartsCount : parts.size();
                        SOAPHeader soapHeader = wsdlHelper.getBindingInputSOAPHeader(bop);
                        boundPartSize = soapHeader != null
                                        && soapHeader.getMessage().equals(
                                                                          operation.getInput().getMessage()
                                                                              .getQName())
                            ? boundPartSize - 1 : boundPartSize;

                        if (parts != null) {
                            Iterator partsIte = parts.iterator();
                            while (partsIte.hasNext()) {
                                String partName = (String)partsIte.next();
                                boolean isDefined = false;
                                for (Part part : partsList) {
                                    if (partName.equalsIgnoreCase(part.getName())) {
                                        isDefined = true;
                                        break;
                                    }
                                }
                                if (!isDefined) {
                                    addErrorMessage("opartion: " + operation.getName() + "  soapBody parts : "
                                                    + partName + " not found in the message, wrong WSDL");
                                    return false;
                                }

                            }
                        }

                        if (boundPartSize > 1) {
                            addErrorMessage("operation:" + operation.getName()
                                            + " more than one part bound to body");
                            return false;
                        }
                    }

                    int outmessagePartsCount = wsdlHelper.getOutMessageParts(operation).size();
                    soapBody = wsdlHelper.getBindingOutputSOAPBody(bop);
                    if (soapBody != null) {
                        List parts = soapBody.getParts();
                        int boundPartSize = parts == null ? outmessagePartsCount : parts.size();
                        SOAPHeader soapHeader = wsdlHelper.getBindingOutputSOAPHeader(bop);
                        boundPartSize = soapHeader != null
                                        && soapHeader.getMessage().equals(
                                                                          operation.getOutput().getMessage()
                                                                              .getQName())
                            ? boundPartSize - 1 : boundPartSize;
                        if (parts != null) {
                            Iterator partsIte = parts.iterator();
                            while (partsIte.hasNext()) {
                                String partName = (String)partsIte.next();
                                boolean isDefined = false;
                                for (Part part : wsdlHelper.getOutMessageParts(operation)) {
                                    if (partName.equalsIgnoreCase(part.getName())) {
                                        isDefined = true;
                                        break;
                                    }
                                }
                                if (!isDefined) {
                                    addErrorMessage("opartion: " + operation.getName() + "  soapBody parts : "
                                                    + partName + " not found in the message, wrong WSDL");
                                    return false;
                                }

                            }
                        }

                        if (boundPartSize > 1) {
                            addErrorMessage("operation:" + operation.getName()
                                            + " more than one part bound to body");
                            return false;
                        }
                    }
                }
View Full Code Here

            String style = wsdlHelper.getCanonicalBindingStyle(binding);

            //

            for (Iterator ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext();) {
                Operation operation = (Operation)ite2.next();
                if (operation.getInput() != null && operation.getInput().getMessage() != null) {
                    Message inMess = operation.getInput().getMessage();

                    for (Iterator ite3 = inMess.getParts().values().iterator(); ite3.hasNext();) {
                        Part p = (Part)ite3.next();
                        if (style.equalsIgnoreCase(SOAPBinding.Style.RPC.name()) && p.getTypeName() == null) {
                            addErrorMessage("An rpc-literal binding in a DESCRIPTION MUST refer, "
                                            + "in its soapbind:body element(s), only to "
                                            + "wsdl:part element(s) that have been defined "
                                            + "using the type attribute.");
                            return false;
                        }

                        if (style.equalsIgnoreCase(SOAPBinding.Style.DOCUMENT.name())
                            && p.getElementName() == null) {
                            addErrorMessage("A document-literal binding in a DESCRIPTION MUST refer, "
                                            + "in each of its soapbind:body element(s),"
                                            + "only to wsdl:part element(s)"
                                            + " that have been defined using the element attribute.");
                            return false;
                        }

                    }
                }
                if (operation.getOutput() != null && operation.getOutput().getMessage() != null) {
                    Message outMess = operation.getOutput().getMessage();
                    for (Iterator ite3 = outMess.getParts().values().iterator(); ite3.hasNext();) {
                        Part p = (Part)ite3.next();
                        if (style.equalsIgnoreCase(SOAPBinding.Style.RPC.name()) && p.getTypeName() == null) {
                            addErrorMessage("An rpc-literal binding in a DESCRIPTION MUST refer, "
                                            + "in its soapbind:body element(s), only to "
View Full Code Here

                                                              + " is not defined");

                        isValid = false;

                    } else {
                        Operation op = operationMap.get(bopName);

                        if (op.getInput() == null && bop.getBindingInput() != null) {
                            Node errNode = ErrNodeLocator.getNode(document, WSDLConstants.QNAME_BINDING,
                                                                  bindingName.getLocalPart(), bop.getName());
                            schemaWSDLValidator.addError(errNode, "BindingOperation " + bop.getName()
                                                                  + " binding input is not defined");
                            isValid = false;
                        }

                        if (op.getInput() != null && bop.getBindingInput() == null) {
                            Node errNode = ErrNodeLocator.getNode(document, WSDLConstants.QNAME_BINDING,
                                                                  bindingName.getLocalPart(), bop.getName());
                            schemaWSDLValidator.addError(errNode, "BindingOperation " + bop.getName()
                                                                  + " binding input is not resolved");

                            isValid = false;
                        }

                        if (op.getOutput() == null && bop.getBindingOutput() != null) {
                            Node errNode = ErrNodeLocator.getNode(document, WSDLConstants.QNAME_BINDING,
                                                                  bindingName.getLocalPart(), bop.getName());
                            schemaWSDLValidator.addError(errNode, "BindingOperation " + bop.getName()
                                                                  + " binding output is not defined");
                            isValid = false;
                        }

                        if (op.getOutput() != null && bop.getBindingOutput() == null) {
                            Node errNode = ErrNodeLocator.getNode(document, WSDLConstants.QNAME_BINDING,
                                                                  bindingName.getLocalPart(), bop.getName());
                            schemaWSDLValidator.addError(errNode, "BindingOperation " + bop.getName()
                                                                  + " binding output is not resolved");

                            isValid = false;
                        }

                        if (op.getFaults().size() != bop.getBindingFaults().size()) {
                            Node errNode = ErrNodeLocator.getNode(document, WSDLConstants.QNAME_BINDING,
                                                                  bindingName.getLocalPart(), bop.getName());
                            schemaWSDLValidator.addError(errNode, "BindingOperation " + bop.getName()
                                                                  + " binding fault resolved error");
                            isValid = false;
View Full Code Here

                    Node opNameNode = n.getAttributes().getNamedItem(WSDLConstants.ATTR_NAME);
                    String opName = opNameNode.getNodeValue();
                    List operations = portType.getOperations();
                    Iterator ite2 = operations.iterator();
                    while (ite2.hasNext()) {
                        Operation operation = (Operation)ite2.next();
                        if (operation.getName().equals(opName)) {

                            operationMap.put(new QName(tns, opName), operation);
                            Input input = operation.getInput();
                            if (input != null && input.getMessage() != null
                                && !msgPartsMap.containsKey(input.getMessage().getQName())) {
                                Node errNode = ErrNodeLocator.getNode(document,
                                                                      WSDLConstants.QNAME_OPERATION,
                                                                      operation.getName(), input.getName());
                                schemaWSDLValidator.addError(errNode, " input : " + input.getName()
                                                                      + " reference is not defined");
                                isValid = false;
                            }

                            Output output = operation.getOutput();
                            if (output != null && output.getMessage() != null
                                && !msgPartsMap.containsKey(output.getMessage().getQName())) {
                                Node errNode = ErrNodeLocator.getNode(document,
                                                                      WSDLConstants.QNAME_OPERATION,
                                                                      operation.getName(), output.getName());
                                schemaWSDLValidator.addError(errNode, " output : " + output.getName()
                                                                      + " reference is not defined");
                                isValid = false;
                            }

                            Map faultMap = operation.getFaults();
                            Iterator faultIte = faultMap.values().iterator();
                            while (faultIte.hasNext()) {
                                Fault fault = (Fault)faultIte.next();
                                if (fault != null && fault.getMessage() != null
                                    && !msgPartsMap.containsKey(fault.getMessage().getQName())) {
                                    Node errNode = getErrorNode(document, WSDLConstants.QNAME_OPERATION,
                                                                operation.getName(), fault.getName());
                                    addError(errNode, " fault : " + fault.getName()
                                                      + " reference is not defined");
                                    isValid = false;
                                }
View Full Code Here

    private boolean checkXMLFormat(Binding binding) {
        List<BindingOperation> bos = binding.getBindingOperations();
        boolean result = true;
        boolean needRootNode = false;
        for (BindingOperation bo : bos) {
            Operation op = binding.getPortType().getOperation(bo.getName(), null, null);
            needRootNode = false;
            if (op.getInput().getMessage().getParts().size() == 0
                || op.getInput().getMessage().getParts().size() > 1) {
                needRootNode = true;
            }
            if (needRootNode) {
                String path = "Binding(" + binding.getQName().getLocalPart()
                              + "):BindingOperation(" + bo.getName() + ")";
                Iterator itIn = bo.getBindingInput().getExtensibilityElements().iterator();
                if (findXMLFormatRootNode(itIn, bo, path + "-input")) {
                    // Input check correct, continue to check output binding
                    needRootNode = false;
                    if (op.getOutput().getMessage().getParts().size() == 0
                        || op.getOutput().getMessage().getParts().size() > 1) {
                        needRootNode = true;
                    }
                    if (needRootNode) {
                        Iterator itOut = bo.getBindingInput().getExtensibilityElements().iterator();
                        result = result
View Full Code Here

            }
        }
        return true;
    }
    private Message getMessage(boolean isInput) {
        Operation operation = bindingOp.getOperation();
        if (operation == null) {
            return null;
        }

        if (isInput) {
            final Input input = operation.getInput();
            return input == null ? null : input.getMessage();
        }
        final Output output = operation.getOutput();
        return output == null ? null : output.getMessage();
    }
View Full Code Here

    private synchronized void initParams() {
        List<OperationWebParam> parms = new ArrayList<OperationWebParam>();
        Map<String, OperationWebParam> parmMap = new HashMap<String, OperationWebParam>();
       
        Operation operation = bindingOp.getOperation();
        if (operation != null) {
            SOAPBinding.Style st = getSOAPStyle();
           
            if (st == SOAPBinding.Style.RPC) {
                initRPCLitParam(parms, parmMap, operation);
            } else {
                // DOC style
                if (isDocLitWrapped()) {
                    initDocLitWrappedParam(parms, parmMap, operation);
                } else {
                    initDocLitBareParam(parms, parmMap, operation);
                }
            }

            // Set the header flags
            BindingInput bindingInput = bindingOp.getBindingInput();
            if (bindingInput != null) {
                javax.wsdl.Message message = operation.getInput().getMessage();
                List elements = bindingInput.getExtensibilityElements();
                for (Iterator i = elements.iterator(); i.hasNext();) {
                    Object extensibilityElement = i.next();
                    Part part = getPartFromSOAPHeader(message, extensibilityElement);
                    if (part != null) {
                        OperationWebParam p = parmMap.get(part.getName());
                        if (p != null) {
                            p.setHeader(true);
                        }
                    }
                }
            }           
            BindingOutput bindingOutput = bindingOp.getBindingOutput();
            if (bindingOutput != null) {
                javax.wsdl.Message message = operation.getOutput().getMessage();
                List elements = bindingOutput.getExtensibilityElements();
                for (Iterator i = elements.iterator(); i.hasNext();) {
                    Object extensibilityElement = i.next();
                    Part part = getPartFromSOAPHeader(message, extensibilityElement);
                    if (part != null) {
View Full Code Here

                break;
            }
        }
        if (definition != null && port != null) {
            for (Iterator it = port.getOperations().iterator(); it.hasNext();) {
                Operation opt = (Operation)it.next();
                String name = "Operation: " + opt.getName();
                strList.add(name);
            }               
        }
        String[] strings = new String[strList.size()];
        return strList.toArray(strings);
View Full Code Here

        Message msg = null;
        while (ite.hasNext()) {
            PortType portType = (PortType)ite.next();
            Iterator ite1 = portType.getOperations().iterator();
            while (ite1.hasNext()) {
                Operation op = (Operation)ite1.next();
                if (operationName.equals(op.getName())) {
                    if (isIn) {
                        msg = op.getInput().getMessage();
                    } else {
                        msg = op.getOutput().getMessage();
                    }
                    break;
                }
            }
        }
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.