Package com.eviware.soapui.impl.wsdl

Examples of com.eviware.soapui.impl.wsdl.WsdlOperation


        putValue(Action.SHORT_DESCRIPTION, "Creates an empty SOAP response");
    }

    public void actionPerformed(ActionEvent e) {
        //FIXME for rest mocking action
        WsdlOperation operation = (WsdlOperation) mockResponse.getMockOperation().getOperation();

        if (operation == null) {
            UISupport.showErrorMessage("Missing operation for this mock response");
            return;
        }

        if (UISupport.confirm("Overwrite current response with empty one?", "Create Empty")) {
            WsdlInterface iface = operation.getInterface();
            mockResponse.setResponseContent(iface.getMessageBuilder().buildEmptyMessage());
        }
    }
View Full Code Here


        public Object getValueAt(int rowIndex, int columnIndex) {
            if (updatingInterface) {
                return "<updating>";
            }

            WsdlOperation operation = iface.getOperationAt(rowIndex);
            BindingOperation bindingOperation = operation.getBindingOperation();

            switch (columnIndex) {
                case 0:
                    return operation.getName();
                case 1: {
                    boolean in = WsdlUtils.isInputSoapEncoded(bindingOperation);
                    boolean out = operation.isUnidirectional() ? false : WsdlUtils.isOutputSoapEncoded(bindingOperation);

                    if (out && in) {
                        return "SOAP Encoding";
                    }
                    if (!out && !in) {
                        return "Literal";
                    }

                    return "Mixed";
                }
                case 3:
                    return operation.getAction();
                case 2:
                    return Boolean.valueOf(operation.isUnidirectional());
            }

            return null;
        }
View Full Code Here

            if (soapVersion == null) {
                throw new DispatchException("Unrecognized SOAP Version");
            }

            String soapAction = mockRequest.getSoapAction();
            WsdlOperation operation = null;

            if (SoapUtils.isSoapFault(mockRequest.getRequestContent(), soapVersion)) {
                // we should inspect fault detail and try to find matching operation
                // but not for now..
                WsdlMockOperation faultMockOperation = mockService.getFaultMockOperation();
View Full Code Here

        // TODO: move this code elsewhere when the rest counterpoint is in place
        if (mockService instanceof WsdlMockService) {
            WsdlMockService wsdlMockService = (WsdlMockService) mockService;

            for (int i = 0; i < mockService.getMockOperationCount(); i++) {
                WsdlOperation operation = wsdlMockService.getMockOperationAt(i).getOperation();
                if (operation != null) {
                    interfaces.add(operation.getInterface());
                }
            }
        }

        for (WsdlInterface iface : interfaces) {
View Full Code Here

            String requestContent = messageExchange.getRequestContent();
            wsdlContext.getSoapVersion().validateSoapEnvelope(requestContent, errors);

            if (errors.isEmpty() && !envelopeOnly) {
                wsdlContext.getSoapVersion().validateSoapEnvelope(requestContent, errors);
                WsdlOperation operation = messageExchange.getOperation();
                BindingOperation bindingOperation = operation.getBindingOperation();
                if (bindingOperation == null) {
                    errors.add(XmlError.forMessage("Missing operation [" + operation.getBindingOperationName()
                            + "] in wsdl definition"));
                } else {
                    Part[] inputParts = WsdlUtils.getInputParts(bindingOperation);
                    validateMessage(messageExchange, requestContent, bindingOperation, inputParts, errors, false);
                    // validateInputAttachments(request, errors, bindingOperation,
View Full Code Here

                }
            } else {
                wsdlContext.getSoapVersion().validateSoapEnvelope(response, errors);

                if (errors.isEmpty() && !envelopeOnly) {
                    WsdlOperation operation = messageExchange.getOperation();
                    BindingOperation bindingOperation = operation.getBindingOperation();
                    if (bindingOperation == null) {
                        errors.add(XmlError.forMessage("Missing operation [" + operation.getBindingOperationName()
                                + "] in wsdl definition"));
                    } else {
                        Part[] outputParts = WsdlUtils.getOutputParts(bindingOperation);
                        validateMessage(messageExchange, response, bindingOperation, outputParts, errors, true);
                    }
View Full Code Here

        QName contentQName = XmlUtils.getQName(contentElm.getDomNode());
        NodeList contentChildNodes = null;

        for (int c = 0; c < operations.size(); c++) {
            WsdlOperation wsdlOperation = operations.get(c);
            String action = wsdlOperation.getAction();

            // matches soapAction?
            if (!requireSoapActionMatch
                    || ((soapAction == null && wsdlOperation.getAction() == null) || (action != null && action
                    .equals(soapAction)))) {
                QName qname = wsdlOperation.getRequestBodyElementQName();

                if (!contentQName.equals(qname)) {
                    continue;
                }

                SoapVersion ifaceSoapVersion = wsdlOperation.getInterface().getSoapVersion();

                if (requireSoapVersionMatch && ifaceSoapVersion != soapVersion) {
                    continue;
                }

                // check content
                if (wsdlOperation.getStyle().equals(WsdlOperation.STYLE_DOCUMENT)) {
                    // check that all attachments match
                    BindingOperation bindingOperation = wsdlOperation.getBindingOperation();
                    Message message = bindingOperation.getOperation().getInput().getMessage();
                    List<Part> parts = message.getOrderedParts(null);

                    for (int x = 0; x < parts.size(); x++) {
                        // check for attachment part
                        if (WsdlUtils.isAttachmentInputPart(parts.get(x), bindingOperation)) {
                            for (Attachment attachment : attachments) {
                                if (attachment.getPart().equals(parts.get(x).getName())) {
                                    parts.remove(x);
                                    x--;
                                }
                            }
                        } else {
                            parts.remove(x);
                            x--;
                        }
                    }

                    // matches!
                    if (parts.isEmpty()) {
                        return wsdlOperation;
                    }
                } else if (wsdlOperation.getStyle().equals(WsdlOperation.STYLE_RPC)) {
                    BindingOperation bindingOperation = wsdlOperation.getBindingOperation();
                    Message message = bindingOperation.getOperation().getInput().getMessage();
                    List<Part> parts = message.getOrderedParts(null);

                    if (contentChildNodes == null) {
                        contentChildNodes = XmlUtils.getChildElements((Element) contentElm.getDomNode());
View Full Code Here

        QName contentQName = XmlUtils.getQName(contentElm.getDomNode());
        NodeList contentChildNodes = null;

        for (int c = 0; c < operations.size(); c++) {
            WsdlOperation wsdlOperation = operations.get(c);
            String action = wsdlOperation.getAction();

            // matches soapAction?
            if (!requireSoapActionMatch
                    || ((soapAction == null && wsdlOperation.getAction() == null) || (action != null && action
                    .equals(soapAction)))) {
                QName qname = wsdlOperation.getResponseBodyElementQName();

                if (!contentQName.equals(qname)) {
                    continue;
                }

                SoapVersion ifaceSoapVersion = wsdlOperation.getInterface().getSoapVersion();

                if (requireSoapVersionMatch && ifaceSoapVersion != soapVersion) {
                    continue;
                }

                // check content
                if (wsdlOperation.getStyle().equals(WsdlOperation.STYLE_DOCUMENT)) {
                    // matches!
                    return wsdlOperation;
                } else if (wsdlOperation.getStyle().equals(WsdlOperation.STYLE_RPC)) {
                    BindingOperation bindingOperation = wsdlOperation.getBindingOperation();
                    Message message = bindingOperation.getOperation().getOutput().getMessage();
                    List<Part> parts = message.getOrderedParts(null);

                    if (contentChildNodes == null) {
                        contentChildNodes = XmlUtils.getChildElements((Element) contentElm.getDomNode());
View Full Code Here

    public OpenRequestForMockResponseAction() {
        super("Open Request", "Opens/Creates a request for this MockResponse with correct endpoint");
    }

    public void perform(WsdlMockResponse mockResponse, Object param) {
        WsdlOperation operation = mockResponse.getMockOperation().getOperation();
        if (operation == null) {
            UISupport.showErrorMessage("Missing operation for this mock response");
            return;
        }

        String[] names = ModelSupport.getNames(operation.getRequestList(), new String[]{"-> Create New"});

        if (operation.getInterface().getProject().isEnvironmentMode()) {
            UISupport.showInfoMessage("Do you wish to activate the Default Environment?");
        } else {
            String name = (String) UISupport.prompt("Select Request for Operation [" + operation.getName() + "] "
                    + "to open or create", "Open Request", names);
            if (name != null) {
                WsdlRequest request = operation.getRequestByName(name);
                if (request == null) {
                    name = UISupport.prompt("Specify name of new request", "Open Request",
                            "Request " + (operation.getRequestCount() + 1));
                    if (name == null) {
                        return;
                    }

                    boolean createOptional = operation.getSettings().getBoolean(
                            WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS);
                    if (!createOptional) {
                        createOptional = UISupport.confirm("Create optional elements from schema?", "Create Request");
                    }

                    request = operation.addNewRequest(name);
                    String requestContent = operation.createRequest(createOptional);
                    if (requestContent != null) {
                        request.setRequestContent(requestContent);
                    }
                }
View Full Code Here

    private Set<WsdlInterface> getRequiredInterfaces(WsdlMockService mockService, WsdlProject targetProject) {
        Set<WsdlInterface> requiredInterfaces = new HashSet<WsdlInterface>();

        for (int i = 0; i < mockService.getMockOperationCount(); i++) {
            WsdlOperation operation = mockService.getMockOperationAt(i).getOperation();
            if (operation != null) {
                requiredInterfaces.add(operation.getInterface());
            }
        }

        if (requiredInterfaces.size() > 0 && targetProject.getInterfaceCount() > 0) {
            Map<String, WsdlInterface> bindings = new HashMap<String, WsdlInterface>();
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.WsdlOperation

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.