Hello, I need a little help on making requests from a desktop client to a 
RESTEasy service. The service works great with a web form, but this is not the 
intended client, I need to implement client in a desktop application. I've 
followed examples on the web, but I still cannot get my client to work:

I am using RESTEasy version 2.3.5.Final
I can use the service from the a form, but not from a client.

Relevant code:

My form POJO:

    public class FileUploadForm {

      private byte[] data;

      private String user;

      private String password;

      private String filename;

      public FileUploadForm() {}

      public byte[] getData() {
       return data;

      public void setData(final byte[] data) {
          this.data = data;

      public String getUser() {
        return user;

      public void setUser(String user) {
        this.user = user;

      public String getPassword() {
        return password;

      public void setPassword(String password) {
        this.password = password;

       public String getFilename() {
        return filename;

      public void setFilename(String filename) {
        this.filename = filename;


My service side method definition:

    public Response add(@MultipartForm FileUploadForm form);

My client side interface:

    public interface MultipartClient
      public Response add(@MultipartForm FileUploadForm form);

My test code:

    MultipartClient client = ProxyFactory.create(MultipartClient.class, BASEURL 
    FileUploadForm upload = new FileUploadForm();
    String fileToUpload = "file.zip"
    FileInputStream fis = new FileInputStream(fileToUpload);
    byte[] fileData = IOUtils.toByteArray(fis);
    Response response = client.add(upload);
    System.out.println("Response status: "  + response.getStatus());
    System.out.println("Response message: "  + response.getEntity());
    assertTrue(HttpResponseCodes.SC_OK == response.getStatus());

I get a response code 405 from the server. I am at my wits' end.

Please consider the environment before printing this email.
NIWA is the trading name of the National Institute of Water & Atmospheric 
Research Ltd.
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
Resteasy-users mailing list

Reply via email to