Java Code Examples for org.apache.axiom.om.OMAbstractFactory

The following examples show how to use org.apache.axiom.om.OMAbstractFactory. These examples are extracted from open source projects. 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 Project: docs-apim   Source File: APIAuthenticationHandler.java    License: Apache License 2.0 6 votes vote down vote up
private OMElement getFaultPayload(APISecurityException e) {
    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(String.valueOf(e.getErrorCode()));
    OMElement errorMessage = fac.createOMElement("message", ns);
    errorMessage.setText(APISecurityConstants.getAuthenticationFailureMessage(e.getErrorCode()));
    OMElement errorDetail = fac.createOMElement("description", ns);
    errorDetail.setText(e.getMessage());

    payload.addChild(errorCode);
    payload.addChild(errorMessage);
    payload.addChild(errorDetail);
    return payload;
}
 
Example 2
Source Project: micro-integrator   Source File: TestUtils.java    License: Apache License 2.0 6 votes vote down vote up
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 3
Source Project: carbon-commons   Source File: TableReportMetaDataHandler.java    License: Apache License 2.0 6 votes vote down vote up
private void createTableReportColumnData(int id, ColumnDTO column) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMElement columnElement = fac.createOMElement(new QName(COLUMN));

    OMElement columnId = fac.createOMElement(new QName(COLUMN_ID));
    columnId.setText(String.valueOf(id));
    columnElement.addChild(columnId);

    OMElement columnTable = fac.createOMElement(new QName(COLUMN_DATA_TABLE));
    columnTable.setText(column.getColumnFamilyName());
    columnElement.addChild(columnTable);

    OMElement columnField = fac.createOMElement(new QName(COLUMN_DATA_FIELD));
    columnField.setText(column.getColumnName());
    columnElement.addChild(columnField);

    OMElement primaryColElement = fac.createOMElement(new QName(PRIMARY_COLUMN));
    if (column.isPrimaryColumn()) {
        primaryColElement.setText(PRIMARY_COLUMN_TRUE);
    } else {
        primaryColElement.setText(PRIMARY_COLUMN_FALSE);
    }
    columnElement.addChild(primaryColElement);

    tableReportElement.addChild(columnElement);
}
 
Example 4
private OMElement getSleepOperationRequestForIterator() throws XMLStreamException {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMElement omeSleep = fac.createOMElement("sleepOperation", null);
    OMElement omeLoad1 = fac.createOMElement("load", null);
    omeLoad1.setText("1000");
    omeSleep.addChild(omeLoad1);

    OMElement omeLoad2 = fac.createOMElement("load", null);
    omeLoad2.setText("1000");
    omeSleep.addChild(omeLoad2);

    OMElement omeLoad3 = fac.createOMElement("load", null);
    omeLoad3.setText("8000");
    omeSleep.addChild(omeLoad3);

    return omeSleep;

}
 
Example 5
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 Project: micro-integrator   Source File: IterateClient.java    License: Apache License 2.0 6 votes vote down vote up
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 7
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 8
Source Project: product-ei   Source File: Sample705TestCase.java    License: Apache License 2.0 6 votes vote down vote up
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 9
Source Project: product-ei   Source File: LoadbalanceFailoverClient.java    License: Apache License 2.0 6 votes vote down vote up
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 10
Source Project: product-ei   Source File: StockQuoteHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 11
Source Project: carbon-apimgt   Source File: GraphQLAPIHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @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 12
Source Project: micro-integrator   Source File: StockQuoteHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 13
private SOAPEnvelope createDefaultSOAPEnvelope(MessageContext inMsgCtx) {

        String soapNamespace = inMsgCtx.getEnvelope().getNamespace()
                .getNamespaceURI();
        SOAPFactory soapFactory = null;
        if (soapNamespace.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            soapFactory = OMAbstractFactory.getSOAP11Factory();
        } else if (soapNamespace
                .equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            soapFactory = OMAbstractFactory.getSOAP12Factory();
        } else {
            log.error("Unknown SOAP Envelope");
        }
        if (soapFactory != null) {
            return soapFactory.getDefaultEnvelope();
        }

        return null;
    }
 
Example 14
@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 15
Source Project: product-ei   Source File: NestedAggregatesTestCase.java    License: Apache License 2.0 6 votes vote down vote up
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 16
Source Project: micro-integrator   Source File: Sample701TestCase.java    License: Apache License 2.0 6 votes vote down vote up
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;
    }
 
Example 17
Source Project: carbon-apimgt   Source File: GraphQLQueryAnalysisHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param errorCodeValue error code
 * @param message        fault message
 * @param description    description of the fault message
 * @return the OMElement
 */
private OMElement getFaultPayload(int errorCodeValue, String message, 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(errorCodeValue + "");
    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 18
Source Project: micro-integrator   Source File: PolicyUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static OMElement getPolicyAsOMElement(Policy policy) {

        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(baos);
            policy.serialize(writer);
            writer.flush();
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            XMLStreamReader xmlStreamReader =
                    XMLInputFactory.newInstance().createXMLStreamReader(bais);
            StAXOMBuilder staxOMBuilder =
                    (StAXOMBuilder) OMXMLBuilderFactory.createStAXOMBuilder(
                            OMAbstractFactory.getOMFactory(), xmlStreamReader);
            return staxOMBuilder.getDocumentElement();

        } catch (Exception ex) {
            throw new RuntimeException("can't convert the policy to an OMElement", ex);
        }
    }
 
Example 19
Source Project: micro-integrator   Source File: AxisServiceClientUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static OMElement createPayLoad() {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://test.com", "test");
    OMElement method = fac.createOMElement("add", omNs);
    OMElement valueOfa = fac.createOMElement("a", omNs);
    OMElement valueOfb = fac.createOMElement("b", omNs);
    valueOfa.addChild(fac.createOMText(valueOfa, "200"));
    valueOfb.addChild(fac.createOMText(valueOfb, "220"));
    method.addChild(valueOfa);
    method.addChild(valueOfb);

    return method;
}
 
Example 20
Source Project: micro-integrator   Source File: AxisOperationClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param payload
 * @return
 */

private SOAPEnvelope createSOAPEnvelope(OMElement payload) {
    fac = OMAbstractFactory.getSOAP11Factory();
    envelope = fac.getDefaultEnvelope();
    envelope.getBody().addChild(payload);
    return envelope;
}
 
Example 21
private OMElement createMultipleQuoteRequestBody(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 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;
    }
 
Example 22
Source Project: micro-integrator   Source File: ServiceInvoker.java    License: Apache License 2.0 5 votes vote down vote up
public ServiceInvoker(String epr, String operation) {

        this.operation = operation;

        Options options = new Options();
        options.setTo(new EndpointReference(epr));
        options.setAction(operation);

        try {
            ConfigurationContext configContext = ConfigurationContextFactory.
                    createConfigurationContextFromFileSystem("client_repo", null);

            client = new ServiceClient(configContext, null);
            options.setTimeOutInMilliSeconds(10000000);

            client.setOptions(options);
            client.engageModule("addressing");

        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        }

        fac = OMAbstractFactory.getOMFactory();
        msg = fac.createOMElement("SampleMsg", null);

        OMElement load = fac.createOMElement("load", null);
        load.setText("1000");
        msg.addChild(load);
    }
 
Example 23
Source Project: micro-integrator   Source File: StockQuoteClient.java    License: Apache License 2.0 5 votes vote down vote up
private OMElement createStandardSimpleRequest(String symbol) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getSimpleQuote", omNs);
    OMElement value1 = fac.createOMElement("symbol", omNs);

    value1.addChild(fac.createOMText(method, symbol));
    method.addChild(value1);

    return method;
}
 
Example 24
private OMElement createQuoteRequestBody() {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);
    OMElement value1 = fac.createOMElement("request", omNs);
    method.addChild(value1);
    return method;
}
 
Example 25
Source Project: product-ei   Source File: ExcelSampleServiceTestCase.java    License: Apache License 2.0 5 votes vote down vote up
@Test(groups = {"wso2.dss"}, invocationCount = 5, dependsOnMethods = "testServiceDeployment")
public void selectOperation() throws AxisFault, XPathExpressionException {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
    OMElement payload = fac.createOMElement("getProducts", omNs);
    OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getProducts");
    log.info("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("<ID>"), "Expected Result Not found");
    Assert.assertTrue(result.toString().contains("<Name>"), "Expected Result Not found");
    log.info("Service invocation success");
}
 
Example 26
public String sessionlessClient() throws AxisFault {

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement value = fac.createOMElement("Value", null);
        value.setText("Sample string");

        Options options = new Options();
        options.setTo(new EndpointReference("http://localhost:8480/services/LBService1"));

        options.setAction("urn:sampleOperation");

        long timeout = Integer.parseInt(getProperty("timeout", "10000000"));
        System.out.println("timeout=" + timeout);
        options.setTimeOutInMilliSeconds(timeout);

        // set addressing, transport and proxy url
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference("http://localhost:8480"));

        serviceClient.setOptions(options);
        String testString = "";

        long i = 0;
        while (i < 100) {

            serviceClient.getOptions().setManageSession(true);
            OMElement responseElement = serviceClient.sendReceive(value);
            String response = responseElement.getText();

            i++;
            System.out.println("Request: " + i + " ==> " + response);
            testString = testString.concat(":" + i + ">" + response + ":");
        }

        return testString;
    }
 
Example 27
Source Project: micro-integrator   Source File: RequestUtil.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 28
Source Project: product-ei   Source File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 29
Source Project: micro-integrator   Source File: SecureServiceClient.java    License: Apache License 2.0 5 votes vote down vote up
private OMElement createSimpleStockQuoteRequest(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;
}
 
Example 30
Source Project: micro-integrator   Source File: CloneClient.java    License: Apache License 2.0 5 votes vote down vote up
private OMElement createSimpleQuoteRequestBody(String symbol) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    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;
}