org.apache.axiom.om.OMNamespace Java Examples
The following examples show how to use
org.apache.axiom.om.OMNamespace.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IterateClient.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #2
Source File: CallOutMediatorWithMTOMTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
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>")); }
Example #3
Source File: LoadbalanceFailoverClient.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #4
Source File: Sample700TestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #5
Source File: OutputMappingAsAttributeDataServiceTestCase.java From product-ei with Apache License 2.0 | 6 votes |
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; }
Example #6
Source File: JMXStatisticsTestCase.java From product-ei with Apache License 2.0 | 6 votes |
@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"); }
Example #7
Source File: RimAxiom.java From openxds with Apache License 2.0 | 6 votes |
/** * Add a new ebXML Classification element with multiple slots to the parent element. * * @param parent The parent element this should be added to * @param classId The classification id * @param id The id of the registry object being classified * @param value The classification code asigned ot the registry object * @param scheme The classification scheme/axis that the code applies to * @param mainField The single valued main slot field * @param mainValue The single display value of the main field. * @param otherFields The multiple valued other slot fields. * @param codingScheme The coding scheme from which the code value is drawn * @param rimNameSpace the rim name space of the root element * @return The new classification element */ public static OMElement addRimClassificationElement(OMElement parent, String classId, String id, String scheme, String mainField, String mainValue, Map<String, List<String>> otherFields, OMNamespace rimNameSpace) { OMElement classElement = addRimElement(parent, "Classification", rimNameSpace); classElement.addAttribute("id", classId, null); classElement.addAttribute("classificationScheme", scheme, null); classElement.addAttribute("classifiedObject", id, null); classElement.addAttribute("nodeRepresentation", "", null); addRimSlotElement(classElement, mainField, mainValue, rimNameSpace); Set<Map.Entry<String, List<String>>> entries = otherFields.entrySet(); for (Map.Entry<String, List<String>> entry : entries) { String key = entry.getKey(); List<String> values = entry.getValue(); if (values != null && values.size() > 0) { addRimSlotElement(classElement, key, values, rimNameSpace); } } return classElement; }
Example #8
Source File: DeactivatedCappMPBehaviourOnRestartTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
private 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; }
Example #9
Source File: AggregatedRequestClient.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #10
Source File: DiscoveryOMUtils.java From carbon-commons with Apache License 2.0 | 6 votes |
private static OMElement serializeQNamesList(QName[] qnames, QName topElement, OMFactory factory) { OMElement wrapperElement = factory.createOMElement(topElement); StringBuffer qnamesTxt = new StringBuffer(); boolean firstEntry = true; for (QName qname : qnames) { if (!firstEntry) { qnamesTxt.append(" "); } OMNamespace ns = wrapperElement.declareNamespace(qname.getNamespaceURI(), qname.getPrefix()); qnamesTxt.append(ns.getPrefix() + ":" + qname.getLocalPart()); firstEntry = false; } wrapperElement.setText(qnamesTxt.toString()); return wrapperElement; }
Example #11
Source File: NestedAggregatesTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
private OMElement createNestedQuoteRequestBody(String symbol, int noOfItr) { SOAPFactory fac = OMAbstractFactory.getSOAP11Factory(); OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns"); OMElement method1 = fac.createOMElement("getQuotes", omNs); for (int i = 0; i < noOfItr; i++) { OMElement method2 = fac.createOMElement("getQuote", omNs); for (int j = 0; j < noOfItr; j++) { 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; }
Example #12
Source File: XMLToJsonTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #13
Source File: Sample705TestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #14
Source File: DS1031PolicyKeyWithoutPolicyPathTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = "wso2.dss", description = "Check whether service is listed as a deployed service") public void testServiceDeployment() throws Exception { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1"); OMElement payload = fac.createOMElement("select_all_Customers_operation", omNs); try { String serviceName = "PolicyKeyWithoutPolicyPathTest"; new AxisServiceClient() .sendReceive(payload, getServiceUrlHttp(serviceName), "select_all_Customers_operation"); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getLocalizedMessage().contains("Transport error: 404 Error: Not Found"), "Faulty service got deployed"); } }
Example #15
Source File: HeaderFactory.java From garoon-google with MIT License | 6 votes |
/** * ヘッダ内のログイン情報に関するノードを生成します。 * @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; }
Example #16
Source File: RepositoryBopt.java From openxds with Apache License 2.0 | 6 votes |
public OMElement RetrieveDocumentSetRequest(OMElement rdsr) { try { OMElement startup_error = beginTransaction("RET.b", rdsr, AppendixV.REPOSITORY_ACTOR); if (startup_error != null) return startup_error; log_message.setTestMessage("RET.b"); OMNamespace ns = rdsr.getNamespace(); String ns_uri = ns.getNamespaceURI(); if (ns_uri == null || ! ns_uri.equals(MetadataSupport.xdsB.getNamespaceURI())) { OMElement res = this.start_up_error(rdsr, "RepositoryB.java", AppendixV.REPOSITORY_ACTOR, "Invalid namespace on RetrieveDocumentSetRequest (" + ns_uri + ")", true); endTransaction(false); return res; } RetrieveDocumentSet s = new RetrieveDocumentSet(log_message, XdsCommon.xds_b, getMessageContext()); OMElement result = s.retrieveDocumentSet(rdsr, this, true /* optimize */, this); endTransaction(s.getStatus()); return result; } catch (Exception e) { return endTransaction(rdsr, e, AppendixV.REPOSITORY_ACTOR, ""); } }
Example #17
Source File: ExcelDataServiceTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.dss" }, invocationCount = 5, enabled = false) 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"); }
Example #18
Source File: ReturnRequestStatusTest.java From product-ei with Apache License 2.0 | 6 votes |
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"); }
Example #19
Source File: RealmConfigXMLProcessor.java From micro-integrator with Apache License 2.0 | 6 votes |
private static void addPropertyElements(OMFactory factory, OMElement parent, String className, String description, Map<String, String> properties) { if (className != null) { parent.addAttribute("class", className, (OMNamespace) null); } if (description != null) { parent.addAttribute("Description", description, (OMNamespace) null); } Iterator ite = properties.entrySet().iterator(); while (ite.hasNext()) { Entry<String, String> entry = (Entry) ite.next(); String name = (String) entry.getKey(); String value = (String) entry.getValue(); if (value != null) { value = resolveSystemProperty(value); } OMElement propElem = factory.createOMElement(new QName("Property")); OMAttribute propAttr = factory.createOMAttribute("name", (OMNamespace) null, name); propElem.addAttribute(propAttr); propElem.setText(value); parent.addChild(propElem); } }
Example #20
Source File: APIThrottleHandler.java From carbon-apimgt with Apache License 2.0 | 6 votes |
private OMElement getFaultPayload(int throttleErrorCode, String message, String description) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace ns = fac.createOMNamespace(APIThrottleConstants.API_THROTTLE_NS, APIThrottleConstants.API_THROTTLE_NS_PREFIX); OMElement payload = fac.createOMElement("fault", ns); OMElement errorCode = fac.createOMElement("code", ns); errorCode.setText(String.valueOf(throttleErrorCode)); OMElement errorMessage = fac.createOMElement("message", ns); errorMessage.setText(message); OMElement errorDetail = fac.createOMElement("description", ns); errorDetail.setText(description); payload.addChild(errorCode); payload.addChild(errorMessage); payload.addChild(errorDetail); return payload; }
Example #21
Source File: OpenIDTokenGeneratorHandler.java From openid4java with Apache License 2.0 | 6 votes |
public void addDisplayClaim(String uri, String value, String displayTag, OMElement omParent, OMNamespace omNs, OMFactory omFactory) { final OMElement elemDisplayClaim = omFactory.createOMElement( "DisplayClaim", omNs, omParent); elemDisplayClaim.addAttribute("Uri", uri, null); // build and set the display tag as the part after the last "/" final OMElement elemDisplayTag = omFactory.createOMElement( "DisplayTag", omNs, elemDisplayClaim); if (displayTag == null || displayTag.length() == 0) { int lastIndex = uri.lastIndexOf("/"); displayTag = ""; if (lastIndex > -1 && uri.length() > lastIndex) displayTag = uri.substring(lastIndex + 1); } elemDisplayTag.setText(displayTag); // set the display value final OMElement elemDisplayValue = omFactory.createOMElement( "DisplayValue", omNs, elemDisplayClaim); elemDisplayValue.setText(value); }
Example #22
Source File: DataServiceSqlDriverTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
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; }
Example #23
Source File: Metadata.java From openxds with Apache License 2.0 | 6 votes |
public OMElement getV2SubmitObjectsRequest() throws XdsInternalException { OMNamespace rs = MetadataSupport.ebRSns2; OMNamespace rim = MetadataSupport.ebRIMns2; OMElement sor = this.om_factory().createOMElement( "SubmitObjectsRequest", rs); OMElement lrol = this.om_factory().createOMElement( "LeafRegistryObjectList", rim); sor.addChild(lrol); List objects = this.getV2(); for (int i = 0; i < objects.size(); i++) { OMElement ele = (OMElement) objects.get(i); lrol.addChild(ele); } return sor; }
Example #24
Source File: ExcelSampleServiceTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@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"); }
Example #25
Source File: XMLToJsonTestCase.java From product-ei with Apache License 2.0 | 6 votes |
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; }
Example #26
Source File: GraphQLAPIHandler.java From carbon-apimgt with Apache License 2.0 | 6 votes |
/** * @param description description of the error * @return the OMElement */ private OMElement getFaultPayload(String description) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace ns = fac.createOMNamespace(APISecurityConstants.API_SECURITY_NS, APISecurityConstants.API_SECURITY_NS_PREFIX); OMElement payload = fac.createOMElement("fault", ns); OMElement errorCode = fac.createOMElement("code", ns); errorCode.setText(APISecurityConstants.GRAPHQL_INVALID_QUERY + ""); OMElement errorMessage = fac.createOMElement("message", ns); errorMessage.setText(APISecurityConstants.GRAPHQL_INVALID_QUERY_MESSAGE); OMElement errorDetail = fac.createOMElement("description", ns); errorDetail.setText(description); payload.addChild(errorCode); payload.addChild(errorMessage); payload.addChild(errorDetail); return payload; }
Example #27
Source File: TestUtils.java From micro-integrator with Apache License 2.0 | 6 votes |
private static OMElement getPayload(String opName, Map<String, String> params) { OMFactory omFac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = omFac.createOMNamespace( "http://example1.org/example1", "example1"); OMElement method = omFac.createOMElement(opName, omNs); if (params != null) { OMElement paramEl = null; for (String key : params.keySet()) { paramEl = omFac.createOMElement(key, omNs); paramEl.setText(params.get(key)); method.addChild(paramEl); } } return method; }
Example #28
Source File: AGSpreadDataServiceTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.dss" }, invocationCount = 5, 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), "getcustomers"); 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"); }
Example #29
Source File: IterateClient.java From micro-integrator with Apache License 2.0 | 5 votes |
private OMElement createMultipleCustomQuoteRequestBody(String symbol, int iterations) { SOAPFactory fac = OMAbstractFactory.getSOAP11Factory(); OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns"); OMElement method = fac.createOMElement("getQuote", omNs); for (int i = 0; i < iterations; i++) { OMElement chkPrice = fac.createOMElement("CheckPriceRequest", omNs); OMElement code = fac.createOMElement("Code", omNs); chkPrice.addChild(code); code.setText(symbol); method.addChild(chkPrice); } return method; }
Example #30
Source File: RequestUtil.java From micro-integrator with Apache License 2.0 | 5 votes |
private OMElement getCustomPayload(String symbol) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns"); OMElement payload = fac.createOMElement("getQuote", omNs); OMElement request = fac.createOMElement("request", omNs); OMElement symbols = fac.createOMElement("symbols", omNs); OMElement company = fac.createOMElement("company", omNs); company.setText(symbol); symbols.addChild(company); request.addChild(symbols); payload.addChild(request); return payload; }