Monday, October 27, 2014

JBoss 7 WSConsume with Maven : Generate Web Service Client with WSconsume

Removed
I have an application running on JBoss EAP 6. I wants to cnsume a Web service. So I need to generate Web Service Client using maven. For that reason I need to declare this lines in my pom.xml :


 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
<dependencies>
 <dependency>
  <groupId>org.jboss.ws.cxf</groupId>
  <artifactId>jbossws-cxf-client</artifactId>
  <version>4.1.1.Final</version>
  <scope>provided</scope>
 </dependency>

</dependencies>

<plugins>
 <plugin>
  <groupId>org.jboss.ws.plugins</groupId>
  <artifactId>maven-jaxws-tools-plugin</artifactId>
  <version>1.1.1.Final</version>
  <executions>
   <execution>
    <id>myService</id>
    <goals>
     <goal>wsconsume</goal>
    </goals>
    <configuration>
     <wsdls>
     
      <wsdl>http://localhost:8080/test_project/myService.ws?wsdl</wsdl>
      <wsdl>http://localhost:8080/test_project/mySecondService?wsdl</wsdl>
     </wsdls>
     <targetPackage>org.dcp.clients.myservice</targetPackage>
     <sourceDirectory>${project.basedir}/src/main/java
     </sourceDirectory>
     <extension>true</extension>
     <verbose>true</verbose>
     <goalPrefix>wsconsume</goalPrefix>
    </configuration>
   </execution>

   <execution>
    <id>userService</id>
    <goals>
     <goal>wsconsume</goal>
    </goals>
    <configuration>
     <wsdls>
      <wsdl>http://localhost:8080/user_project/UserService.ws?wsdl</wsdl>
     </wsdls>
     <targetPackage>org.dcp.clients.userservice</targetPackage>
     <sourceDirectory>${project.basedir}/src/main/java
     </sourceDirectory>
     <extension>true</extension>
     <verbose>true</verbose>
     <goalPrefix>wsconsume</goalPrefix>
    </configuration>
   </execution>
  </executions>
 </plugin>

 <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
   <failOnMissingWebXml>false</failOnMissingWebXml>
  </configuration>
 </plugin>

</plugins>


So next, just need to run clean install and all the classes will be generated. Some problems may accur when your web service throws some User Exceptions. This will be discussed later.




No comments :

Post a Comment

Articles les plus consultés