The Source for Java Technology Collaboration
User: Password:



Rama Pulavarthi's Blog

Rama Pulavarthi Rama Pulavarthi is a Member of Technical Staff in the Java Web Services group at Sun Microsystems. He currently works on the development of JAX-WS Reference Implementation. He has previously lead the Software Quality Engineering effort of JAX-RPC. He holds a Masters degree in Computer Science from Auburn University in Alabama and Bachelors in Electronics and Communication from JNTU Hyderabad.



JAX-WS Tip for passing XJC options through wsimport.

Posted by ramapulavarthi on August 18, 2008 at 05:14 PM | Permalink | Comments (0)

JAX-WS relies on JAXB for data binding. When you invoke Wsimport Tool on a wsdl, It in-turn calls XJC tool in JAXB RI to generate the beans used by the JAX-WS runtime. Occasionally, You may need to pass XJC specific command line options through wsimport tool to customize the databinding. You can do it easily with Wsimport. This feature has been there from JAX-WS 2.1 and hopefully this blog explains the common questions on its usage.

If you are using XJC directly, you could pass those options on the command-line for XJC tool or as nested <arg> elements incase of XJC ant task. For example, if you want to disable the strict schema correctness checking while compiling the schema.

You can use

/path/to/jaxb/bin/xjc.sh -nv myschema.xsd
or in ant like
<xjc schema="src/myschema.xsd" destdir="src">
	<arg value="-nv" />
</xjc>
More about XJC command-line options can be found here.

But, if you want to customize the XJC behavior using wsimport tool, you can use on of the following method. For the command-line wsimport tool, you can pass xjc options using -B prefix. For passing the similar xjc option as described above, you can use

 
/path/to/jaxws/bin/wsimport.sh -B-nv myservice.wsdl
Notice that XJC options are differentiated from wsimport options by prepending "-B" to the option.

The same through wsimport ant task can be done using the nested <xjcarg> element which follows the same command-line argument mechanism in Ant.

<wsimport wsdl="myservice.wsdl">
  <xjcarg value="-nv"/>
</wsimport>

This mechanism can also be useful for using XJC plugins through wsimport as explained in Kohsuke's blog. Similarly, you can pass episode files created through previous jaxb compilation to Wsimport ant task using the nested <xjcarg> element.



August 2008
Sun Mon Tue Wed Thu Fri Sat
          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            


Search this blog:
  

Categories
Community: Java Web Services and XML
Community: NetBeans
Web Services and XML
Archives

August 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
October 2007
September 2007
July 2007
June 2007
February 2007
January 2007
September 2006
August 2006
June 2006
May 2006
April 2006

Recent Entries

JAX-WS Tip for passing XJC options through wsimport.

Hudson@JavaOne

JDK 6 Update 6 is out



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds