當前位置: 首頁>>代碼示例>>Java>>正文


Java OMElement.getFirstChildWithName方法代碼示例

本文整理匯總了Java中org.apache.axiom.om.OMElement.getFirstChildWithName方法的典型用法代碼示例。如果您正苦於以下問題:Java OMElement.getFirstChildWithName方法的具體用法?Java OMElement.getFirstChildWithName怎麽用?Java OMElement.getFirstChildWithName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.axiom.om.OMElement的用法示例。


在下文中一共展示了OMElement.getFirstChildWithName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
public void run() {

        client.getOptions().setAction(operation);

        try {

            long t1 = System.currentTimeMillis();

            for (long i=0; i < iterations; i++) {
                OMElement response2 = client.sendReceive(msg);
                OMElement loadElement = response2.getFirstChildWithName(new QName("load"));
                System.out.println(invokerName + ": " + loadElement.toString());
            }

            long t2 = System.currentTimeMillis();

            System.out.println("================================================================");
            System.out.println(invokerName + " completed requests.");
            System.out.println("================================================================");
            runningTime = t2 - t1;

        } catch (AxisFault axisFault) {
            System.out.println(axisFault.getMessage());
        }
    }
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:26,代碼來源:ServiceInvoker.java

示例2: DBReportUseMessageContentTestCase

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
@Test(groups = "wso2.esb", description = "Insert or update DB table using message contents."
)
public void DBReportUseMessageContentTestCase() throws Exception {
    double price = 200.0;
    OMElement response;
    String priceMessageContent;
    h2DataBaseManager.executeUpdate("INSERT INTO company VALUES(100.0,'ABC')");
    h2DataBaseManager.executeUpdate("INSERT INTO company VALUES(2000.0,'XYZ')");
    h2DataBaseManager.executeUpdate("INSERT INTO company VALUES(" + price + ",'WSO2')");
    h2DataBaseManager.executeUpdate("INSERT INTO company VALUES(300.0,'MNO')");

    File synapseFile = new File(getClass().getResource("/artifacts/ESB/mediatorconfig/dbreport/" +
            "dbReportMediatorUsingMessageContentTestProxy.xml").getPath());
    addProxyService(updateSynapseConfiguration(synapseFile));
    priceMessageContent = getPrice();
    assertEquals(priceMessageContent, Double.toString(price), "Fault, invalid response");
    response = axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp
            ("dbReportMediatorUsingMessageContentTestProxy"), null, "WSO2");
    priceMessageContent = getPrice();
    OMElement returnElement = response.getFirstElement();
    OMElement lastElement = returnElement.getFirstChildWithName(new QName("http://services.samples/xsd", "last"));
    assertEquals(priceMessageContent, lastElement.getText(), "Fault, invalid response");
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:25,代碼來源:DBReportMediatorTestCase.java

示例3: testSequenceMediator

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb" , description = "When we have a dynamic sequence defined in a " +
                                          "proxy " +
                                          "service; ESB throws null pointer exception"
)
public void testSequenceMediator() throws AxisFault{

    OMElement response;
    axis2Client.addHttpHeader("Sequence","correctsequence");
    response=axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("simpleProxy"),null,
                                                     "WSO2");

    assertNotNull(response, "Response message null");
    OMElement returnElement=response.getFirstElement();

    OMElement symbolElement=returnElement.getFirstChildWithName(
            new QName("http://services.samples/xsd","symbol"));

    assertEquals(symbolElement.getText(),"WSO2","Fault, invalid response");

}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:21,代碼來源:DynamicSequenceNullPointerExceptionTestCase.java

示例4: readMaximumLoginAttemptCount

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void readMaximumLoginAttemptCount(OMElement documentElement) {
    OMElement maxLoginAttemptCountElem = documentElement.getFirstChildWithName(IdentityApplicationManagementUtil.
            getQNameWithIdentityApplicationNS(FrameworkConstants.Config.QNAME_MAX_LOGIN_ATTEMPT_COUNT));

    if (maxLoginAttemptCountElem != null) {
        String maxLoginAttemptCountStr = maxLoginAttemptCountElem.getText();

        if (maxLoginAttemptCountStr != null && !maxLoginAttemptCountStr.isEmpty()) {
            try {
                maxLoginAttemptCount = Integer.parseInt(maxLoginAttemptCountElem.getText());
            } catch (NumberFormatException e) {
                log.error("MaxLoginAttemptCount must be a number");
                maxLoginAttemptCount = 5;
            }
        }
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:18,代碼來源:FileBasedConfigurationBuilder.java

示例5: readTenantDataListenerURLs

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void readTenantDataListenerURLs(OMElement documentElement) {
    OMElement tenantDataURLsElem =
            documentElement.getFirstChildWithName(IdentityApplicationManagementUtil.
                    getQNameWithIdentityApplicationNS(
                            FrameworkConstants.Config.QNAME_TENANT_DATA_LISTENER_URLS));

    if (tenantDataURLsElem != null) {
        for (Iterator tenantDataURLElems = tenantDataURLsElem.getChildrenWithLocalName(
                FrameworkConstants.Config.ELEM_TENANT_DATA_LISTENER_URL);
             tenantDataURLElems.hasNext(); ) {

            OMElement tenantDataListenerURLElem = (OMElement) tenantDataURLElems.next();
            if (tenantDataListenerURLElem != null &&
                StringUtils.isNotEmpty(tenantDataListenerURLElem.getText())) {
                tenantDataEndpointURLs.add(IdentityUtil.fillURLPlaceholders(tenantDataListenerURLElem.getText()));
            }
        }
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:20,代碼來源:FileBasedConfigurationBuilder.java

示例6: testSequenceMediator

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = "Define a dynamic sequence defined in a proxy service")
public void testSequenceMediator() throws AxisFault{

    OMElement response;
    axis2Client.addHttpHeader("Sequence", "sendToStockQuoteServiceSequence");
    response = axis2Client.sendSimpleStockQuoteRequest(
            getProxyServiceURLHttp("sequenceMediatorDynamicSequenceTestProxy"), null, "WSO2");

    assertNotNull(response, "Response message null");
    OMElement returnElement=response.getFirstElement();

    OMElement symbolElement=returnElement.getFirstChildWithName(
            new QName("http://services.samples/xsd","symbol"));

    assertEquals(symbolElement.getText(),"WSO2","Fault, invalid response");

}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:18,代碼來源:DynamicSequenceTestCase.java

示例7: testEnrichMediator

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = "Add custom content as a child to the part of message" +
                                         " specified by xpath expression ")
public void testEnrichMediator() throws Exception {
    String soapResponse = getResponse();

    assertNotNull(soapResponse, "Response message null");
    OMElement response = AXIOMUtil.stringToOM(soapResponse);

    OMElement soapBody = response.getFirstElement();
    OMElement getQuoteElement = soapBody.getFirstChildWithName(
            new QName("http://services.samples", "getQuote"));

    assertNotNull(getQuoteElement, "sibling null");
    OMElement requestElement = getQuoteElement.getFirstElement();
    OMElement symbolTagInsideRequestSibling = requestElement.getFirstElement();

    assertEquals(requestElement.getLocalName(), "request", "Fault, child");
    assertEquals(symbolTagInsideRequestSibling.getLocalName(), "symbol", "Fault, child");
    assertEquals(symbolTagInsideRequestSibling.getText(), "WSO2", "Fault, child");


}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:23,代碼來源:EnrichIntegrationBodyToSiblingOfBodyTestCase.java

示例8: testHttpHeaderCombined

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb", description = " extracting http header value, when header name can " +
                                         "be a mix of lowercase or uppercase"
)
public void testHttpHeaderCombined() throws AxisFault {
    StockQuoteClient axis2Client3 = new StockQuoteClient();
    OMElement response;
    axis2Client3.addHttpHeader("Test_Header", "mixed");
    response = axis2Client3.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("httpHeaderTestProxy"), null,
                                                        "WSO2");
    assertNotNull(response, "Response message null");
    OMElement returnElement = response.getFirstElement();

    OMElement symbolElement = returnElement.getFirstChildWithName(
            new QName("http://services.samples/xsd", "symbol"));

    assertEquals(symbolElement.getText(), "mixed", "Fault, invalid response");
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:18,代碼來源:HTTPHeaderCaseSensitivityTestCase.java

示例9: testSymbolSunChangedToIBM

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(enabled = false,
      description = "Simple Message Transformation - Rule Mediator for Message Transformation- SUN changed to IBM")
public void testSymbolSunChangedToIBM() throws Exception {

    OMElement response = axis2Client.sendSimpleStockQuoteRequest(
        getMainSequenceURL(), null, "SUN");
    Assert.assertNotNull(response, "Response is null");

    OMElement returnElement = response.getFirstElement();
    OMElement symbolElement = returnElement.getFirstChildWithName(
        new QName("http://services.samples/xsd", "symbol"));
    assertEquals(symbolElement.getText(), "IBM", "Fault, invalid response");
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:14,代碼來源:Sample600TestCase.java

示例10: readCacheTimeouts

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void readCacheTimeouts(OMElement documentElement) {
    OMElement cacheTimeoutsElem = documentElement.getFirstChildWithName(IdentityApplicationManagementUtil.
            getQNameWithIdentityApplicationNS(FrameworkConstants.Config.QNAME_CACHE_TIMEOUTS));

    if (cacheTimeoutsElem != null) {
        for (Iterator cacheChildElems = cacheTimeoutsElem.getChildElements(); cacheChildElems.hasNext(); ) {
            OMElement cacheTimeoutElem = (OMElement) cacheChildElems.next();
            String value = cacheTimeoutElem.getText();

            if (value != null && value.trim().length() > 0) {
                readCacheTimeOut(cacheTimeoutElem, value);
            }
        }
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:16,代碼來源:FileBasedConfigurationBuilder.java

示例11: readExtensionPoints

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void readExtensionPoints(OMElement documentElement) {
    OMElement extensionsElem = documentElement.getFirstChildWithName(IdentityApplicationManagementUtil.
            getQNameWithIdentityApplicationNS(FrameworkConstants.Config.QNAME_EXTENSIONS));

    if (extensionsElem != null) {
        for (Iterator extChildElems = extensionsElem.getChildElements(); extChildElems.hasNext(); ) {
            OMElement extensionElem = (OMElement) extChildElems.next();
            instantiateClass(extensionElem);
        }
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:12,代碼來源:FileBasedConfigurationBuilder.java

示例12: readAuthenticationEndpointQueryParams

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void readAuthenticationEndpointQueryParams(OMElement documentElement) {
    OMElement authEndpointQueryParamsElem = documentElement
            .getFirstChildWithName(IdentityApplicationManagementUtil
                                           .getQNameWithIdentityApplicationNS(FrameworkConstants.Config.QNAME_AUTH_ENDPOINT_QUERY_PARAMS));

    if (authEndpointQueryParamsElem != null) {

        authEndpointQueryParamsConfigAvailable = true;
        OMAttribute actionAttr = authEndpointQueryParamsElem.getAttribute(new QName(
                FrameworkConstants.Config.ATTR_AUTH_ENDPOINT_QUERY_PARAM_ACTION));
        authEndpointQueryParamsAction = FrameworkConstants.AUTH_ENDPOINT_QUERY_PARAMS_ACTION_EXCLUDE;

        if (actionAttr != null) {
            String actionValue = actionAttr.getAttributeValue();

            if (actionValue != null && !actionValue.isEmpty()) {
                authEndpointQueryParamsAction = actionValue;
            }
        }


        for (Iterator authEndpointQueryParamElems = authEndpointQueryParamsElem
                .getChildrenWithLocalName(FrameworkConstants.Config.ELEM_AUTH_ENDPOINT_QUERY_PARAM); authEndpointQueryParamElems
                     .hasNext(); ) {
            String queryParamName = processAuthEndpointQueryParamElem((OMElement) authEndpointQueryParamElems
                    .next());

            if (queryParamName != null) {
                this.authEndpointQueryParams.add(queryParamName);
            }
        }
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:34,代碼來源:FileBasedConfigurationBuilder.java

示例13: readProxyModes

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
private void readProxyModes(OMElement documentElement) {
    //TODO:get proxy modes from an enum?
    OMElement proxyModeElem = documentElement.getFirstChildWithName(IdentityApplicationManagementUtil.
            getQNameWithIdentityApplicationNS(FrameworkConstants.Config.QNAME_PROXY_MODE));

    if (proxyModeElem != null && proxyModeElem.getText() != null && !proxyModeElem.getText().isEmpty() &&
        "dumb".equalsIgnoreCase(proxyModeElem.getText())) {
        isDumbMode = true;
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:11,代碼來源:FileBasedConfigurationBuilder.java

示例14: testGenerateFaults1

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
@Test(groups = "wso2.esb",
      description = "Using script mediator to generate faults. Test 1.")
public void testGenerateFaults1() throws XMLStreamException {
    try {

        axis2Client.sendSimpleStockQuoteRequest(
                getProxyServiceURLHttp("scriptMediatorInFaultSequenceTestProxy"), null,
                "MSFT");

        Assert.fail("Request must throw a AxisFault");

    } catch (AxisFault e) {

        SOAPFaultDetail faultDetail = e.getFaultDetailElement();
        assertNotNull(faultDetail, "Fault response message null");

        OMElement firstElemnt = faultDetail.getFirstElement();
        OMElement errorCode = firstElemnt.getFirstChildWithName(new QName("ErrorCode"));
        OMElement errorText = firstElemnt.getFirstChildWithName(new QName("ErrorText"));
        assertEquals(faultDetail.getFirstElement().getLocalName(), "AppErrorCode",
                     "Fault detail element");
        assertEquals(errorCode.getText(), "8719",
                     "Fault detail element");
        assertEquals(errorText.getText(), "Issue has",
                     "Fault detail element");

    }
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:29,代碼來源:ScriptIntegrationToGenerateFaultTestCase.java

示例15: getStatus

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
/**
 * Helper method to extract the boolean response
 *
 * @param xmlstring XACML resource as String
 * @return Decision
 * @throws Exception if fails
 */
public static String getStatus(String xmlstring) throws Exception {

    OMElement response = null;
    OMElement result = null;
    OMElement decision = null;
    response = AXIOMUtil.stringToOM(xmlstring);

    OMNamespace nameSpace = response.getNamespace();

    if (nameSpace != null) {
        result = response.getFirstChildWithName(new QName(nameSpace.getNamespaceURI(), "Result"));
    } else {
        result = response.getFirstElement();
    }
    if (result != null) {
        if (nameSpace != null) {
            decision = result.getFirstChildWithName(new QName(nameSpace.getNamespaceURI(), "Decision"));
        } else {
            decision = result.getFirstChildWithName(new QName("Decision"));
        }
        if (decision != null) {
            return decision.getText();
        }
    }

    return "Invalid Status";
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:35,代碼來源:ClientUtil.java


注:本文中的org.apache.axiom.om.OMElement.getFirstChildWithName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。