A Technology Blog About Code Development, Architecture, Operating System, Hardware, Tips and Tutorials for Developers.

Sunday, November 25, 2012

Have you run APT to generate them?

8:00:00 PM Posted by Satish , , , , No comments
While deploying a document style web service, you may get the following exception.

1
2
SEVERE: WSSERVLET11: failed to parse runtime descriptor: runtime modeler error: Wrapper class com.techiekernel.ws.jaxws.document.jaxws.CallFooBar is not found. Have you run APT to generate them?
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.techiekernel.ws.jaxws.document.jaxws.CallFooBar is not found. Have you run APT to generate them?

If you remember in my article "RPC-style vs Document-Style Web Service", I have said in document style web service there are no overheads of marshalling and de marshalling associated with SOAP engine. So you have to generate the artifacts for the web services. You can use the wsgen tool from JDK to generate the artifacts or you can use the maven plugin to achieve that. I am doing to show both way to generate the artifacts.

1
wsgen -verbose -keep -cp target/classes/ com.techiekernel.ws.jaxws.document.FooBarImpl -d src/main/java/

After adding the plug in the pom.xml will look like this.


 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
66
67
68
69
70
71
72
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.techiekernel</groupId>
 <artifactId>webservice-JAX-WS-Web</artifactId>
 <packaging>war</packaging>
 <version>1.0-SNAPSHOT</version>
 <name>webservice-JAX-WS-Web Maven Webapp</name>
 <url>http://maven.apache.org</url>
 <dependencies>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>3.8.1</version>
   <scope>test</scope>
  </dependency>
  <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.1.5</version>
        </dependency>
 </dependencies>
 <build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
   </plugin>
   <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
     <source>1.5</source>
     <target>1.5</target>
    </configuration>
   </plugin>
   <!-- wsgen for web service artifact generation -->
   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>1.11</version>
    <executions>
     <execution>
      <id>document</id>
      <goals>
       <goal>wsgen</goal>
      </goals>
      <configuration>
       <sei>com.techiekernel.ws.jaxws.document.FooBarImpl</sei>
       <genWsdl>true</genWsdl>
       <keep>true</keep>
       <verbose>true</verbose>
      </configuration>
     </execution>
     <execution>
      <id>mtom</id>
      <goals>
       <goal>wsgen</goal>
      </goals>
      <configuration>
       <sei>com.techiekernel.ws.jaxws.mtom.FileImageServer</sei>
       <genWsdl>true</genWsdl>
       <keep>true</keep>
       <verbose>true</verbose>
      </configuration>
     </execution>
    </executions>
   </plugin>
  </plugins>
  <finalName>webservice-JAX-WS-Web</finalName>
 </build>
</project>

Now the artifacts needed for document style web service will be generated automatically. Now you are good to deploy the application.

0 comments:

Post a Comment