本文整理汇总了Java中org.apache.axiom.om.OMAbstractFactory类的典型用法代码示例。如果您正苦于以下问题:Java OMAbstractFactory类的具体用法?Java OMAbstractFactory怎么用?Java OMAbstractFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OMAbstractFactory类属于org.apache.axiom.om包,在下文中一共展示了OMAbstractFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPayload
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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;
}
示例2: createPayload
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的package包/类
private OMElement createPayload() {
// creation of payload for placeOrder
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omXsdNs = fac.createOMNamespace("http://services.samples", "xsd");
OMNamespace omSerNs = fac.createOMNamespace("http://services.samples", "ser");
OMElement operation = fac.createOMElement("placeOrder", omSerNs);
OMElement method = fac.createOMElement("order", omSerNs);
OMElement getPrice = fac.createOMElement("price", omXsdNs);
OMElement getQuantity = fac.createOMElement("quantity", omXsdNs);
OMElement getSymbol = fac.createOMElement("symbol", omXsdNs);
method.addChild(fac.createOMText(getPrice, "123.32"));
method.addChild(fac.createOMText(getQuantity, "4"));
method.addChild(fac.createOMText(getSymbol, "IBM"));
operation.addChild(method);
return operation;
}
示例3: createGetQuotesRequestBody
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的package包/类
private OMElement createGetQuotesRequestBody(String symbol, int iterations) {
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement top = fac.createOMElement("getQuotes", omNs);
for (int i = 0; i < iterations; i++) {
OMElement method = fac.createOMElement("getQuote", omNs);
OMElement value1 = fac.createOMElement("request", omNs);
OMElement value2 = fac.createOMElement("symbol", omNs);
value2.addChild(fac.createOMText(value1, symbol));
value1.addChild(value2);
method.addChild(value1);
top.addChild(method);
}
return top;
}
示例4: createPayload
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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;
}
示例5: createMarketActivityRequest
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的package包/类
/**
* Create a new market activity request with a body as follows
* <m:getMarketActivity xmlns:m="http://services.samples">
* <m:request>
* <m:symbol>IBM</m:symbol>
* ...
* <m:symbol>MSFT</m:symbol>
* </m:request>
* </m:getMarketActivity>
* @return OMElement for SOAP body
*/
public static OMElement createMarketActivityRequest() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
OMElement getQuote = factory.createOMElement("getMarketActivity", ns);
OMElement request = factory.createOMElement("request", ns);
OMElement symb = null;
for (int i=0; i<100; i++) {
symb = factory.createOMElement("symbols", ns);
symb.setText(randomString(3));
request.addChild(symb);
}
getQuote.addChild(request);
return getQuote;
}
示例6: selectOperation
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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");
}
示例7: getPayloadAddOffice
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的package包/类
private OMElement getPayloadAddOffice(String officeCode, String city, String state,
String territory) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
OMElement payload = fac.createOMElement("addOffice", omNs);
OMElement officeCodeOme = fac.createOMElement("officeCode", omNs);
officeCodeOme.setText(officeCode);
payload.addChild(officeCodeOme);
OMElement cityOme = fac.createOMElement("city", omNs);
cityOme.setText(city);
payload.addChild(cityOme);
OMElement stateOme = fac.createOMElement("state", omNs);
stateOme.setText(state);
payload.addChild(stateOme);
OMElement territoryOme = fac.createOMElement("territory", omNs);
territoryOme.setText(territory);
payload.addChild(territoryOme);
return payload;
}
示例8: insertNewRecord
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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;
}
示例9: createMultipleQuoteRequestBody
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的package包/类
private OMElement createMultipleQuoteRequestBody(String symbol, int iterations) {
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement method1 = fac.createOMElement("getQuotes", omNs);
OMElement method2 = fac.createOMElement("getQuote", omNs);
for (int i = 0; i < iterations; i++) {
OMElement value1 = fac.createOMElement("request", omNs);
OMElement value2 = fac.createOMElement("symbol", omNs);
value2.addChild(fac.createOMText(value1, symbol));
value1.addChild(value2);
method2.addChild(value1);
method1.addChild(method2);
}
return method1;
}
示例10: buildSoapEnvelope
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPHeader header = soapFactory.createSOAPHeader();
envelope.addChild(header);
OMNamespace synNamespace = soapFactory.
createOMNamespace("http://ws.apache.org/ns/synapse", "syn");
OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
clientIDElement.setText(clientID);
header.addChild(clientIDElement);
SOAPBody body = soapFactory.createSOAPBody();
envelope.addChild(body);
OMElement valueElement = soapFactory.createOMElement("Value", null);
valueElement.setText(value);
body.addChild(valueElement);
return envelope;
}
示例11: xsltTransformation
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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");
}
示例12: getAddPayload
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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;
}
示例13: xsltTransformation
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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");
}
示例14: sendUsingMTOM
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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>"));
}
示例15: createPlaceOrderRequest
import org.apache.axiom.om.OMAbstractFactory; //导入依赖的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;
}