cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache CXF Documentation > Java to WS
Date Sun, 14 Nov 2010 03:36:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">Java
to WS</a></h2>
    <h4>Page <b>edited</b> by             <a href="">Robert
                         <h4>Changes (0)</h4>
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. See Also <br> <br></td></tr>
            <tr><td class="diff-unchanged" >idl2wsdl, java2js, wsdl2corba, [wsdl2java|],
[wsdl2js|], [wsdl2service|],
[wsdl2soap|], [wsdl2xml|],
[wsdlvalidator|] and [xsd2wsdl|].
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h3><a name="JavatoWS-Name"></a>Name</h3>

<p>java2ws - uses a Web service endpoint's implementation (SEI) class and associated
types classes to generate a WSDL file, wrapper bean ,server side code used to start this web
service and client side code.</p>

<h3><a name="JavatoWS-Synopsis"></a>Synopsis</h3>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
<pre>   java2ws -databinding &lt;jaxb or aegis&gt; -frontend &lt;jaxws or
simple&gt; -wsdl -wrapperbean -client -server -ant
           -o &lt;output-file&gt; -d &lt;resource-directory&gt; -classdir
&lt;compile-classes-directory&gt; -cp &lt;class-path&gt; 
           -soap12 -t &lt;target-namespace&gt; -beans &lt;ppathname of the bean
definition file&gt;* 
           -servicename &lt;service-name&gt; -portname &lt;port-name&gt; -createxsdimports
-h -v -verbose -quiet {classname}

<h3><a name="JavatoWS-Description"></a>Description</h3>

<p>  <b>java2ws</b> uses a Web service endpoint's implementation (SEI) class
and associated types classes to generate a WSDL file, wrapper bean ,server side code used
to start this web service and client side code.</p>

<h3><a name="JavatoWS-Options"></a>Options</h3>

<p>The options used to manage the code generation process are reviewed in the following
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Interpretation </th>
<td class='confluenceTd'> <tt>-?</tt>,<tt>-h</tt>,<tt>-help</tt>
<td class='confluenceTd'> Displays the online help for this utility. </td>
<td class='confluenceTd'> -o </td>
<td class='confluenceTd'> Specifies the name of the generated WSDL file. </td>
<td class='confluenceTd'> --databinding</td>
<td class='confluenceTd'>Specify the data binding (aegis or jaxb). Default is jaxb for
jaxws frontend, and aegis for simple frontend.</td>
<td class='confluenceTd'>-frontend</td>
<td class='confluenceTd'> Specify the frontend to use.  jaxws and the simple frontend
are supported.</td>
<td class='confluenceTd'>-wsdl</td>
<td class='confluenceTd'>Specify to generate the WSDL file.</td>
<td class='confluenceTd'>-wrapperbean</td>
<td class='confluenceTd'>Specify to generate the wrapper and fault bean</td>
<td class='confluenceTd'>-client</td>
<td class='confluenceTd'>Specify to generate client side code</td>
<td class='confluenceTd'>-server</td>
<td class='confluenceTd'>Specify to generate server side code</td>
<td class='confluenceTd'>-ant</td>
<td class='confluenceTd'>Specify to generate an Ant build.xml script</td>
<td class='confluenceTd'> -cp </td>
<td class='confluenceTd'> Specify the SEI and types class search path of directories
and zip/jar files. </td>
<td class='confluenceTd'> -soap12 </td>
<td class='confluenceTd'> Specifies that the generated WSDL is to include a SOAP 1.2
binding. </td>
<td class='confluenceTd'> -t </td>
<td class='confluenceTd'> Specifies the target namespace to use in the generated WSDL
file. </td>
<td class='confluenceTd'> -servicename </td>
<td class='confluenceTd'> Specifies the value of the generated service element's name
attribute. </td>
<td class='confluenceTd'> -v </td>
<td class='confluenceTd'> Displays the version number for the tool. </td>
<td class='confluenceTd'> -verbose </td>
<td class='confluenceTd'> Displays comments during the code generation process. </td>
<td class='confluenceTd'> -quiet </td>
<td class='confluenceTd'> Suppresses comments during the code generation process. </td>
<td class='confluenceTd'> -s </td>
<td class='confluenceTd'> The directory in which the generated source files(wrapper
bean ,fault bean ,client side or server side code) are placed.</td>
<td class='confluenceTd'> -classdir </td>
<td class='confluenceTd'> The directory in which the generated sources are compiled
into.  If not specified, the files are not compiled. </td>
<td class='confluenceTd'> -portname</td>
<td class='confluenceTd'> Specify the port name to use in the generated wsdl. </td>
<td class='confluenceTd'> -createxsdimports</td>
<td class='confluenceTd'>Output schemas to separate files and use imports to load them
instead of inlining them into the wsdl. </td>
<td class='confluenceTd'> -d </td>
<td class='confluenceTd'> The directory in which the resource files are placed, wsdl
file will be placed into this directory by default</td>
<td class='confluenceTd'> classname </td>
<td class='confluenceTd'> Specifies the name of the SEI class. </td>

<p>You must include the <tt>classname</tt> argument. All other arguments
are optional and may be listed in any order. This tool will search and load the service endpoint
class and types classes. Make certain these classes are on the <tt>CLASSPATH</tt>
or in a location identified through the <tt>-cp</tt> flag. If none of "-wsdl ,
- wrapperbean, -client, -server" flags are specified, java2ws will generate nothing.</p>

<p><a name="JavatoWS-usingant"></a></p>

<h3><a name="JavatoWS-Examples"></a>Examples</h3>

<p>   <tt>java2ws -wsdl -d ./resource org.apache.hello_world_soap_http.Greeter</tt><br/>
   <tt>java2ws -cp ./tmp org.apache.hello_world_soap_http.Greeter -wsdl</tt> <br/>
   <tt>java2ws -o hello.wsdl -wsdl org.apache.hello_world_soap_http.Greeter</tt>
   <tt>java2ws -client -server -s ./src org.apache.hello_world_soap_http.Greeter</tt><br/>
   <tt>java2ws -wrapperbean -classdir ./classes org.apache.hello_world_soap_http.Greeter</tt></p>

<h3><a name="JavatoWS-Usingjava2wswithAnt"></a>Using java2ws with Ant</h3>

<p>The java2ws command can be wrapped inside an Ant target as shown below:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>?&gt;</span>
<span class="code-tag">&lt;project name=<span class="code-quote">"cxf java2ws"</span>
basedir=<span class="code-quote">"."</span>&gt;</span>   
   <span class="code-tag">&lt;property name=<span class="code-quote">"cxf.home"</span>
location =<span class="code-quote">"/usr/myapps/cxf-trunk"</span>/&gt;</span>
   <span class="code-tag">&lt;property name=<span class="code-quote">"build.classes.dir"</span>
location =<span class="code-quote">"${basedir}/build/classes"</span>/&gt;</span>

   <span class="code-tag">&lt;path id=<span class="code-quote">"cxf.classpath"</span>&gt;</span>
      <span class="code-tag">&lt;pathelement location=<span class="code-quote">"${build.classes.dir}"</span>/&gt;</span>
      <span class="code-tag">&lt;fileset dir=<span class="code-quote">"${cxf.home}/lib"</span>&gt;</span>
         <span class="code-tag">&lt;include name=<span class="code-quote">"*.jar"</span>/&gt;</span>
      <span class="code-tag">&lt;/fileset&gt;</span>
   <span class="code-tag">&lt;/path&gt;</span>
   <span class="code-tag">&lt;target name=<span class="code-quote">"cxfJavaToWS"</span>&gt;</span>
      <span class="code-tag">&lt;java classname=<span class="code-quote">""</span>
fork=<span class="code-quote">"true"</span>&gt;</span>
         <span class="code-tag">&lt;arg value=<span class="code-quote">"-wsdl"</span>/&gt;</span>
         <span class="code-tag">&lt;arg value=<span class="code-quote">"-o"</span>/&gt;</span>
         <span class="code-tag">&lt;arg value=<span class="code-quote">"hello.wsdl"</span>/&gt;</span>
         <span class="code-tag">&lt;arg value=<span class="code-quote">"service.Greeter"</span>/&gt;</span>
         <span class="code-tag">&lt;classpath&gt;</span>
            <span class="code-tag">&lt;path refid=<span class="code-quote">"cxf.classpath"</span>/&gt;</span>
         <span class="code-tag">&lt;/classpath&gt;</span>
      <span class="code-tag">&lt;/java&gt;</span>
   <span class="code-tag">&lt;/target&gt;</span>
<span class="code-tag">&lt;/project&gt;</span>

<p>Make sure you set the "fork=true" attribute for the &lt;java/&gt; task as
shown above.  Also, remember to keep each word or flag within the command line options in
its own &lt;arg/&gt; element (e.g., do not use &lt;arg value="-o hello.wsdl"/&gt;,
but split them up into two &lt;arg/&gt; elements as done here.)</p>

<h3><a name="JavatoWS-SeeAlso"></a>See Also</h3>

<p>idl2wsdl, java2js, wsdl2corba, <a href=""
class="external-link" rel="nofollow">wsdl2java</a>, <a href=""
class="external-link" rel="nofollow">wsdl2js</a>, <a href=""
class="external-link" rel="nofollow">wsdl2service</a>, <a href=""
class="external-link" rel="nofollow">wsdl2soap</a>, <a href=""
class="external-link" rel="nofollow">wsdl2xml</a>, <a href=""
class="external-link" rel="nofollow">wsdlvalidator</a> and <a href=""
class="external-link" rel="nofollow">xsd2wsdl</a>.</p>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
        <a href="">View
        <a href="">View
        <a href=";showCommentArea=true#addcomment">Add

View raw message