本文整理汇总了Java中org.apache.axiom.om.OMNamespace类的典型用法代码示例。如果您正苦于以下问题:Java OMNamespace类的具体用法?Java OMNamespace怎么用?Java OMNamespace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OMNamespace类属于org.apache.axiom.om包,在下文中一共展示了OMNamespace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPayload
import org.apache.axiom.om.OMNamespace; //导入依赖的package包/类
private OMElement getPayload() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNsa = fac.createOMNamespace("testns1", "a");
OMNamespace omNsb = fac.createOMNamespace("testns2", "b");
OMNamespace omNsc = fac.createOMNamespace("testns3", "c");
OMElement payload = fac.createOMElement("test", omNsa);
OMElement p1 = fac.createOMElement("testb", omNsb);
OMAttribute a1 = fac.createOMAttribute("attrb1", omNsa, "a");
a1.setAttributeValue("v1");
p1.addAttribute(a1);
OMAttribute a2 = fac.createOMAttribute("attrb2", omNsb, "b");
a2.setAttributeValue("v2");
p1.addAttribute(a2);
OMElement p2 = fac.createOMElement("testc", omNsc);
p1.addChild(p2);
payload.addChild(p1);
return payload;
}
示例2: getSecurityElement
import org.apache.axiom.om.OMNamespace; //导入依赖的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.OMNamespace; //导入依赖的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: deleteEmployeeById
import org.apache.axiom.om.OMNamespace; //导入依赖的package包/类
private void deleteEmployeeById(String employeeNumber) throws AxisFault {
OMElement result;
OMElement payload = fac.createOMElement("deleteEmployeeById", omNs);
OMElement empNo = fac.createOMElement("employeeNumber", omNs);
empNo.setText(employeeNumber);
payload.addChild(empNo);
result = new AxisServiceClient().sendReceive(payload, serviceEndPoint, "deleteEmployeeById");
Assert.assertTrue(result.toString().contains("SUCCESSFUL"), "Response Not Successful");
OMNamespace nameSpace = result.getNamespace();
Assert.assertNotNull(nameSpace.getPrefix(), "Invalid prefix. prefix value null");
Assert.assertNotSame(nameSpace.getPrefix(), "", "Invalid prefix");
Assert.assertEquals(nameSpace.getNamespaceURI(), "http://ws.wso2.org/dataservice", "Invalid NamespaceURI");
}
示例5: selectOperation
import org.apache.axiom.om.OMNamespace; //导入依赖的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");
}
示例6: insertNewRecord
import org.apache.axiom.om.OMNamespace; //导入依赖的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;
}
示例7: updateRecord
import org.apache.axiom.om.OMNamespace; //导入依赖的package包/类
private OMElement updateRecord(String idNum) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "dat");
OMElement payload = fac.createOMElement("Update", omNs);
OMElement id = fac.createOMElement("id", omNs);
OMElement mod = fac.createOMElement("mod", omNs);
OMElement classname = fac.createOMElement("classname", omNs);
id.setText(idNum);
mod.setText("mod1112" + idNum);
classname.setText("org.wso2.carbon.dss.test2");
payload.addChild(id);
payload.addChild(mod);
payload.addChild(classname);
return payload;
}
示例8: getPlaceOrderPayload
import org.apache.axiom.om.OMNamespace; //导入依赖的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;
}
示例9: updateCustomer
import org.apache.axiom.om.OMNamespace; //导入依赖的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;
}
示例10: xsltTransformation
import org.apache.axiom.om.OMNamespace; //导入依赖的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");
}
示例11: getAddPayload
import org.apache.axiom.om.OMNamespace; //导入依赖的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;
}
示例12: selectOperation
import org.apache.axiom.om.OMNamespace; //导入依赖的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");
}
示例13: xsltTransformation
import org.apache.axiom.om.OMNamespace; //导入依赖的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: createPlaceOrderRequest
import org.apache.axiom.om.OMNamespace; //导入依赖的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;
}
示例15: buildSoapEnvelope
import org.apache.axiom.om.OMNamespace; //导入依赖的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;
}