You could just request the XML as InputStream from the server using a HTTP GET request, and pass the parameters as request parameters:
http://some.server/webapp?period=1&userid=user1
With a method something like the below you can get the stream from the server:
/**
* Returns an InputStream to read from the given HTTP url.
* @param url
* @return InputStream
* @throws IOException
*/
public InputStream get(final String url) throws IOException {
HttpClient httpClient = new DefaultHttpClient();
HttpParams httpParams = httpClient.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT);
HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT);
HttpGet httpget = new HttpGet(url);
HttpResponse httpResponse = httpClient.execute(httpget);
StatusLine statusLine = httpResponse.getStatusLine();
if(! statusLine.getReasonPhrase().equals("OK")) {
throw new IOException(String.format("Request failed with %s", statusLine));
}
HttpEntity entity = httpResponse.getEntity();
return entity.getContent();
}
And then you could use the "Simple" (http://simple.sourceforge.net/) XML library to parse the XML into JAXB-like entities:
/**
* Reads the XML from the given InputStream using "Simple" and returns a list of assignments.
* @param InputStream
* @return List<Assignment>
*/
public List<Assignment> readSimple(final InputStream inputStream) throws Exception {
Serializer serializer = new Persister();
return serializer.read(AssignmentList.class, inputStream).getAssignments();
}
I am doing pretty much that, just with a REST service, so I don't use request parameters.