]> SALOME platform Git repositories - tools/siman.git/blob
Salome HOME
1a7e559be702a60da351275f7ddaf7ea4c8d8a99
[tools/siman.git] /
1 /*****************************************************************************
2  * Company         EURIWARE
3  * Application     SIMAN
4  * File            $Id$ 
5  * Creation date   15.11.2012
6  * @author         Author: Maria KRUCHININA
7  * @version        Revision: 
8  *****************************************************************************/
9
10 package org.splat.ws_client.service.salome; 
11
12 import java.io.File;
13 import java.io.FileOutputStream;
14 import java.net.MalformedURLException;
15
16 import org.apache.axiom.soap.SOAP11Constants;
17 import org.apache.axis2.Constants;
18 import org.apache.axis2.client.Options;
19
20
21 /**
22  * @author Maria KRUCHININA
23  *
24  */
25 public class SimanSalomeServiceTestDownloadFile {
26
27         /**
28          * @param args
29          * @throws MalformedURLException 
30          */
31         public static void main(final String[] args) throws Exception {
32                 
33                 Options options = new Options();
34
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");
39                 
40                 // Increase the time out when sending large attachments
41                 options.setTimeOutInMilliSeconds(1000000);
42                 options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
43                 
44                 
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
47                 
48                 org.splat.ws_client.service.salome.SimanSalomeServiceStub.GetFile request = new org.splat.ws_client.service.salome.SimanSalomeServiceStub.GetFile();
49                 
50                 //request.setArgs0("W:/Eclipse workspace/SIMAN/Repository/vault/SimanSalome/100010018/siman-salome.conf");
51                 request.setArgs0("W:/testvideo/IMG_5792.JPG");
52                 
53                 org.splat.ws_client.service.salome.SimanSalomeServiceStub.GetFileResponse response;
54                 
55                 response = stub.getFile(request);
56                 
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();
62                 
63                 FileOutputStream outputStream = new FileOutputStream(clientFile);
64                 
65                 response.get_return().writeTo(outputStream);
66                 
67                 
68                 outputStream.flush();
69                 outputStream.close();
70                 
71                 System.out.print("See copied file on : " + clientFile.getPath());
72         }
73
74 }