Examples of WSDLEndpoint


Examples of org.apache.synapse.endpoints.WSDLEndpoint

        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement
                = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);
       
        WSDLEndpoint wsdlEndpoint = (WSDLEndpoint) endpoint;

        // serialize the parameters
        serializeProperties(wsdlEndpoint, endpointElement);

        serializeCommonAttributes(endpoint,endpointElement);
       

        OMElement wsdlElement = fac.createOMElement("wsdl", SynapseConstants.SYNAPSE_OMNAMESPACE);
        String serviceName = wsdlEndpoint.getServiceName();
        if (serviceName != null) {
            wsdlElement.addAttribute("service", serviceName, null);
        }

        String portName = wsdlEndpoint.getPortName();
        if (portName != null) {
            wsdlElement.addAttribute("port", portName, null);
        }

        String uri = wsdlEndpoint.getWsdlURI();
        if (uri != null) {
            wsdlElement.addAttribute("uri", uri, null);
        }

        OMElement wsdlDoc = wsdlEndpoint.getWsdlDoc();
        if (wsdlDoc != null) {
            wsdlElement.addChild(wsdlDoc);
        }

        // currently, we have to get QOS information from the endpoint definition and set them as
        // special elements under the wsdl element. in future, these information should be
        // extracted from the wsdl.
        EndpointDefinition epDefinition = wsdlEndpoint.getDefinition();
        EndpointDefinitionSerializer serializer = new EndpointDefinitionSerializer();
        serializer.serializeEndpointDefinition(epDefinition, wsdlElement);
        serializeSpecificEndpointProperties(epDefinition, wsdlElement);
        endpointElement.addChild(wsdlElement);
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

        OMElement config2 = serializer.serializeMediator(null, send1);
        SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());

        assertTrue("Top level endpoint should be a WSDL endpoint.",
                send1.getEndpoint() instanceof WSDLEndpoint);
        WSDLEndpoint ep1 = (WSDLEndpoint) send1.getEndpoint();

        assertTrue("Top level endpoint should be a WSDL endpoint.",
                send2.getEndpoint() instanceof WSDLEndpoint);
        WSDLEndpoint ep2 = (WSDLEndpoint) send2.getEndpoint();

        assertEquals("Service name is not serialized properly.",
                ep1.getServiceName(), ep2.getServiceName());

        assertEquals("Port name is not serialized properly", ep1.getPortName(), ep2.getPortName());

        assertEquals("WSDL URI is not serialized properly", ep1.getWsdlURI(), ep2.getWsdlURI());

        assertEquals(
                "Addressing information is not serialized properly",
                ep1.getDefinition().isAddressingOn(),
                ep2.getDefinition().isAddressingOn());
    }
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

                        String msg = "Mulformed URL in address endpoint";
                        log.error(msg);
                        throw new SynapseException(msg);
                    }
                } else if (e instanceof WSDLEndpoint) {
                    WSDLEndpoint wsdlEndpoint = (WSDLEndpoint) e;
                    try {
                        url = new URL(wsdlEndpoint.getDefinition().getAddress());
                    } catch (MalformedURLException e1) {
                        String msg = "Mulformed URL in address endpoint";
                        log.error(msg);
                        throw new SynapseException(msg);
                    }
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

    }

    protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint,
                                      Properties properties) {

        WSDLEndpoint wsdlEndpoint = new WSDLEndpoint();
        OMAttribute name = epConfig.getAttribute(new QName(
                org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE, "name"));

        if (name != null) {
            wsdlEndpoint.setName(name.getAttributeValue());
        }

        processProperties(wsdlEndpoint, epConfig);

        OMElement wsdlElement = epConfig.getFirstChildWithName
                (new QName(SynapseConstants.SYNAPSE_NAMESPACE, "wsdl"));
        if (wsdlElement != null) {

            EndpointDefinition endpoint = null;

            // get the service name and port name. at this point we should not worry about
            // the presence of those parameters. they are handled by corresponding WSDL builders.
            String serviceName = wsdlElement.getAttributeValue(new QName("service"));
            String portName = wsdlElement.getAttributeValue(new QName("port"));
            // check if wsdl is supplied as a URI
            String wsdlURI = wsdlElement.getAttributeValue(new QName("uri"));

            // set serviceName and portName in the endpoint. it does not matter if these are
            // null at this point. we are setting them only for serialization purpose.
            wsdlEndpoint.setServiceName(serviceName);
            wsdlEndpoint.setPortName(portName);

            if (wsdlURI != null) {

                wsdlEndpoint.setWsdlURI(wsdlURI.trim());
                try {
                    OMNode wsdlOM = SynapseConfigUtils.getOMElementFromURL(new URL(wsdlURI)
                            .toString(), properties.get(SynapseConstants.SYNAPSE_HOME) != null ?
                            properties.get(SynapseConstants.SYNAPSE_HOME).toString() : "");
                    if (wsdlOM != null && wsdlOM instanceof OMElement) {
                        OMElement omElement = (OMElement) wsdlOM;
                        OMNamespace ns = omElement.getNamespace();
                        if (ns != null) {
                            String nsUri = omElement.getNamespace().getNamespaceURI();
                            if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(nsUri)) {

                                endpoint = new WSDL11EndpointBuilder().
                                        createEndpointDefinitionFromWSDL(
                                                wsdlURI.trim(), omElement, serviceName, portName);

                            } else if (WSDL2Constants.WSDL_NAMESPACE.equals(nsUri)) {
                                //endpoint = new WSDL20EndpointBuilder().
                                // createEndpointDefinitionFromWSDL(wsdlURI, serviceName, portName);

                                handleException("WSDL 2.0 Endpoints are currently not supported");
                            }
                        }
                    }
                } catch (Exception e) {
                    handleException("Couldn't create endpoint from the given WSDL URI : "
                            + e.getMessage(), e);
                }
            }

            // check if the wsdl 1.1 document is supplied inline
            OMElement definitionElement = wsdlElement.getFirstChildWithName
                    (new QName(org.apache.axis2.namespace.Constants.NS_URI_WSDL11, "definitions"));
            if (endpoint == null && definitionElement != null) {
                wsdlEndpoint.setWsdlDoc(definitionElement);

                String resolveRoot = properties.get(SynapseConstants.RESOLVE_ROOT).toString();
//                String resolveRoot = SynapseConfigUtils.getResolveRoot();
                String baseUri = "file:./";
                if (resolveRoot != null) {
                    baseUri = resolveRoot.trim();
                }
                if (!baseUri.endsWith(File.separator)) {
                    baseUri = baseUri + File.separator;
                }
                endpoint = new WSDL11EndpointBuilder().createEndpointDefinitionFromWSDL(
                        baseUri, definitionElement, serviceName, portName);
            }

            // check if a wsdl 2.0 document is supplied inline
            OMElement descriptionElement = wsdlElement.getFirstChildWithName
                    (new QName(org.apache.axis2.namespace.Constants.NS_URI_WSDL11, "description"));
            if (endpoint == null && descriptionElement != null) {
                handleException("WSDL 2.0 Endpoints are currently not supported.");
            }

            if (endpoint != null) {
                // for now, QOS information has to be provided explicitly.
                extractCommonEndpointProperties(endpoint, wsdlElement);
                extractSpecificEndpointProperties(endpoint, wsdlElement);
                wsdlEndpoint.setDefinition(endpoint);                  
                processAuditStatus(endpoint, wsdlEndpoint.getName(), wsdlElement);
            } else {
                handleException("WSDL is not specified for WSDL endpoint.");
            }
        }
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement
                = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);
       
        WSDLEndpoint wsdlEndpoint = (WSDLEndpoint) endpoint;

        // serialize the parameters
        serializeProperties(wsdlEndpoint, endpointElement);

        serializeCommonAttributes(endpoint,endpointElement);
       

        OMElement wsdlElement = fac.createOMElement("wsdl", SynapseConstants.SYNAPSE_OMNAMESPACE);
        String serviceName = wsdlEndpoint.getServiceName();
        if (serviceName != null) {
            wsdlElement.addAttribute("service", serviceName, null);
        }

        String portName = wsdlEndpoint.getPortName();
        if (portName != null) {
            wsdlElement.addAttribute("port", portName, null);
        }

        String uri = wsdlEndpoint.getWsdlURI();
        if (uri != null) {
            wsdlElement.addAttribute("uri", uri, null);
        }

        OMElement wsdlDoc = wsdlEndpoint.getWsdlDoc();
        if (wsdlDoc != null) {
            wsdlElement.addChild(wsdlDoc);
        }

        // currently, we have to get QOS information from the endpoint definition and set them as
        // special elements under the wsdl element. in future, these information should be
        // extracted from the wsdl.
        EndpointDefinition epDefinition = wsdlEndpoint.getDefinition();
        serializeCommonEndpointProperties(epDefinition, wsdlElement);
        serializeSpecificEndpointProperties(epDefinition, wsdlElement);
        endpointElement.addChild(wsdlElement);

        return endpointElement;
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

        return null;
    }

    public Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint) {

        WSDLEndpoint wsdlEndpoint = new WSDLEndpoint();

        if (!anonymousEndpoint) {
            OMAttribute name = epConfig.getAttribute(new QName(
                    org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE, "name"));

            if (name != null) {
                wsdlEndpoint.setName(name.getAttributeValue());
            }
        }

        OMElement wsdlElement = epConfig.getFirstChildWithName
                (new QName(SynapseConstants.SYNAPSE_NAMESPACE, "wsdl"));

        if (wsdlElement != null) {

            // set the suspend on fail duration.
            OMElement suspendElement = wsdlElement.getFirstChildWithName(new QName(
                    SynapseConstants.SYNAPSE_NAMESPACE,
                    org.apache.synapse.config.xml.XMLConfigConstants.SUSPEND_DURATION_ON_FAILURE));

            if (suspendElement != null) {
                String suspend = suspendElement.getText();

                try {
                    if (suspend != null) {
                        long suspendDuration = Long.parseLong(suspend.trim());
                        wsdlEndpoint.setSuspendOnFailDuration(suspendDuration * 1000);
                    }

                } catch (NumberFormatException e) {
                    handleException("suspendDurationOnFailure should be valid number.");
                }
            }

            EndpointDefinition endpoint = null;

            // get the service name and port name. at this point we should not worry about the presence
            // of those parameters. they are handled by corresponding WSDL builders.
            String serviceName = wsdlElement.getAttributeValue
                    (new QName(org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE,"service"));

            String portName = wsdlElement.getAttributeValue
                    (new QName(org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE,"port"));

            // check if wsdl is supplied as a URI
            String wsdlURI = wsdlElement.getAttributeValue
                    (new QName(org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE,"uri"));

            // set serviceName and portName in the endpoint. it does not matter if these are
            // null at this point. we are setting them only for serialization purpose.
            wsdlEndpoint.setServiceName(serviceName);
            wsdlEndpoint.setPortName(portName);

            if (wsdlURI != null) {

                wsdlEndpoint.setWsdlURI(wsdlURI.trim());
                try {
                    OMElement wsdlOM = SynapseConfigUtils.getOMElementFromURL(
                        new URL(wsdlURI).toString());
                    if (wsdlOM != null) {
                        OMNamespace ns = wsdlOM.getNamespace();
                        if (ns != null) {
                            String nsUri = wsdlOM.getNamespace().getNamespaceURI();
                            if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(nsUri)) {
                                endpoint = new WSDL11EndpointBuilder().
                                    createEndpointDefinitionFromWSDL(wsdlOM, serviceName, portName);

                            } else if (WSDL2Constants.WSDL_NAMESPACE.equals(nsUri)) {
                                //endpoint = new WSDL20EndpointBuilder().
                                //        createEndpointDefinitionFromWSDL(wsdlURI, serviceName, portName);

                                handleException("WSDL 2.0 Endpoints are currently not supported");
                            }
                        }
                    }
                } catch (Exception e) {
                    handleException("Couldn't create endpoint from the given WSDL URI : "
                        + e.getMessage(), e);
                }
            }

            // check if the wsdl 1.1 document is suppled inline
            OMElement definitionElement = wsdlElement.getFirstChildWithName
                    (new QName(org.apache.axis2.namespace.Constants.NS_URI_WSDL11, "definitions"));
            if (endpoint == null && definitionElement != null) {
                wsdlEndpoint.setWsdlDoc(definitionElement);

                endpoint = new WSDL11EndpointBuilder().
                        createEndpointDefinitionFromWSDL(definitionElement, serviceName, portName);
            }

            // check if a wsdl 2.0 document is supplied inline
            OMElement descriptionElement = wsdlElement.getFirstChildWithName
                    (new QName(org.apache.axis2.namespace.Constants.NS_URI_WSDL11, "description"));
            if (endpoint == null && descriptionElement != null) {
                wsdlEndpoint.setWsdlDoc(descriptionElement);
                handleException("WSDL 2.0 Endpoints are currently not supported.");
            }
            if (endpoint != null) {
                // for now, QOS information has to be provided explicitly.
                extractQOSInformation(endpoint, wsdlElement);
                OMAttribute statistics = epConfig.getAttribute(
                        new QName(org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE,
                                org.apache.synapse.config.xml.XMLConfigConstants.STATISTICS_ATTRIB_NAME));
                if (statistics != null) {
                    String statisticsValue = statistics.getAttributeValue();
                    if (statisticsValue != null) {
                        if (org.apache.synapse.config.xml.XMLConfigConstants.STATISTICS_ENABLE.equals(
                                statisticsValue)) {
                            endpoint.setStatisticsState(org.apache.synapse.SynapseConstants.STATISTICS_ON);
                        } else if (org.apache.synapse.config.xml.XMLConfigConstants.STATISTICS_DISABLE.equals(
                                statisticsValue)) {
                            endpoint.setStatisticsState(org.apache.synapse.SynapseConstants.STATISTICS_OFF);
                        }
                    }
                }
                wsdlEndpoint.setEndpoint(endpoint);
            } else {
                handleException("WSDL is not specified for WSDL endpoint.");
            }
        }

View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

        }

        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);

        WSDLEndpoint wsdlEndpoint = (WSDLEndpoint) endpoint;
        String name = wsdlEndpoint.getName();
        if (name != null) {
            endpointElement.addAttribute("name", name, null);
        }

        OMElement wsdlElement = fac.createOMElement("wsdl", SynapseConstants.SYNAPSE_OMNAMESPACE);
        String serviceName = wsdlEndpoint.getServiceName();
        if (serviceName != null) {
            wsdlElement.addAttribute("service", serviceName, null);
        }

        String portName = wsdlEndpoint.getPortName();
        if (portName != null) {
            wsdlElement.addAttribute("port", portName, null);
        }

        String uri = wsdlEndpoint.getWsdlURI();
        if (uri != null) {
            wsdlElement.addAttribute("uri", uri, null);
        }

        OMElement wsdlDoc = wsdlEndpoint.getWsdlDoc();
        if (wsdlDoc != null) {
            wsdlElement.addChild(wsdlDoc);
        }

        long suspendDuration = wsdlEndpoint.getSuspendOnFailDuration();
        if (suspendDuration != -1) {
            // user has set some value for this. let's serialize it.

            OMElement suspendElement = fac.createOMElement(
                    org.apache.synapse.config.xml.XMLConfigConstants.SUSPEND_DURATION_ON_FAILURE,
                    SynapseConstants.SYNAPSE_OMNAMESPACE);

            suspendElement.setText(Long.toString(suspendDuration / 1000));
            wsdlElement.addChild(suspendElement);
        }

        // currently, we have to get QOS information from the endpoint definition and set them as
        // special elements under the wsdl element. in future, these information should be
        // extracted from the wsdl.
        EndpointDefinition epAddress = wsdlEndpoint.getEndpoint();
        serializeQOSInformation(epAddress, wsdlElement);

        endpointElement.addChild(wsdlElement);

        return endpointElement;
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

                        String msg = "Mulformed URL in address endpoint";
                        log.error(msg);
                        throw new SynapseException(msg);
                    }
                } else if (e instanceof WSDLEndpoint) {
                    WSDLEndpoint wsdlEndpoint = (WSDLEndpoint) e;
                    try {
                        url = new URL(wsdlEndpoint.getDefinition().getAddress());
                    } catch (MalformedURLException e1) {
                        String msg = "Mulformed URL in address endpoint";
                        log.error(msg);
                        throw new SynapseException(msg);
                    }
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

    }

    protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint,
                                      Properties properties) {

        WSDLEndpoint wsdlEndpoint = new WSDLEndpoint();
        OMAttribute name = epConfig.getAttribute(new QName(
                org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE, "name"));

        if (name != null) {
            wsdlEndpoint.setName(name.getAttributeValue());
        }

        OMElement wsdlElement = epConfig.getFirstChildWithName
                (new QName(SynapseConstants.SYNAPSE_NAMESPACE, "wsdl"));
        if (wsdlElement != null) {

            DefinitionFactory fac = getEndpointDefinitionFactory();
            EndpointDefinition endpoint;
            if (fac == null) {
                fac = new EndpointDefinitionFactory();
                endpoint = fac.createDefinition(wsdlElement);
            } else {
                endpoint = fac.createDefinition(wsdlElement);
            }

            // for now, QOS information has to be provided explicitly.
            extractSpecificEndpointProperties(endpoint, wsdlElement);
            wsdlEndpoint.setDefinition(endpoint);
            processAuditStatus(endpoint, wsdlEndpoint.getName(), wsdlElement);

            // get the service name and port name. at this point we should not worry about
            // the presence of those parameters. they are handled by corresponding WSDL builders.
            String serviceName = wsdlElement.getAttributeValue(new QName("service"));
            String portName = wsdlElement.getAttributeValue(new QName("port"));
            // check if wsdl is supplied as a URI
            String wsdlURI = wsdlElement.getAttributeValue(new QName("uri"));

            // set serviceName and portName in the endpoint. it does not matter if these are
            // null at this point. we are setting them only for serialization purpose.
            wsdlEndpoint.setServiceName(serviceName);
            wsdlEndpoint.setPortName(portName);

            String noParsing = properties.getProperty(SKIP_WSDL_PARSING);

            if (wsdlURI != null) {
                wsdlEndpoint.setWsdlURI(wsdlURI.trim());
                if (noParsing == null || !JavaUtils.isTrueExplicitly(noParsing)) {
                    try {
                        OMNode wsdlOM = SynapseConfigUtils.getOMElementFromURL(new URL(wsdlURI)
                                .toString(), properties.get(SynapseConstants.SYNAPSE_HOME) != null ?
                                properties.get(SynapseConstants.SYNAPSE_HOME).toString() : "");
                        if (wsdlOM != null && wsdlOM instanceof OMElement) {
                            OMElement omElement = (OMElement) wsdlOM;
                            OMNamespace ns = omElement.getNamespace();
                            if (ns != null) {
                                String nsUri = omElement.getNamespace().getNamespaceURI();
                                if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(nsUri)) {

                                    new WSDL11EndpointBuilder().
                                            populateEndpointDefinitionFromWSDL(endpoint,
                                                    wsdlURI.trim(), omElement, serviceName, portName);

                                } else if (WSDL2Constants.WSDL_NAMESPACE.equals(nsUri)) {
                                    //endpoint = new WSDL20EndpointBuilder().
                                    // createEndpointDefinitionFromWSDL(wsdlURI, serviceName, portName);

                                    handleException("WSDL 2.0 Endpoints are currently not supported");
                                }
                            }
                        }
                    } catch (Exception e) {
                        handleException("Couldn't create endpoint from the given WSDL URI : "
                                + e.getMessage(), e);
                    }
                }
            }

            // check if the wsdl 1.1 document is supplied inline
            OMElement definitionElement = wsdlElement.getFirstChildWithName
                    (new QName(org.apache.axis2.namespace.Constants.NS_URI_WSDL11, "definitions"));
            if (endpoint == null && definitionElement != null) {
                wsdlEndpoint.setWsdlDoc(definitionElement);

                if (noParsing == null || !JavaUtils.isTrueExplicitly(noParsing)) {
                    String resolveRoot = properties.get(SynapseConstants.RESOLVE_ROOT).toString();
                    String baseUri = "file:./";
                    if (resolveRoot != null) {
View Full Code Here

Examples of org.apache.synapse.endpoints.WSDLEndpoint

        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement
                = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);
       
        WSDLEndpoint wsdlEndpoint = (WSDLEndpoint) endpoint;
       

        OMElement wsdlElement = fac.createOMElement("wsdl", SynapseConstants.SYNAPSE_OMNAMESPACE);
        String serviceName = wsdlEndpoint.getServiceName();
        if (serviceName != null) {
            wsdlElement.addAttribute("service", serviceName, null);
        }

        String portName = wsdlEndpoint.getPortName();
        if (portName != null) {
            wsdlElement.addAttribute("port", portName, null);
        }

        String uri = wsdlEndpoint.getWsdlURI();
        if (uri != null) {
            wsdlElement.addAttribute("uri", uri, null);
        }

        OMElement wsdlDoc = wsdlEndpoint.getWsdlDoc();
        if (wsdlDoc != null) {
            wsdlElement.addChild(wsdlDoc);
        }

        // currently, we have to get QOS information from the endpoint definition and set them as
        // special elements under the wsdl element. in future, these information should be
        // extracted from the wsdl.
        EndpointDefinition epDefinition = wsdlEndpoint.getDefinition();
        EndpointDefinitionSerializer serializer = new EndpointDefinitionSerializer();
        serializer.serializeEndpointDefinition(epDefinition, wsdlElement);
        serializeSpecificEndpointProperties(epDefinition, wsdlElement);
        endpointElement.addChild(wsdlElement);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.