本文整理汇总了Java中org.apache.axiom.om.OMFactory.createOMNamespace方法的典型用法代码示例。如果您正苦于以下问题:Java OMFactory.createOMNamespace方法的具体用法?Java OMFactory.createOMNamespace怎么用?Java OMFactory.createOMNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axiom.om.OMFactory
的用法示例。
在下文中一共展示了OMFactory.createOMNamespace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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");
}
示例3: 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");
}
示例4: generateSampleStockQuoteRequest
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
/**
* Generate a request payload similar to what is sent by the test-axis2-client for SimpleStockQuoteService.
* @param symbol parameter used for payload
* @return sample request payload
*/
private String generateSampleStockQuoteRequest(String symbol) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace soapNs = fac.createOMNamespace("http://schemas.xmlsoap.org/soap/envelope/", "soapenv");
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement soapEnvelope = fac.createOMElement("Envelope", soapNs);
OMElement soapBody = fac.createOMElement("Body", soapNs);
OMElement method = fac.createOMElement("getSimpleQuote", omNs);
OMElement value1 = fac.createOMElement("symbol", omNs);
value1.addChild(fac.createOMText(method, symbol));
method.addChild(value1);
soapBody.addChild(method);
soapEnvelope.addChild(soapBody);
return "<?xml version='1.0' encoding='utf-8'?>" + soapEnvelope.toString();
}
示例5: 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;
}
示例6: getPlaceOrderPayload
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
private OMElement getPlaceOrderPayload(String symbolValue) {
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("invalid");
OMElement quantity = fac.createOMElement("quantity", xsdNs);
quantity.setText("invalid");
OMElement symbol = fac.createOMElement("symbol", xsdNs);
symbol.setText(symbolValue);
order.addChild(price);
order.addChild(quantity);
order.addChild(symbol);
payload.addChild(order);
return payload;
}
示例7: 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;
}
示例8: addSecurityHeader
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
/**
* The reason for using explicit way of setting SOAP header is, WSDL classes does not work
* perfectly
*
* @param client
* @param authType
* @param orgName
* @param crmTicket
*/
private final void addSecurityHeader(final ServiceClient client, final String orgName, final String crmTicket) {
/* Creating an Axiom factory */
final OMFactory fac = OMAbstractFactory.getOMFactory();
/* Creating header name spaces */
final OMNamespace webNs = fac.createOMNamespace(MSCRMSchemaConstants.WEBSERVICES, "web");
final OMNamespace coreNS = fac.createOMNamespace(MSCRMSchemaConstants.CORETYPE, "core");
/* Creating a sub-element to set the text */
final OMElement value = fac.createOMElement(MSCRMSchemaConstants.CRM_AUTH_TOKEN_TAG, webNs);
/* Create an 'AuthenticationType' element for header */
final OMElement AuthenticationType = fac.createOMElement(MSCRMSchemaConstants.CRM_AUTH_TYPE_TAG, coreNS);
AuthenticationType.setText(crmAuthType);
/* Create an 'CrmTicket' element for header */
final OMElement CrmTicket = fac.createOMElement(MSCRMSchemaConstants.CRM_TICKET_TAG, coreNS);
CrmTicket.setText(crmTicket);
/* Create an 'OrganizationName' element for header */
final OMElement OrganizationName = fac.createOMElement(MSCRMSchemaConstants.CRM_ORG_NAME_TAG, coreNS);
OrganizationName.setText(orgName);
/* Add all values in parent node: 'CrmAuthenticationToken' */
value.addChild(AuthenticationType);
value.addChild(CrmTicket);
value.addChild(OrganizationName);
/* Add header information at the client */
client.addHeader(value);
}
示例9: createCustomQuoteRequest
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
private OMElement createCustomQuoteRequest(String symbol) {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://services.samples", "ns");
OMElement chkPrice = factory.createOMElement("CheckPriceRequest", ns);
OMElement code = factory.createOMElement("Code", ns);
chkPrice.addChild(code);
code.setText(symbol);
return chkPrice;
}
示例10: createFaultRequest
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
private OMElement createFaultRequest(String symbol) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement method = fac.createOMElement("getQuote", omNs);
OMElement value1 = fac.createOMElement("req", omNs);
OMElement value2 = fac.createOMElement("symbol", omNs);
value2.addChild(fac.createOMText(value1, symbol));
value1.addChild(value2);
method.addChild(value1);
return method;
}
示例11: selectOperation
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5, dependsOnMethods = "testServiceDeployment")
public void selectOperation() throws AxisFault, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://www.w3.org/2005/08/addressing", "ns1");
OMElement payload = fac.createOMElement("getAllUsers", omNs);
OMElement result = new AxisServiceClient().sendReceive(payload, serviceUrl, "getAllUsers");
Assert.assertTrue(result.toString().contains("Will Smith"));
Assert.assertTrue(result.toString().contains("Denzel Washington"));
log.info("Service invocation success");
}
示例12: getSimpleQuoteRequest
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
public static OMElement getSimpleQuoteRequest(String symbol) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement omGetQuote = fac.createOMElement("getSimpleQuote", omNs);
OMElement value1 = fac.createOMElement("symbol", omNs);
value1.addChild(fac.createOMText(omGetQuote, symbol));
omGetQuote.addChild(value1);
return omGetQuote;
}
示例13: createRequest
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
private OMElement createRequest(String symbol) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
OMElement method = fac.createOMElement("payload", 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);
return method;
}
示例14: selectOperation
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
@Test(groups = {"wso2.dss"}, invocationCount = 5, dependsOnMethods = "testServiceDeployment",
description = "invoke the service five times", enabled = false)
public void selectOperation() throws AxisFault, InterruptedException, XPathExpressionException {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://www.w3.org/2005/08/addressing", "ns1");
OMElement payload = fac.createOMElement("getAppInfo", omNs);
Thread.sleep(1000);
OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getAppInfo");
Assert.assertNotNull(result, "Service invocation returns null response");
Assert.assertTrue(result.toString().contains("<Title>"));
Assert.assertTrue(result.toString().contains("<Description>"));
log.info("Service invocation success");
}
示例15: createStandardRequest
import org.apache.axiom.om.OMFactory; //导入方法依赖的package包/类
private OMElement createStandardRequest(String symbol) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
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);
return method;
}