private Request newRequest(
     ILocator locator, IContext context, Document document, String methodName) throws IOException {
   context.setContentType("text/xml; charset=\"UTF8\""); // $NON-NLS-1$
   if (document == null)
     return new Request(methodName, URLEncoder.encode(new URL(locator.getResourceURL())), context);
   RequestBodyWriter writer = new RequestBodyWriter(document, "UTF8"); // $NON-NLS-1$
   return new Request(
       methodName, URLEncoder.encode(new URL(locator.getResourceURL())), context, writer);
 }