Java Code Examples for org.apache.axiom.soap.SOAPFactory#createOMNamespace()

The following examples show how to use org.apache.axiom.soap.SOAPFactory#createOMNamespace() . 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 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 2
Source File: IterateClient.java    From micro-integrator with 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 3
Source File: AggregatedRequestClient.java    From product-ei with Apache License 2.0 6 votes vote down vote up
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 4
Source File: EnrichIntegrationReplaceEnvelopeWithPropertyTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private OMElement createQuoteRequestBody(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;
}
 
Example 5
Source File: IterateClient.java    From product-ei with 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;
}
 
Example 6
Source File: CloneClient.java    From micro-integrator with 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;
}
 
Example 7
Source File: IterateClient.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
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 8
Source File: IterateClient.java    From micro-integrator with 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;
}
 
Example 9
Source File: CloneClient.java    From product-ei with 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;
}
 
Example 10
Source File: IterateClient.java    From micro-integrator with 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;
}
 
Example 11
Source File: AggregatedRequestClient.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private OMElement createMultipleQuoteRequestBodynew(String symbol, int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    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);
    }
    return method2;
}
 
Example 12
Source File: EnrichIntegrationReplaceEnvelopeWithPropertyTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private OMElement createQuoteRequestBody(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;
}
 
Example 13
Source File: NestedForEachTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private OMElement createMultipleSymbolPayLoad(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("SYM" + i);
        method.addChild(chkPrice);
    }
    return method;
}
 
Example 14
Source File: CallTemplateWithValuesAndExpressionTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
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 15
Source File: CloneClient.java    From micro-integrator with 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;
}
 
Example 16
Source File: MTOMSwAClient.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public static MessageContext sendUsingSwA(String fileName, String targetEPR) throws IOException {

        Options options = new Options();
        options.setTo(new EndpointReference(targetEPR));
        options.setAction("urn:uploadFileUsingSwA");
        options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);

        ServiceClient sender = createServiceClient();
        sender.setOptions(options);
        OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        MessageContext mc = new MessageContext();

        System.out.println("Sending file : " + fileName + " as SwA");
        FileDataSource fileDataSource = new FileDataSource(new File(fileName));
        DataHandler dataHandler = new DataHandler(fileDataSource);
        String attachmentID = mc.addAttachment(dataHandler);


        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = factory.getDefaultEnvelope();
        OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
        OMElement payload = factory.createOMElement("uploadFileUsingSwA", ns);
        OMElement request = factory.createOMElement("request", ns);
        OMElement imageId = factory.createOMElement("imageId", ns);
        imageId.setText(attachmentID);
        request.addChild(imageId);
        payload.addChild(request);
        env.getBody().addChild(payload);
        mc.setEnvelope(env);

        mepClient.addMessageContext(mc);
        mepClient.execute(true);
        MessageContext response = mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);

        SOAPBody body = response.getEnvelope().getBody();
        String imageContentId = body.
                getFirstChildWithName(new QName("http://services.samples", "uploadFileUsingSwAResponse")).
                getFirstChildWithName(new QName("http://services.samples", "response")).
                getFirstChildWithName(new QName("http://services.samples", "imageId")).
                getText();

        Attachments attachment = response.getAttachmentMap();
        dataHandler = attachment.getDataHandler(imageContentId);
        File tempFile = File.createTempFile("swa-", ".gif");
        FileOutputStream fos = new FileOutputStream(tempFile);
        dataHandler.writeTo(fos);
        fos.flush();
        fos.close();

        System.out.println("Saved response to file : " + tempFile.getAbsolutePath());

        return response;
    }
 
Example 17
Source File: MTOMSwAClient.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public static MessageContext sendUsingSwA(String fileName, String targetEPR) throws IOException {

        Options options = new Options();
        options.setTo(new EndpointReference(targetEPR));
        options.setAction("urn:uploadFileUsingSwA");
        options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);

        ServiceClient sender = createServiceClient();
        sender.setOptions(options);
        OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        MessageContext mc = new MessageContext();

        System.out.println("Sending file : " + fileName + " as SwA");
        FileDataSource fileDataSource = new FileDataSource(new File(fileName));
        DataHandler dataHandler = new DataHandler(fileDataSource);
        String attachmentID = mc.addAttachment(dataHandler);


        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = factory.getDefaultEnvelope();
        OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
        OMElement payload = factory.createOMElement("uploadFileUsingSwA", ns);
        OMElement request = factory.createOMElement("request", ns);
        OMElement imageId = factory.createOMElement("imageId", ns);
        imageId.setText(attachmentID);
        request.addChild(imageId);
        payload.addChild(request);
        env.getBody().addChild(payload);
        mc.setEnvelope(env);

        mepClient.addMessageContext(mc);
        mepClient.execute(true);
        MessageContext response = mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);

        SOAPBody body = response.getEnvelope().getBody();
        String imageContentId = body.
                getFirstChildWithName(new QName("http://services.samples", "uploadFileUsingSwAResponse")).
                getFirstChildWithName(new QName("http://services.samples", "response")).
                getFirstChildWithName(new QName("http://services.samples", "imageId")).
                getText();

        Attachments attachment = response.getAttachmentMap();
        dataHandler = attachment.getDataHandler(imageContentId);
        File tempFile = File.createTempFile("swa-", ".gif");
        FileOutputStream fos = new FileOutputStream(tempFile);
        dataHandler.writeTo(fos);
        fos.flush();
        fos.close();

        System.out.println("Saved response to file : " + tempFile.getAbsolutePath());

        return response;
    }
 
Example 18
Source File: PayloadFormatValueAndExpressionTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
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;
    }
 
Example 19
Source File: PayloadFormatValueAndExpressionTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
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;
    }
 
Example 20
Source File: PayloadFormatWithNoArgumentTestCase.java    From product-ei with Apache License 2.0 3 votes vote down vote up
private OMElement createPayload() {   // creation of payload for echoString

        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();

        OMNamespace omNs = fac.createOMNamespace("http://service.carbon.wso2.org", "ns");
        OMElement getOperation = fac.createOMElement("echoString", omNs);
        OMElement getName = fac.createOMElement("s", omNs);

        getName.addChild(fac.createOMText(getName, "name"));
        getOperation.addChild(getName);

        return getOperation;
    }