Bonjour
j'ai codé mon service et à partir du service, je souhaite générer mon wsdl, lorsque je tape la ligne de commande maven eclipse:eclipse, j'obtiens une erreur:
Voici mon interface service et son implementation:[ERROR] FATAL ERROR
[INFO] -----------------------------------------------------------------------
[INFO] null
Illegal character in opaque part at index 2: C:\workspace\spring-mvc-webapp/sr
main/wsdl/HelloWorld.wsdl
[INFO] -----------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at java.net.URI.resolve(URI.java:1028)
at org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo
ava:307)
at org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.jav
257)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlu
nManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(De
ultLifecycleExecutor.java:558)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWith
fecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLife
cle(DefaultLifecycleExecutor.java:924)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(D
aultLifecycleExecutor.java:767)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(De
ultLifecycleExecutor.java:529)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalo
Goal(DefaultLifecycleExecutor.java:512)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Def
ltLifecycleExecutor.java:482)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndH
dleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegm
ts(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(Default
fecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:43
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at in
x 2: C:\workspace\spring-mvc-webapp/src/main/wsdl/HelloWorld.wsdl
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parse(URI.java:3019)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
Voici un extrait du pom
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 package demo.spring; import javax.jws.WebService; @WebService public interface HelloWorld { String SayHi(String text); } package demo.spring; import javax.jws.WebService; @WebService(endpointInterface="demo.spring.HelloWorld") public class HelloWorldImpl implements HelloWorld { public String SayHi(String text) { System.out.println("sayHi called"); return "Hello " + text; } }
Voici mes deux fichiers xml:
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 <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/wsdl/HelloWorld.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin>
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 beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxws:endpoint id="helloWorld" implementor="demo.spring.HelloWorldImpl" address="/HelloWorld" /> </beans>
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 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <!-- déclare la servlet frontale (très similaire à struts) --> <servlet> <servlet-name>spring-mvc-webapp</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <!-- Toutes les requêtes se terminant par .html seront servis par la servlet frontal --> <servlet-mapping> <servlet-name>spring-mvc-webapp</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/beans.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>CXFServlet</servlet-name> <display-name>CXF Servlet</display-name> <servlet-class> org.apache.cxf.transport.servlet.CXFServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
Au niveau du pom lorsque j'enleve ceci
J'obtiens un build successfull, mais on wsdl est pas generé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 <wsdlOptions> <wsdlOption> <wsdl>${basedir}\src\main\wsdl\HelloWorld.wsdl</wsdl> </wsdlOption> </wsdlOptions>
Je vous remercie de votre aide
Partager