cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Java to WS
Date Tue, 20 Jul 2010 17:35:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<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="https://cwiki.apache.org/confluence/display/CXF20DOC/Java+to+WS">Java
to WS</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
        <br/>
                         <h4>Changes (1)</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" >h2. Description <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >*java2ws* uses a Web service endpoint&#39;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 <span class="diff-added-words"style="background-color:
#dfd;">code.</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Example <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>(Under development)</p>
<h2><a name="JavatoWS-Synopsis"></a>Synopsis</h2>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<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}
</pre>
</div></div>

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

<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>

<h2><a name="JavatoWS-Example"></a>Example</h2>

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

<h2><a name="JavatoWS-Arguments"></a>Arguments</h2>

<p>The arguments used to manage the code generation process are reviewed in the following
table.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Interpretation </th>
</tr>
<tr>
<td class='confluenceTd'> -? </td>
<td class='confluenceTd'> Displays the online help for this utility. </td>
</tr>
<tr>
<td class='confluenceTd'> -help </td>
</tr>
<tr>
<td class='confluenceTd'> -h </td>
</tr>
<tr>
<td class='confluenceTd'> -o </td>
<td class='confluenceTd'> Specifies the name of the generated WSDL file. </td>
</tr>
<tr>
<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>
</tr>
<tr>
<td class='confluenceTd'>-frontend</td>
<td class='confluenceTd'> Specify the frontend to use.  jaxws and the simple frontend
are supported.</td>
</tr>
<tr>
<td class='confluenceTd'>-wsdl</td>
<td class='confluenceTd'>Specify to generate the WSDL file.</td>
</tr>
<tr>
<td class='confluenceTd'>-wrapperbean</td>
<td class='confluenceTd'>Specify to generate the wrapper and fault bean</td>
</tr>
<tr>
<td class='confluenceTd'>-client</td>
<td class='confluenceTd'>Specify to generate client side code</td>
</tr>
<tr>
<td class='confluenceTd'>-server</td>
<td class='confluenceTd'>Specify to generate server side code</td>
</tr>
<tr>
<td class='confluenceTd'>-ant</td>
<td class='confluenceTd'>Specify to generate an Ant build.xml script</td>
</tr>
<tr>
<td class='confluenceTd'> -cp </td>
<td class='confluenceTd'> Specify the SEI and types class search path of directories
and zip/jar files. </td>
</tr>
<tr>
<td class='confluenceTd'> -soap12 </td>
<td class='confluenceTd'> Specifies that the generated WSDL is to include a SOAP 1.2
binding. </td>
</tr>
<tr>
<td class='confluenceTd'> -t </td>
<td class='confluenceTd'> Specifies the target namespace to use in the generated WSDL
file. </td>
</tr>
<tr>
<td class='confluenceTd'> -servicename </td>
<td class='confluenceTd'> Specifies the value of the generated service element's name
attribute. </td>
</tr>
<tr>
<td class='confluenceTd'> -v </td>
<td class='confluenceTd'> Displays the version number for the tool. </td>
</tr>
<tr>
<td class='confluenceTd'> -verbose </td>
<td class='confluenceTd'> Displays comments during the code generation process. </td>
</tr>
<tr>
<td class='confluenceTd'> -quiet </td>
<td class='confluenceTd'> Suppresses comments during the code generation process. </td>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<td class='confluenceTd'> -portname</td>
<td class='confluenceTd'> Specify the port name to use in the generated wsdl. </td>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<td class='confluenceTd'> classname </td>
<td class='confluenceTd'> Specifies the name of the SEI class. </td>
</tr>
</tbody></table>
</div>

<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>
<h2><a name="JavatoWS-Usingjava2wswithAnt"></a>Using java2ws with Ant</h2>

<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">"org.apache.cxf.tools.java2ws.JavaToWS"</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>
</pre>
</div></div>

<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>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Java+to+WS">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=67213&revisedVersion=8&originalVersion=7">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Java+to+WS?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message