Java Code Examples for org.apache.axiom.om.OMElement#build()

The following examples show how to use org.apache.axiom.om.OMElement#build() . 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: LBService2.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement setClientName(OMElement name) {

        name.build();
        name.detach();

        String cName = name.getText();
        serviceContext.setProperty("cName", cName);

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server " + sName + " started a session with client " + cName;
        System.out.println(msg);
        name.setText(msg);

        return name;
    }
 
Example 2
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement sleepOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement timeElement = param.getFirstChildWithName(new QName("load"));
        String time = timeElement.getText();
        try {
            Thread.sleep(Long.parseLong(time));
        } catch (InterruptedException e) {
            throw new AxisFault("Service is interrupted while sleeping.");
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            timeElement.setText("Response from server: " + sName);
        } else {
            timeElement.setText("Response from anonymous server");
        }
        return param;
    }
 
Example 3
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement loadOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement loadElement = param.getFirstChildWithName(new QName("load"));
        String l = loadElement.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            loadElement.setText("Response from server: " + sName);
        } else {
            loadElement.setText("Response from anonymous server");
        }
        return param;
    }
 
Example 4
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement sampleOperation(OMElement param) {
    param.build();
    param.detach();
    
    String sName = "";
    if (System.getProperty("test_mode") != null) {
        sName = org.apache.axis2.context.MessageContext.getCurrentMessageContext().getTo().getAddress();
    } else {
        sName = System.getProperty("server_name");
    }
    if (sName != null) {
        param.setText("Response from server: " + sName);
    } else {
        param.setText("Response from anonymous server");
    }
    return param;
}
 
Example 5
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement loadOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement loadElement = param.getFirstChildWithName(new QName("load"));
        String l = loadElement.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            loadElement.setText("Response from server: " + sName);
        } else {
            loadElement.setText("Response from anonymous server");
        }
        return param;
    }
 
Example 6
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement sleepOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement timeElement = param.getFirstChildWithName(new QName("load"));
        String time = timeElement.getText();
        try {
            Thread.sleep(Long.parseLong(time));
        } catch (InterruptedException e) {
            throw new AxisFault("Service is interrupted while sleeping.");
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            timeElement.setText("Response from server: " + sName);
        } else {
            timeElement.setText("Response from anonymous server");
        }
        return param;
    }
 
Example 7
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement sampleOperation(OMElement param) {
    param.build();
    param.detach();
    
    String sName = "";
    if (System.getProperty("test_mode") != null) {
        sName = org.apache.axis2.context.MessageContext.getCurrentMessageContext().getTo().getAddress();
    } else {
        sName = System.getProperty("server_name");
    }
    if (sName != null) {
        param.setText("Response from server: " + sName);
    } else {
        param.setText("Response from anonymous server");
    }
    return param;
}
 
Example 8
Source File: LBService1.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public OMElement sleepOperation(OMElement param) throws AxisFault {

        param.build();
        param.detach();

        OMElement timeElement = param.getFirstChildWithName(new QName("load"));
        String time = timeElement.getText();
        try {
            Thread.sleep(Long.parseLong(time));
        } catch (InterruptedException e) {
            throw new AxisFault("Service is interrupted while sleeping.");
        }

        String sName = System.getProperty("server_name");
        if (sName != null) {
            timeElement.setText("Response from server: " + sName);
        } else {
            timeElement.setText("Response from anonymous server");
        }
        return param;
    }
 
Example 9
Source File: LBService2.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public OMElement loadOperation(OMElement topParam) {

        topParam.build();
        topParam.detach();

        OMElement param = topParam.getFirstChildWithName(new QName("load"));
        String l = param.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        Long c = null;
        Object o = serviceContext.getProperty("count");
        if (o == null) {
            c = new Long(1);
            serviceContext.setProperty("count", c);
        } else {
            c = (Long) o;
            c = new Long(c.longValue() + 1);
            serviceContext.setProperty("count", c);
        }

        String cName = "anonymous";
        Object cn = serviceContext.getProperty("cName");
        if (cn != null) {
            cName = (String) cn;

        }

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
        System.out.println(msg);

        param.setText(msg);

        return topParam;
    }
 
Example 10
Source File: Xds.java    From openxds with Apache License 2.0 4 votes vote down vote up
public OMElement echo(OMElement sor) {
	sor.build();
	return sor;
}
 
Example 11
Source File: LBService2.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public OMElement loadOperation(OMElement topParam) {

        topParam.build();
        topParam.detach();

        OMElement param = topParam.getFirstChildWithName(new QName("load"));
        String l = param.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        Long c = null;
        Object o = serviceContext.getProperty("count");
        if (o == null) {
            c = new Long(1);
            serviceContext.setProperty("count", c);
        } else {
            c = (Long) o;
            c = new Long(c.longValue() + 1);
            serviceContext.setProperty("count", c);
        }

        String cName = "anonymous";
        Object cn = serviceContext.getProperty("cName");
        if (cn != null) {
            cName = (String) cn;

        }

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
        System.out.println(msg);

        param.setText(msg);

        return topParam;
    }
 
Example 12
Source File: LBService2.java    From product-ei with Apache License 2.0 4 votes vote down vote up
public OMElement loadOperation(OMElement topParam) {

        topParam.build();
        topParam.detach();

        OMElement param = topParam.getFirstChildWithName(new QName("load"));
        String l = param.getText();
        long load = Long.parseLong(l);

        for (long i = 0; i < load; i++) {
            System.out.println("Iteration: " + i);
        }

        Long c = null;
        Object o = serviceContext.getProperty("count");
        if (o == null) {
            c = new Long(1);
            serviceContext.setProperty("count", c);
        } else {
            c = (Long) o;
            c = new Long(c.longValue() + 1);
            serviceContext.setProperty("count", c);
        }

        String cName = "anonymous";
        Object cn = serviceContext.getProperty("cName");
        if (cn != null) {
            cName = (String) cn;

        }

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
        System.out.println(msg);

        param.setText(msg);

        return topParam;
    }
 
Example 13
Source File: LBService2.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public OMElement sleepOperation(OMElement topParam) {

        topParam.build();
        topParam.detach();

        OMElement param = topParam.getFirstChildWithName(new QName("load"));
        String l = param.getText();
        long time = Long.parseLong(l);

        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        Long c = null;
        Object o = serviceContext.getProperty("count");
        if (o == null) {
            c = new Long(1);
            serviceContext.setProperty("count", c);
        } else {
            c = (Long) o;
            c = new Long(c.longValue() + 1);
            serviceContext.setProperty("count", c);
        }

        String cName = "anonymous";
        Object cn = serviceContext.getProperty("cName");
        if (cn != null) {
            cName = (String) cn;

        }

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
        System.out.println(msg);

        param.setText(msg);

        return topParam;
    }
 
Example 14
Source File: StockQuoteClient.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private static OMElement buildResponse(OMElement omElement) {
    omElement.build();
    return omElement;
}
 
Example 15
Source File: SecureAxisServiceClient.java    From product-ei with Apache License 2.0 4 votes vote down vote up
private static OMElement buildResponse(OMElement omElement) {
    omElement.build();
    return omElement;
}
 
Example 16
Source File: ToolsTest.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private OMElement loadXML(String filePath) throws Exception {
	FileInputStream in = new FileInputStream(filePath);
	OMElement dsElement = (new StAXOMBuilder(in)).getDocumentElement();
	dsElement.build();
	return dsElement;
}
 
Example 17
Source File: LBService2.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
public OMElement sleepOperation(OMElement topParam) {

        topParam.build();
        topParam.detach();

        OMElement param = topParam.getFirstChildWithName(new QName("load"));
        String l = param.getText();
        long time = Long.parseLong(l);

        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        Long c = null;
        Object o = serviceContext.getProperty("count");
        if (o == null) {
            c = new Long(1);
            serviceContext.setProperty("count", c);
        } else {
            c = (Long) o;
            c = new Long(c.longValue() + 1);
            serviceContext.setProperty("count", c);
        }

        String cName = "anonymous";
        Object cn = serviceContext.getProperty("cName");
        if (cn != null) {
            cName = (String) cn;

        }

        String sName = "anonymous";
        Object s = System.getProperty("server_name");
        if (s != null) {
            sName = (String) s;
        }

        String msg = "Server: " + sName + " processed the request " + c.toString() + " from client: " + cName;
        System.out.println(msg);

        param.setText(msg);

        return topParam;
    }
 
Example 18
Source File: LBService1.java    From micro-integrator with Apache License 2.0 3 votes vote down vote up
public OMElement setClientName(OMElement cName) {

        cName.build();
        cName.detach();

        cName.setText("Sessions are not supported in this service.");

        return cName;
    }
 
Example 19
Source File: LBService1.java    From product-ei with Apache License 2.0 3 votes vote down vote up
public OMElement setClientName(OMElement cName) {

        cName.build();
        cName.detach();

        cName.setText("Sessions are not supported in this service.");

        return cName;
    }
 
Example 20
Source File: LBService1.java    From micro-integrator with Apache License 2.0 3 votes vote down vote up
public OMElement setClientName(OMElement cName) {

        cName.build();
        cName.detach();

        cName.setText("Sessions are not supported in this service.");

        return cName;
    }