I have problem with automating a form which uploads file.I used the sample in the test
directory
which uses multipart/form-data.The response i get from the server is blank after submitting
the form.
 
File fileConstruct = new File("C:\\EXPRESS\\Certs\\signingpartner2.p12");
   File fileConstruct1 = new File("C:\\EXPRESS\\Certs\\signingpartner2.der");
   String urlString=(new
java.net.URL("http","localhost",9081,"/qc/securityInbound.do")).toExternalForm();
   WebRequest postRequest = new PostMethodWebRequest(urlString);
   postRequest.setParameter("mode","update");
   postRequest.setParameter("role","Decryption_Pair");
   WebForm form=wc.getResponse(postRequest).getFormWithName("KeyPairForm");
   WebTest.wresp =wc.getCurrentPage();
   System.out.println("Printing the response one -->\n");
   System.out.println(WebTest.wresp.getText());
   WebRequest formSubmit=form.getRequest();
   //formSubmit.setHeaderField("Content-Type","multipart/form-data");
   //formSubmit.setHeaderField("Referer","http://localhost:9081/qc/securityInbound.do");
   //formSubmit.setHeaderField("Accept-Encoding","gzip, deflate");
   formSubmit.selectFile("privateKey",fileConstruct);
   formSubmit.setParameter("role","Decryption_Pair");
   formSubmit.setParameter("password","reiki123");
   formSubmit.selectFile("publicCert",fileConstruct1);
   wc.getResponse(formSubmit);
   WebTest.wresp = wc.getCurrentPage();
   System.out.println("Printing the response two-->\n");
   System.out.println(WebTest.wresp.getText());
 
What am i missing  ? Could some one help
thanks in advance
Thulsi Doss Krishnan