Showing posts with label Wsconsume. Show all posts
Showing posts with label Wsconsume. Show all posts

Monday, October 27, 2014

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

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.




Sunday, November 24, 2013

CreateProcess error=87, The parameter is incorrect Using JBoss eap WSConsume and Ant

Trying to run an ant file, when I got this error:

D:\workspace\test\wsclient-ant.xml:33: java.io.IOException: Cannot run program "C:\Java\jdk1.6.0_20\jre\bin\java.exe": CreateProcess error=87, The parameter is incorrect


This error is generated due to this part of my ant file:

<wsconsume 
fork="true"
keep="true"
verbose="true"
destdir="${binDir}"
sourcedestdir="${sourceDir}"
wsdl="${wsdlUrl}"
binding="${basedir}/jaxbCalendarBinding.xml"/>


and the command invoked was :

Command invoked: org.jboss.ws.tools.cmd.WSConsume -k -b D:\workspace\test\jaxbCalendarBinding.xml -o D:\workspace\test\build\bin\classes -s D:\workspace\test\build\src -v http://localhost:8080/MyService/MyService?wsdl

As the command was too long, and I have specified using fork=true that I would like to generate this task in a separate VM, eclipse was enable to do it.

The solution was to put the fork=false.

Articles les plus consultés