本文整理汇总了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());
}
}
示例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");
}
示例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");
}
示例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;
}
}
}
}
示例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()));
}
}
}
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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;
}
}
示例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");
}
}
示例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";
}