Package org.apache.ws.commons.soap

Examples of org.apache.ws.commons.soap.SOAPFactory


        }
    }

    public static SOAPEnvelope getRequestEnvelope(String operationName,
                                                  int param1, int param2, String groupContextId) {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        OMNamespace namespace = fac.createOMNamespace(
                "http://axis2/test/namespace1", "ns1");

        OMElement params = fac.createOMElement(operationName, namespace);
        OMElement param1OM = fac.createOMElement("param1", namespace);
        OMElement param2OM = fac.createOMElement("param2", namespace);
        param1OM.setText(Integer.toString(param1));
        param2OM.setText(Integer.toString(param2));
        params.addChild(param1OM);
        params.addChild(param2OM);
        envelope.getBody().setFirstChild(params);

        if (groupContextId != null) {
            OMNamespace axis2Namespace = fac.createOMNamespace(
                    Constants.AXIS2_NAMESPACE_URI,
                    Constants.AXIS2_NAMESPACE_PREFIX);
            SOAPHeaderBlock soapHeaderBlock = envelope.getHeader()
                    .addHeaderBlock(Constants.SERVICE_GROUP_ID, axis2Namespace);
            soapHeaderBlock.setText(groupContextId);
View Full Code Here


        return envelope;
    }

    public static SOAPEnvelope getPreviousRequestEnvelope(String operationName,
                                                          int param, String groupContextId) {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        OMNamespace namespace = fac.createOMNamespace(
                "http://axis2/test/namespace1", "ns1");

        OMElement params = fac.createOMElement(operationName, namespace);
        OMElement paramOM = fac.createOMElement("param", namespace);
        paramOM.setText(Integer.toString(param));
        params.addChild(paramOM);
        envelope.getBody().setFirstChild(params);

        if (groupContextId != null) {
            OMNamespace axis2Namespace = fac.createOMNamespace(
                    Constants.AXIS2_NAMESPACE_URI,
                    Constants.AXIS2_NAMESPACE_PREFIX);
            SOAPHeaderBlock soapHeaderBlock = envelope.getHeader()
                    .addHeaderBlock(Constants.SERVICE_GROUP_ID, axis2Namespace);
            soapHeaderBlock.setText(groupContextId);
View Full Code Here

    public FormModel(Observer observer) {
        this.observer = observer;
    }

    private OMElement getElement(String word) {
        SOAPFactory omfactory = OMAbstractFactory.getSOAP11Factory();
        OMNamespace opN = omfactory.createOMNamespace("urn:GoogleSearch",
                "ns1");
        OMNamespace emptyNs = omfactory.createOMNamespace("", null);

        OMElement method = omfactory.createOMElement("doSpellingSuggestion",
                opN);
        method.declareNamespace("http://www.w3.org/1999/XMLSchema-instance",
                "xsi");
        method.declareNamespace("http://www.w3.org/1999/XMLSchema", "xsd");

        //reqEnv.getBody().addChild(method);
        method.addAttribute("soapenv:encodingStyle",
                "http://schemas.xmlsoap.org/soap/encoding/",
                null);
        OMElement value1 = omfactory.createOMElement("key", emptyNs);
        OMElement value2 = omfactory.createOMElement("phrase", emptyNs);
        value1.addAttribute("xsi:type", "xsd:string", null);
        value2.addAttribute("xsi:type", "xsd:string", null);
        value1.addChild(
                omfactory.createText(value1, PropertyLoader.getGoogleKey()));
        value2.addChild(omfactory.createText(value2, word));

        method.addChild(value1);
        method.addChild(value2);
        return method;
    }
View Full Code Here

        MessageContext msgContext = null;

        String str_ST_index = Integer.toString(asyncClient.getStartIndex());

        defNs = OMAbstractFactory.getSOAP11Factory().createOMNamespace("", "");
        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
        envelope.declareNamespace("http://schemas.xmlsoap.org/soap/envelope/",
                "soapenv");
        envelope.declareNamespace("http://schemas.xmlsoap.org/soap/encoding/",
                "SOAP-ENC");
        envelope.declareNamespace("http://www.w3.org/2001/XMLSchema-instance",
                "xsi");
        envelope.declareNamespace("http://www.w3.org/2001/XMLSchema",
                "xsd");

        operation =
                omFactory.createOMElement("doGoogleSearch",
                        "urn:GoogleSearch",
                        "ns1");
        envelope.getBody().addChild(operation);
        operation.addAttribute("soapenv:encordingStyle",
                "http://schemas.xmlsoap.org/soap/encoding/", null);
View Full Code Here

* OMElements are created for CreateQueueu, ListMyQueues, Read, and Enqueue operations
*/
public class OMElementCreator {
    public static OMElement creatQueueElement(String createQueueElement,
                                              String key) {
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        OMNamespace opN = factory.createOMNamespace(
                "http://webservices.amazon.com/AWSSimpleQueueService/2005-01-01",
                "nsQ");
        OMElement createQueue = factory.createOMElement("CreateQueue", opN);
        OMElement subID = factory.createOMElement("SubscriptionId", opN);
        OMElement request = factory.createOMElement("Request", opN);
        OMElement queueName = factory.createOMElement("QueueName", opN);
        OMElement readLockTimeOutSeconds = factory.createOMElement(
                "ReadLockTimeoutSeconds", opN);
        request.addChild(queueName);
        request.addChild(readLockTimeOutSeconds);
        subID.addChild(factory.createText(key));
        queueName.addChild(factory.createText(createQueueElement));
        readLockTimeOutSeconds.addChild(factory.createText("10"));
        createQueue.addChild(subID);
        createQueue.addChild(request);
        return createQueue;
    }
View Full Code Here

        return createQueue;
    }

    public static OMElement deleteQueueElement(String deleteQueueName,
                                               String key) {
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        OMNamespace opN = factory.createOMNamespace(
                "http://webservices.amazon.com/AWSSimpleQueueService/2005-01-01",
                "nsQ");
        OMElement enque = factory.createOMElement("DeleteQueue", opN);
        OMElement subID = factory.createOMElement("SubscriptionId", opN);
        OMElement request = factory.createOMElement("Request", opN);
        OMElement queueName = factory.createOMElement("QueueName", opN);
        //OMElement queueID = factory.createOMElement("QueueId",opN);
        request.addChild(queueName);
        //request.addChild(queueID);
        subID.addChild(factory.createText(key));
        queueName.addChild(factory.createText(deleteQueueName));
        //queueID.addChild(factory.createText(queueIden));
        enque.addChild(subID);
        enque.addChild(request);
        return enque;
    }
View Full Code Here

    }

    public static OMElement enqueueElement(String queueEntyBody,
                                           String queueIden,
                                           String key) {
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        OMNamespace opN = factory.createOMNamespace(
                "http://webservices.amazon.com/AWSSimpleQueueService/2005-01-01",
                "nsQ");
        OMElement enque = factory.createOMElement("Enqueue", opN);
        OMElement subID = factory.createOMElement("SubscriptionId", opN);
        OMElement request = factory.createOMElement("Request", opN);
        //OMElement queueName = factory.createOMElement("QueueName",opN);
        OMElement queueID = factory.createOMElement("QueueId", opN);
        OMElement queueEntryBodies = factory.createOMElement(
                "QueueEntryBodies", opN);
        OMElement queueEntryBody1 = factory.createOMElement("QueueEntryBody",
                opN);
        queueEntryBodies.addChild(queueEntryBody1);
        //request.addChild(queueName);
        request.addChild(queueID);
        request.addChild(queueEntryBodies);
        subID.addChild(factory.createText(key));
        //queueName.addChild(factory.createText("Test Queue LSF "));
        queueID.addChild(factory.createText(queueIden));
        queueEntryBody1.addChild(factory.createText(queueEntyBody));
        enque.addChild(subID);
        enque.addChild(request);
        return enque;
    }
View Full Code Here

        enque.addChild(request);
        return enque;
    }

    public static OMElement queueListElement(String key) {
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        OMNamespace opN = factory.createOMNamespace(
                "http://webservices.amazon.com/AWSSimpleQueueService/2005-01-01",
                "nsQ");
        OMElement listMyQueues = factory.createOMElement("ListMyQueues", opN);
        OMElement subID = factory.createOMElement("SubscriptionId", opN);
        OMElement request = factory.createOMElement("Request", opN);
        subID.addChild(factory.createText(key));
        listMyQueues.addChild(subID);
        listMyQueues.addChild(request);
        return listMyQueues;
    }
View Full Code Here

        listMyQueues.addChild(request);
        return listMyQueues;
    }

    public static OMElement read(String requiredQueueName, String key) {
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        OMNamespace opN = factory.createOMNamespace(
                "http://webservices.amazon.com/AWSSimpleQueueService/2005-01-01",
                "nsQ");
        OMElement read = factory.createOMElement("Read", opN);
        OMElement subID = factory.createOMElement("SubscriptionId", opN);
        OMElement request = factory.createOMElement("Request", opN);
        OMElement queueName = factory.createOMElement("QueueName", opN);
        //OMElement queueID = factory.createOMElement("QueueId",opN);
        OMElement readCount = factory.createOMElement("ReadCount", opN);
        request.addChild(queueName);
        //request.addChild(queueID);
        request.addChild(readCount);
        subID.addChild(factory.createText(key));
        queueName.addChild(factory.createText(requiredQueueName));
        //queueID.addChild(factory.createText(queueIden));
        readCount.addChild(factory.createText("25"));
        read.addChild(subID);
        read.addChild(request);
        return read;
    }
View Full Code Here

    byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
                                  98};

    protected void setUp() throws Exception {
        super.setUp();
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        ByteArrayOutputStream outStream;
        String boundary;
       
        OMOutputFormat omOutput = new OMOutputFormat();
        boundary = omOutput.getMimeBoundary();

        String contentType = org.apache.ws.commons.om.impl.MIMEOutputUtils
        .getContentTypeForMime(boundary, omOutput.getRootContentId(),
            omOutput.getCharSetEncoding(),SOAP12Constants.SOAP_12_CONTENT_TYPE);
        DataHandler dataHandler;
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        OMText textData = factory.createText(dataHandler, true);
        assertNotNull(textData.getContentID());

        DataHandler dataHandler2 = new DataHandler(
                "Apache Software Foundation", "text/plain");
        OMText text = factory.createText(dataHandler2, true);
        assertNotNull(text.getContentID());
        outStream = new ByteArrayOutputStream();
        outStream.write(("Content-Type: " + contentType).getBytes());
        outStream.write(new byte[]{13,10});
        outStream.write(new byte[]{13,10});
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.soap.SOAPFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.