Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMElement


    private static OMElement getPayload() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1", "example1");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("Text", omNs);
        value.addChild(fac.createText(value, "Axis2 Echo String "));
        method.addChild(value);

        return method;
    }
View Full Code Here


public class PingClient {
    private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/MyService");

    public static void main(String[] args) {
        try {
            OMElement payload = ClientUtil.getPingOMElement();
            ServiceClient serviceClient = new ServiceClient();

            Options options = new Options();
            serviceClient.setOptions(options);
            options.setTo(targetEPR);
View Full Code Here

    private static OMElement getBody() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac
                .createOMNamespace("http://example1.org/example1", "example1");
        OMElement id = fac.createOMElement("id", omNs);
        id.addChild(fac.createText(id, "Axis2"));
        return id;
    }
View Full Code Here

        //Blocking invocation via wsa mapping
        options.setAction("urn:sample/echo");

        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);
        OMElement result = sender.sendReceive(getBody());

        StringWriter writer = new StringWriter();
        result.serialize(writer);
        writer.flush();

        System.out.println(writer.toString());

    }
View Full Code Here

public class EchoNonBlockingClient {
    private static EndpointReference targetEPR = new EndpointReference("http://127.0.0.1:8080/axis2/services/MyService");

    public static void main(String[] args) {
        try {
            OMElement payload = ClientUtil.getEchoOMElement();
            Options options = new Options();
            options.setTo(targetEPR);
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

            //Callback to handle the response
View Full Code Here

public class EchoNonBlockingDualClient {
    private static EndpointReference targetEPR = new EndpointReference("http://127.0.0.1:8080/axis2/services/MyService");

    public static void main(String[] args) {
        try {
            OMElement payload = ClientUtil.getEchoOMElement();

            Options options = new Options();
            options.setTo(targetEPR);
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
            options.setUseSeparateListener(true);
View Full Code Here

    private void getQueueEntryBody(OMElement element) {
        Iterator iterator = element.getChildren();
        while (iterator.hasNext()) {
            OMNode omNode = (OMNode) iterator.next();
            if (omNode.getType() == OMNode.ELEMENT_NODE) {
                OMElement omElement = (OMElement) omNode;
                if (omElement.getLocalName().equals("QueueEntryBody")) {
                    this.readTheQueue(omElement);
                } else {
                    getQueueEntryBody(omElement);
                }
            }
View Full Code Here

            // Get the repository location from the args
            String repo = args[0];
            String port = args[1];

            OMElement payload = getEchoElement();
            ConfigurationContextFactory fac = new ConfigurationContextFactory();
            ConfigurationContext configContext = fac.createConfigurationContextFromFileSystem(repo);
            ServiceClient serviceClient = new ServiceClient(configContext, null);
            Options options = new Options();
            serviceClient.setOptions(options);
            options.setTo(new EndpointReference("http://127.0.0.1:" + port + "/axis2/services/SecureService"));
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

            //Blocking invocation
            OMElement result = serviceClient.sendReceive(payload);

            StringWriter writer = new StringWriter();
            result.serialize(XMLOutputFactory.newInstance()
                    .createXMLStreamWriter(writer));
            writer.flush();

            System.out.println("Response: " + writer.toString());
View Full Code Here

    private static OMElement getEchoElement() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1", "example1");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("Text", omNs);
        value.addChild(fac.createText(value, "Axis2 Echo String "));
        method.addChild(value);

        return method;
    }
View Full Code Here

        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

TOP

Related Classes of org.apache.axis2.om.OMElement

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.