builder.addInput("type", documentType);
builder.setHostAndPort(remoteHostname, remotePort);
if (remoteUsername != null)
builder.addCredentials(remoteUsername, remotePassword);
ResponseParser parser = ResponseParser.performHttpRequest(remoteHostname, remotePort, builder);
if (parser.getStatus() == 404)
throw new IOException("The remote resource, " + remoteUrl() + ", was not found.");
if (parser.getStatus() == 401)
throw new AuthenticationRequiredException(remoteUrl());
String body = parser.getBody();
return XmlUtil.newDocument(body);
}