Bonjour,
J'ai un prb lors de l'utilisation de HttpClient.
Les erreurs sont:
voici le code:Code:
1
2
3
4
5
6
7
8
9
10
11
12 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:66) at MetaDataExchange.doMEX(MetaDataExchange.java:74) at HTTPClientTest.main(HTTPClientTest.java:68) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 3 more
merci d'avance !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 HttpClient client = new HttpClient(); //String endpoint = mexAddress; PostMethod post = new PostMethod(mexAddress); //PostMethod post = new PostMethod("http://search.yahoo.com/search"); post.setRequestEntity(new StringRequestEntity(mex)); post.setRequestHeader("Content-type", "text/xml; charset=utf-8"); post.setRequestHeader("SOAPAction", "\"\""); int statusCode; try { statusCode = client.executeMethod(post); trace(statusCode); String response = post.getResponseBodyAsString(); if (statusCode == 200) { trace("RESPONSE\n" + response); } else { trace("FAULT\n" + response); } return response; } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { post.releaseConnection(); }