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);