本文整理汇总了Java中org.apache.axiom.om.OMFactory类的典型用法代码示例。如果您正苦于以下问题:Java OMFactory类的具体用法?Java OMFactory怎么用?Java OMFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OMFactory类属于org.apache.axiom.om包,在下文中一共展示了OMFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTokenCancelerConfigParameter
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
public static Parameter getTokenCancelerConfigParameter() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement paramElem = fac.createOMElement(new QName("parameter"), null);
paramElem.addAttribute(fac.createOMAttribute("name",
null,
TokenCancelerConfig.TOKEN_CANCELER_CONFIG.
getLocalPart()));
paramElem.addAttribute(fac.createOMAttribute("type",
null, Integer.toString(Parameter.OM_PARAMETER).
toString()));
fac.createOMElement(TokenCancelerConfig.TOKEN_CANCELER_CONFIG,
paramElem);
Parameter param = new Parameter();
param.setName(TokenCancelerConfig.TOKEN_CANCELER_CONFIG.getLocalPart());
param.setParameterElement(paramElem);
param.setValue(paramElem);
param.setParameterType(Parameter.OM_PARAMETER);
return param;
}
示例2: getSecurityElement
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
/**
* ヘッダ内のログイン情報に関するノードを生成します。
* @return org.apache.axiom.om.OMElement ログイン情報
*/
private static OMElement getSecurityElement(String username, String password) {
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMNamespace securityNs = omFactory.createOMNamespace("http://schemas.xmlsoap.org/ws/2002/12/secext", "");
OMElement securityElement = omFactory.createOMElement("Security", securityNs);
OMElement usernameTokenElement = omFactory.createOMElement("UsernameToken", securityNs);
OMElement usernameElement = omFactory.createOMElement("Username", securityNs);
usernameElement.addChild(omFactory.createOMText(usernameElement, username));
OMElement passwordElement = omFactory.createOMElement("Password", securityNs);
passwordElement.addChild(omFactory.createOMText(passwordElement, password));
usernameTokenElement.addChild(usernameElement);
usernameTokenElement.addChild(passwordElement);
securityElement.addChild(usernameTokenElement);
return securityElement;
}
示例3: getTimestampElement
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
/**
* ヘッダ内のタイムスタンプに関するノードを生成します。
* @return org.apache.axiom.om.OMElement タイムスタンプ情報
*/
private static OMElement getTimestampElement(Date createdTime, Date expiredTime) {
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMNamespace timestampNs = omFactory.createOMNamespace("http://schemas.xmlsoap.org/ws/2002/07/utility", "");
OMElement timestampElement = omFactory.createOMElement("Timestamp", timestampNs);
OMElement createdElement = omFactory.createOMElement("Created", timestampNs);
createdElement.addChild(omFactory.createOMText(createdElement, DateUtil.dateToString(createdTime)));
OMElement expiresElement = omFactory.createOMElement("Expires", timestampNs);
expiresElement.addChild(omFactory.createOMText(expiresElement, DateUtil.dateToString(expiredTime)));
timestampElement.addChild(createdElement);
timestampElement.addChild(expiresElement);
return timestampElement;
}
示例4: selectOperation
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5, description = "invoke service",
dependsOnMethods = "testServiceDeployment", enabled = false)
public void selectOperation() throws AxisFault, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice/samples/gspread_sample_service", "ns1");
OMElement payload = fac.createOMElement("getCustomers", omNs);
OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName),
"getProducts");
log.info("Response : " + result);
Assert.assertTrue((result.toString().indexOf("Customers") == 1),
"Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<customerNumber>"),
"Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("</Customer>"),
"Expected Result not found on response message");
log.info("Service Invocation success");
}
示例5: insertNewRecord
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
private OMElement insertNewRecord(String idNum) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "dat");
OMElement payload = fac.createOMElement("insertop", omNs);
OMElement id = fac.createOMElement("id", omNs);
OMElement mod = fac.createOMElement("mod", omNs);
OMElement classname = fac.createOMElement("classname", omNs);
id.setText(idNum);
mod.setText("mod111");
classname.setText("org.wso2.carbon.dss.test");
payload.addChild(id);
payload.addChild(mod);
payload.addChild(classname);
return payload;
}
示例6: createPlaceOrderRequest
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
/**
* Create a new order for a quantiry of a stock at a given price
* <m:placeOrder xmlns:m="http://services.samples">
* <m:order>
* <m:price>3.141593E0</m:price>
* <m:quantity>4</m:quantity>
* <m:symbol>IBM</m:symbol>
* </m:order>
* </m:placeOrder>
*
* @param purchPrice the purchase price
* @param qty the quantiry
* @param symbol the stock
* @return an OMElement payload for the order
*/
public static OMElement createPlaceOrderRequest(double purchPrice, int qty, String symbol) {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement placeOrder= factory.createOMElement("placeOrder", ns);
OMElement order = factory.createOMElement("order", ns);
OMElement price = factory.createOMElement("price", ns);
OMElement quantity = factory.createOMElement("quantity", ns);
OMElement symb = factory.createOMElement("symbol", ns);
price.setText(Double.toString(purchPrice));
quantity.setText(Integer.toString(qty));
symb.setText(symbol);
order.addChild(price);
order.addChild(quantity);
order.addChild(symb);
placeOrder.addChild(order);
return placeOrder;
}
示例7: updateCustomer
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
private OMElement updateCustomer() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice/samples/" +
"gspread_sql_driver_sample_service", "gsp");
OMElement updateCustomerSQL = fac.createOMElement("updateCustomerSQL", omNs);
OMElement customerNumber = fac.createOMElement("customerNumber", omNs);
OMElement contactLastName = fac.createOMElement("contactLastName", omNs);
OMElement contactFirstName = fac.createOMElement("contactFirstName", omNs);
customerNumber.setText(inputValue);
contactLastName.setText(inputValue + "updated");
contactFirstName.setText(inputValue + "updated");
updateCustomerSQL.addChild(customerNumber);
updateCustomerSQL.addChild(contactLastName);
updateCustomerSQL.addChild(contactFirstName);
return updateCustomerSQL;
}
示例8: sendUsingMTOM
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
public void sendUsingMTOM(String fileName, String targetEPR) throws IOException {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns);
OMElement request = factory.createOMElement("request", ns);
OMElement image = factory.createOMElement("image", ns);
FileDataSource fileDataSource = new FileDataSource(new File(fileName));
DataHandler dataHandler = new DataHandler(fileDataSource);
OMText textData = factory.createOMText(dataHandler, true);
image.addChild(textData);
request.addChild(image);
payload.addChild(request);
ServiceClient serviceClient = new ServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(targetEPR));
options.setAction("urn:uploadFileUsingMTOM");
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
options.setCallTransportCleanup(true);
serviceClient.setOptions(options);
OMElement response = serviceClient.sendReceive(payload);
Assert.assertTrue(response.toString().contains(
"<m:testMTOM xmlns:m=\"http://services.samples/xsd\">" + "<m:test1>testMTOM</m:test1></m:testMTOM>"));
}
示例9: xsltTransformation
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5, dependsOnMethods = "selectOperation")
public void xsltTransformation() throws AxisFault, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
OMElement payload = fac.createOMElement("getProductClassifications", omNs);
OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getProductClassifications");
if (log.isDebugEnabled()) {
log.debug("Response :" + result);
}
Assert.assertTrue((result.toString().indexOf("Products") == 1), "Expected Result Not found");
Assert.assertTrue(result.toString().contains("<product>"), "Expected Result Not found");
Assert.assertTrue(result.toString().contains("<Product-Name>"), "Expected Result Not found");
Assert.assertTrue(result.toString().contains("<Product-Classification>"), "Expected Result Not found");
log.info("XSLT Transformation Success");
}
示例10: getAddPayload
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
private OMElement getAddPayload() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice/samples/eventing_sample", "even");
OMElement productCodeId = fac.createOMElement("productCode", omNs);
OMElement productLine = fac.createOMElement("productLine", omNs);
OMElement productName = fac.createOMElement("productName", omNs);
OMElement quantityInStock = fac.createOMElement("quantityInStock", omNs);
OMElement buyPrice = fac.createOMElement("buyPrice", omNs);
productCodeId.setText(productCode);
productLine.setText("Line1");
productName.setText("TestProduct");
quantityInStock.setText("100");
buyPrice.setText("100.00");
OMElement addProduct = fac.createOMElement("addProduct", omNs);
addProduct.addChild(productCodeId);
addProduct.addChild(productLine);
addProduct.addChild(productName);
addProduct.addChild(quantityInStock);
addProduct.addChild(buyPrice);
return addProduct;
}
示例11: selectOperation
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5)
public void selectOperation() throws AxisFault, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice/samples/csv_sample_service", "ns1");
OMElement payload = fac.createOMElement("getProducts", omNs);
OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getProducts");
Assert.assertTrue((result.toString().indexOf("Products") == 1), "Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<Product>"), "Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<ID>"), "Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<Category>"), "Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<Price>"), "Expected Result not found on response message");
Assert.assertTrue(result.toString().contains("<Name>"), "Expected Result not found on response message");
log.info("Service invocation success");
}
示例12: xsltTransformation
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5, dependsOnMethods = "testServiceDeployment")
public void xsltTransformation() throws AxisFault, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
OMElement payload = fac.createOMElement("getProductClassifications", omNs);
OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getProductClassifications");
if (log.isDebugEnabled()) {
log.debug("Response :" + result);
}
Assert.assertTrue((result.toString().indexOf("Products") == 1), "Expected Result Not found");
Assert.assertTrue(result.toString().contains("<Product>"), "Expected Result Not found");
Assert.assertTrue(result.toString().contains("<Product-Name>"), "Expected Result Not found");
Assert.assertTrue(result.toString().contains("<Product-Classification>"), "Expected Result Not found");
log.info("XSLT Transformation Success");
}
示例13: createPlaceOrderRequest
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
/**
* Create place order request
*
* @param purchasePrice purchase price
* @param qty quantity
* @param symbol symbol
* @return OMElement of request
*/
public OMElement createPlaceOrderRequest(double purchasePrice, int qty, String symbol) {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement placeOrder = factory.createOMElement("placeOrder", ns);
OMElement order = factory.createOMElement("order", ns);
OMElement price = factory.createOMElement("price", ns);
OMElement quantity = factory.createOMElement("quantity", ns);
OMElement symb = factory.createOMElement("symbol", ns);
price.setText(Double.toString(purchasePrice));
quantity.setText(Integer.toString(qty));
symb.setText(symbol);
order.addChild(price);
order.addChild(quantity);
order.addChild(symb);
placeOrder.addChild(order);
return placeOrder;
}
示例14: createPayload
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
private OMElement createPayload() { // creation of payload for placeOrder
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ser");
OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
OMElement payload = fac.createOMElement("placeOrder", omNs);
OMElement order = fac.createOMElement("order", omNs);
OMElement price = fac.createOMElement("price", xsdNs);
price.setText("10");
OMElement quantity = fac.createOMElement("quantity", xsdNs);
quantity.setText("100");
OMElement symbol = fac.createOMElement("symbol", xsdNs);
symbol.setText("WSO2");
order.addChild(price);
order.addChild(quantity);
order.addChild(symbol);
payload.addChild(order);
return payload;
}
示例15: createPayload
import org.apache.axiom.om.OMFactory; //导入依赖的package包/类
private OMElement createPayload() { // creation of payload for placeOrder
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "urn");
OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
OMElement payload = fac.createOMElement("placeOrder", omNs);
OMElement order = fac.createOMElement("order", omNs);
OMElement price = fac.createOMElement("price", xsdNs);
price.setText("10");
OMElement quantity = fac.createOMElement("quantity", xsdNs);
quantity.setText("100");
OMElement symbol = fac.createOMElement("symbol", xsdNs);
symbol.setText("WSO2");
order.addChild(price);
order.addChild(quantity);
order.addChild(symbol);
payload.addChild(order);
return payload;
}