1 /*****************************************************************************
5 * Creation date 15.11.2012
6 * @author Author: Maria KRUCHININA
8 *****************************************************************************/
10 package org.splat.ws_client.service.salome;
13 import java.io.FileOutputStream;
14 import java.net.MalformedURLException;
16 import org.apache.axiom.soap.SOAP11Constants;
17 import org.apache.axis2.Constants;
18 import org.apache.axis2.client.Options;
22 * @author Maria KRUCHININA
25 public class SimanSalomeServiceTestDownloadFile {
29 * @throws MalformedURLException
31 public static void main(final String[] args) throws Exception {
33 Options options = new Options();
35 options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE);
36 options.setProperty(Constants.Configuration.CACHE_ATTACHMENTS, Constants.VALUE_TRUE);
37 options.setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR, "w:/temp");
38 options.setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD, "4000");
40 // Increase the time out when sending large attachments
41 options.setTimeOutInMilliSeconds(1000000);
42 options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
45 org.splat.ws_client.service.salome.SimanSalomeServiceStub stub =
46 new org.splat.ws_client.service.salome.SimanSalomeServiceStub();//the default implementation should point to the right endpoint
48 org.splat.ws_client.service.salome.SimanSalomeServiceStub.GetFile request = new org.splat.ws_client.service.salome.SimanSalomeServiceStub.GetFile();
50 //request.setArgs0("W:/Eclipse workspace/SIMAN/Repository/vault/SimanSalome/100010018/siman-salome.conf");
51 request.setArgs0("W:/testvideo/IMG_5792.JPG");
53 org.splat.ws_client.service.salome.SimanSalomeServiceStub.GetFileResponse response;
55 response = stub.getFile(request);
57 File clientFile = new File("W:/client_temp2/IMG_5792_out.JPG");
58 //File clientFile = new File("W:/client_temp2/siman-salome.conf");
59 File clientFilePath = new File("W:/client_temp2");
60 clientFilePath.mkdirs();
61 clientFile.createNewFile();
63 FileOutputStream outputStream = new FileOutputStream(clientFile);
65 response.get_return().writeTo(outputStream);
71 System.out.print("See copied file on : " + clientFile.getPath());