}
if (requestMethod.toUpperCase().equals("GET")) {
URL url = new URL(requestUrl);
URLConnection urlConn = url.openConnection();
urlConn.setDoInput(true);
StAXBuilder builder = new StAXOMBuilder(urlConn.getInputStream());
OMElement omEl = builder.getDocumentElement();
builder.close();
return omEl;
} else if (requestMethod.toUpperCase().equals("POST")) {
URL url = new URL(requestUrl);
URLConnection urlConn = url.openConnection();
urlConn.setDoOutput(true);
urlConn.getOutputStream().close();
StAXBuilder builder = new StAXOMBuilder(urlConn.getInputStream());
OMElement omEl = builder.getDocumentElement();
builder.close();
return omEl;
} else {
throw new IllegalArgumentException(
"getAsResource() - HTTP method '" + requestMethod + "' not supported");
}