Salut,
je voudrait manipuler les fichiers et les dossiers du repository dans mon application JAVA en utilisant les webServices. la création de fichiers se passe très bien, avec la fonction server.getWSClient().addOrModifyResource(resourceDescripto, monFichier)
par contre, quand je fait ça avec un dossier, ça me génère une exception.
voici le code utilisé :
et voici l'exception levée :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 File folder = new File("./temp/folder"); JServer outserver = new JServer(); outserver.setUsername("jasperadmin"); outserver.setPassword("jasper"); outserver.setUrl("http://localhost:8080/jasperserver-pro/services/repository"); ResourceDescriptor folderdesc = new ResourceDescriptor(); folderdesc.setUriString("/reports/heroesReports"); try { folderdesc = outserver.getWSClient().get(folderdesc, folder); } catch (Exception ex) { System.err.println("oups"+ex); } ResourceDescriptor newCopy = new ResourceDescriptor(); newCopy.setName("folderTest"); newCopy.setResourceType(ResourceDescriptor.TYPE_FOLDER); newCopy.setLabel("folderTestLabel"); newCopy.setDescription("folderTestLabel"); newCopy.setParentFolder("/"); newCopy.setUriString(newCopy.getParentFolder() + "/" + newCopy.getName()); newCopy.setWsType(ResourceDescriptor.TYPE_FOLDER); newCopy.setHasData(true); newCopy.setIsNew(true); JServer server = new JServer(); server.setUsername("jasperadmin"); server.setPassword("jasper"); server.setUrl("http://localhost:8081/jasperserver-pro/services/repository"); try { ResourceDescriptor result = server.getWSClient().addOrModifyResource(newCopy, folder); } catch (Exception ex) { System.err.println("oups 2"+ex); }
je ne sais pas pourquoi il me dit FileNotFoundException, j'ai la même erreur que j'utilise un dossier d'un autre repository ou un dossier dans mon système de fichier.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 java.lang.Exception: Attachment not present! at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.get(WSClient.java:282) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.get(WSClient.java:226) at jaspermigration.Main.main(Main.java:69) oupsjava.lang.Exception: Attachment not present! 25 mars 2008 16:51:26 org.apache.axis.Message writeTo GRAVE: Exception: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.io.FileNotFoundException: .\temp\folder (Accès refusé) faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:java.io.FileNotFoundException: .\temp\folder (Accès refusé) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at javax.activation.FileDataSource.getInputStream(FileDataSource.java:82) at javax.activation.DataHandler.getInputStream(DataHandler.java:222) at org.apache.axis.attachments.DimeBodyPart.send(DimeBodyPart.java:323) at org.apache.axis.attachments.DimeBodyPart.write(DimeBodyPart.java:233) at org.apache.axis.attachments.DimeMultiPart.write(DimeMultiPart.java:46) at org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:511) at org.apache.axis.Message.writeTo(Message.java:545) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:511) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.jaspersoft.jasperserver.irplugin.wsclient.RepositorySoapBindingStub.put(RepositorySoapBindingStub.java:202) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.modifyReportUnitResource(WSClient.java:498) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.addOrModifyResource(WSClient.java:442) at jaspermigration.Main.main(Main.java:89) {http://xml.apache.org/axis/}hostname:bull-prjjspr01 java.io.FileNotFoundException: .\temp\folder (Accès refusé) at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:512) at org.apache.axis.Message.writeTo(Message.java:545) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:511) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.jaspersoft.jasperserver.irplugin.wsclient.RepositorySoapBindingStub.put(RepositorySoapBindingStub.java:202) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.modifyReportUnitResource(WSClient.java:498) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.addOrModifyResource(WSClient.java:442) at jaspermigration.Main.main(Main.java:89) Caused by: java.io.FileNotFoundException: .\temp\folder (Accès refusé) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at javax.activation.FileDataSource.getInputStream(FileDataSource.java:82) at javax.activation.DataHandler.getInputStream(DataHandler.java:222) at org.apache.axis.attachments.DimeBodyPart.send(DimeBodyPart.java:323) at org.apache.axis.attachments.DimeBodyPart.write(DimeBodyPart.java:233) at org.apache.axis.attachments.DimeMultiPart.write(DimeMultiPart.java:46) at org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:511) ... 16 more java.lang.Exception: 1 - Access is denied at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.modifyReportUnitResource(WSClient.java:502) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.addOrModifyResource(WSClient.java:442) at jaspermigration.Main.main(Main.java:89) oups 2java.lang.Exception: 1 - Access is denied
des idées ?
Partager