Package org.apache.synapse.util.xpath

Examples of org.apache.synapse.util.xpath.SynapseXPath.addNamespace()


        // create a new XSLT mediator
        XSLTMediator transformMediator = new XSLTMediator();

        // set xpath condition to select source
        SynapseXPath xpath = new SynapseXPath("//m0:CheckPriceRequest");
        xpath.addNamespace("m0", "http://services.samples/xsd");
        transformMediator.setSource(xpath);

        // set XSLT transformation URL
        setXsltTransformationURL(transformMediator, "xslt-key");
View Full Code Here


        // create a new switch mediator
        XSLTMediator transformMediator = new XSLTMediator();

        // set xpath condition to select source
        SynapseXPath xpath = new SynapseXPath("//m0:CheckPriceRequest");
        xpath.addNamespace("m0", "http://services.samples/xsd");
        transformMediator.setSource(xpath);

        // set XSLT transformation URL
        setXsltTransformationURL(transformMediator, "xslt-key");
View Full Code Here

        }

        if (isDynamicKey) {
            path = "//m0:CheckPriceRequest/m0:" + xsltKeyValue;
            xpath = new SynapseXPath(path);
            xpath.addNamespace("m0", "http://services.samples/xsd");

            // Create key from dynamic key (xpath)
            xsltKey = new Value(xpath);
            // set XSLT transformation URL (Xpath)
            transformMediator.setXsltKey(xsltKey);
View Full Code Here

        try {
            // get the 'pool' element and determine if we need to create a DataSource or
            // lookup using JNDI
            SynapseXPath xpath = new SynapseXPath("self::node()/syn:connection/syn:pool");
            xpath.addNamespace("syn", XMLConfigConstants.SYNAPSE_NAMESPACE);
            pool = (OMElement) xpath.selectSingleNode(elem);
            if (pool.getFirstChildWithName(DSNAME_Q) != null) {
                readLookupConfig(mediator, pool);
            } else if (pool.getFirstChildWithName(DRIVER_Q) != null) {
                readCustomDataSourceConfig(pool, mediator);
View Full Code Here

        OMNamespace ns = fac.createOMNamespace("http://test", "t");
        ctx.getEnvelope().getHeader().addHeaderBlock("test", ns).setText(message);
        ctx.getEnvelope().getHeader().addHeaderBlock("test2", ns);
       
        SynapseXPath xpath = new SynapseXPath("$header/t:test");
        xpath.addNamespace(ns);
        assertEquals(message, xpath.stringValueOf(ctx));
       
        xpath = new SynapseXPath("$header/*");
        assertEquals(2, xpath.selectNodes(ctx).size());
    }
View Full Code Here

        }
        try {
            SynapseXPath synapseXPath = new SynapseXPath(xpath);
            for (OMNamespace omNamespace : omNameSpaces) {
                if (omNamespace != null) {
                    synapseXPath.addNamespace(omNamespace.getPrefix(), omNamespace.getNamespaceURI());
                }
            }
            return synapseXPath;
        } catch (JaxenException e) {
            throw new LoggedRuntimeException("Invalid XPapth expression : " +
View Full Code Here

        /*insert test value*/
        Input testInputUserName = new Input();
        SynapseXPath usernameXpathExpr = null;
        //create xpath expr
        usernameXpathExpr = new SynapseXPath("//ns2:WebRequest/ns2:user");
        usernameXpathExpr.addNamespace("ns2", "http://wso2.org/sample");
        testInputUserName.setSourceXPath(usernameXpathExpr);
        testInputUserName.setName(usernameCred.getName());
        map.put(usernameCred.getName(), testInputUserName);
        credInputsList.add(usernameCred);

View Full Code Here

        passwordCred.setSourceValue(credentials.getPasswordValue());
        passwordCred.setSourceXPath(credentials.getPasswordXPath());
        /*insert test value*/
        Input testInputPassword = new Input();
        SynapseXPath passwordXpathExpr = new SynapseXPath("//ns27:WebRequest/ns27:pass");
        passwordXpathExpr.addNamespace("ns27", "http://wso2.org/sample");
        testInputPassword.setSourceXPath(passwordXpathExpr);
        testInputPassword.setName(passwordCred.getName());
        map.put(passwordCred.getName(), testInputPassword);
        credInputsList.add(passwordCred);

View Full Code Here

        HashMap map = new HashMap();

        Input detailInput = new Input();
        detailInput.setName("DetailLevel");
        SynapseXPath detailXpathExpr = new SynapseXPath("//ns27:WebRequest/ns27:detail");
        detailXpathExpr.addNamespace("ns27", "http://wso2.org/sample");
        detailInput.setSourceXPath(detailXpathExpr);
        map.put(detailInput.getName(), detailInput);

        Input errorLang = new Input();
        errorLang.setName("ErrorLanguage");
View Full Code Here

        map.put(detailInput.getName(), detailInput);

        Input errorLang = new Input();
        errorLang.setName("ErrorLanguage");
        SynapseXPath errorXpathExpr = new SynapseXPath("//ns2:WebRequest/ns2:errorlang");
        errorXpathExpr.addNamespace("ns2", "http://wso2.org/sample");
        errorLang.setSourceXPath(errorXpathExpr);
        map.put(errorLang.getName(), errorLang);

        List<Input> inputs = operation.getInputs();
        PaypalTestUtil.validateSimpleInputs(map, inputs);
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.