bonjour, à tous je veux faire un petit web service que voici:
En utilisant JBoss et Axis, mettre en place un premier web service :
1/ Mettre en place côté serveur un web service prenant en paramètre un string et traçant dans un fichier traces le string reçu.
2/ Créer un client qui appelle ce web service.
voici mes codes sources:
j'ai fait un projet java normal pour mon client:
Client.java
j'ai crée un serveur en faisant un projet tomcat:Code:
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 import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.namespace.QName; import java.net.URL; public class Client { public static void main (String args[]) { try { String url; url="http://localhost:8080/axis/HelloWorldService.jws"; Service service = new Service(); Call call = (Call)service.createCall(); call.setTargetEndpointAddress(new URL(url)); call.setOperationName(new QName("HelloWorldService", "hello")); Object[] params = new Object[1]; params[0] = "Hello Message"; Object result = call.invoke(params); System.out.println("result is " + result); } catch(Exception e) { e.printStackTrace(); } } }
voici le HelloWorldService;java
j'ai fais également un deploy.wsddCode:
1
2
3
4
5
6
7
8
9 public class HelloWorldService { public String hello (String message){ return "Invoked with" + message; } }
et un adminClient.shCode:
1
2
3
4
5
6
7 . <deployment> <service name="helloworld" provider="java:RPC"> <parameter name="className" value="HelloWorldService"/> <parameter name="allowedMethods" value="*"/> </service> </deployment>
j'essaye donc de déployer ceci, afin de récupérer mon HelloWorldService dans les service d'axis, ca me dit ca "- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.Code:
1
2
3
4
5
6 #!/bin/sh AXIS_HOME=/home/achamame/Bureau/tmp/apache-tomcat-6.0.26/webapps/axis/WEB-INF/lib export CLASSPATH=$AXIS_HOME/axis.jar:$AXIS_HOME/axis-ant.jar:$AXIS_HOME/commons-discovery-0.2.jar:$AXIS_HOME/commons-logging-1.0.4.jar:$AXIS_HOME/jaxrpc.jar:$AXIS_HOME/log4j-1.2.8.jar:$AXIS_HOME/saaj.jar:$AXIS_HOME/wsdl4j-1.5.1.jar java org.apache.axis.client.AdminClient -s /server/services/AdminService $1
Processing file DeployHelloWorldService
Exception: DeployHelloWorldService (No such file or directory)"
et rien n'apparait dans la listes des services d'éclipse...
Si vous pouvez m'aider ca serait sympa.