axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Williams <ch...@manawiz.com>
Subject Re: [Axis2] My experience creating a WSDL2Java generated ADB service
Date Sun, 14 May 2006 20:01:15 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Let me add to the chorus that this is great feedback.<br>
<br>
I've looked at some of the issues reported here in the code generator,
but have am not submitting a patch to fix them since someone else might
already be working on them.  Plus, there are some questions on one of
them.  Here are notes on the issues and possible fixes.  I could make
the fixes if they are not already underway:<br>
<br>
<blockquote type="cite"><font face="sans-serif" size="2">4.   Bug:  </font><font
 face="Courier New" size="2">GetAppReleasesType.java</font><font
 face="sans-serif" size="2">
does not compile.</font>
  <br>
  <font face="sans-serif" size="2">In the </font><font
 face="Courier New" size="2">GetAppReleasesType#Factory.parse</font><font
 face="sans-serif" size="2">
method, a reference is made to the nonexistent method "</font><font
 face="Courier New" size="2">org.apache.axis2.databinding.utils.ConverterUtil.convertToNonNegativeInteger(content)</font><font
 face="sans-serif" size="2">".</font>
  <br>
  <font face="sans-serif" size="2">The correct method name is "</font><font
 face="Courier New" size="2">org.apache.axis2.databinding.utils.ConverterUtil.convertTononNegativeInteger(content)</font><font
 face="sans-serif" size="2">"</font><font face="Courier New" size="2">.</font><font
 face="sans-serif" size="2">
 Note:  There is a correct reference to the </font><font
 face="Courier New" size="2">org.apache.axis2.databinding.utils.ConverterUtil.convertTononNegativeInteger</font><font
 face="sans-serif" size="2">
method in the </font><font face="Courier New" size="2">AppRelease#Factory.parse</font><font
 face="sans-serif" size="2">
method.  This leads me to conclude that you are not using common
methods
to determine which conversions to perform on input vs. output content,
and so bugs that are caught in one class may still be unidentified in
another
class.</font>
  <br>
</blockquote>
The underlying problem here is in JavaBeanWriter.getShortTypeName(). 
The shortTypeName is used in ADBBeanTemplate to look up the correct
ConvertTo method.  These methods are (mostly) named like
ConvertTo&lt;xsd-type-name&gt;.  However getShortTypeName() generates
(the non-package non-array substring of) &lt;java-class-name&gt;
instead of &lt;xsd-type-name&gt;.   I believe the correct fix is to
have JavaTypeMap maintain the inverse type map (Java class name --&gt;
xsd type name) in addition to the forward type map, and then to have
getShortTypeName() use this inverse map.  This will however lead to
some secondary bug(s) because there is at least one exception in the
ConvertTo naming convention, namely, ConvertToString is used instead of
ConvertTostring, and ConvertToString is called explicitly in places.<br>
<br>
The subissue, "<font face="sans-serif" size="2">This leads me to
conclude that you are not using common methods
to determine which conversions to perform on input vs. output content,
and so bugs that are caught in one class may still be unidentified in
another
class.</font>
", is mostly a non-issue.  The reason for the two different names in
the generated code can be see in the two different declarations in the
wsdl.  Here is the element that generates ConvertTononNegativeInteger
properly:<br>
<br>
          &lt;xsd:element type="xsd:nonNegativeInteger"
name="releaseDispOrder" /&gt;<br>
<br>
and here is the element that generates ConvertToNonNegativeInteger
improperly:<br>
<br>
          &lt;xsd:element type="acre:hierarchyNum" name="siteNum" /&gt;<br>
<br>
where hierarchyNum is defined:<br>
<br>
      &lt;xsd:simpleType name="hierarchyNum"&gt;<br>
        &lt;xsd:restriction base='xsd:nonNegativeInteger'&gt;<br>
          &lt;xsd:maxInclusive value='99999'/&gt;<br>
        &lt;/xsd:restriction&gt;<br>
      &lt;/xsd:simpleType&gt;<br>
<br>
The difference in these two cases is that the first is a direct
reference to an xsd type, while the second is a reference to a
generated Java type that requires decoding to obtain the underlying xsd
type.  It is this map from Java type to underlying xsd type, i.e.
JavaBeanWriter.getShortTypeName() that is the problem.<br>
<br>
<blockquote type="cite"><font face="sans-serif" size="2">5.   Bug:  In </font><font
 face="Courier New" size="2">AppRelease.java</font><font
 face="sans-serif" size="2">,
the values for </font><font face="Courier New" size="2">localAvailabilityStopTracker</font><font
 face="sans-serif" size="2">
and </font><font face="Courier New" size="2">localReleaseDescTracker</font><font
 face="sans-serif" size="2">
are not set properly.</font>
  <br>
  <font face="sans-serif" size="2">In the setters for the attributes
that
these Trackers track, the following code should be used to ensure that
the Trackers are set properly:</font>
  <br>
  <font face="sans-serif" size="2">For </font><font face="Courier New"
 size="2">localAvailabilityStopTracker</font><font face="sans-serif"
 size="2">
- </font>
  <br>
  <font face="Courier New" size="2">    public void
setAvailabilityStop(java.util.Date
param) {</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // update
the setting tracker</font>
  <br>
  <font face="Courier New" size="2">       
localAvailabilityStopTracker
= (param != null);</font>
  <br>
  <br>
  <font face="Courier New" size="2">        this.localAvailabilityStop
= param;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <font face="sans-serif" size="2">For </font><font face="Courier New"
 size="2">localReleaseDescTracker</font><font face="sans-serif" size="2">
- </font>
  <br>
  <font face="Courier New" size="2">    public void
setReleaseDesc(java.lang.String
param) {</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // update
the setting tracker</font>
  <br>
  <font face="Courier New" size="2">        localReleaseDescTracker
= true;</font>
  <br>
  <br>
  <font face="Courier New" size="2">        this.localReleaseDesc
= param;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <font face="sans-serif" size="2">As generated by WSDL2Java, the
Tracker
is set to true even if the variable it is tracking is unset back to
null.</font>
</blockquote>
<br>
The situation is more subtle than this.  The first question is whether
we want to support unsetting a property.  Currently we support this in
precisely one case, a &lt;choice&gt; particle.  In that case, the
convention is that setting any property unsets all others.  This is the
only case in which unsetting can always be supported.  In the
minOccurs=0 case it is not possible to unset a primitive type property,
for example.  Another interesting case is a nillable property.  I.e.,
if a property is both minOccurs=0 and nillable, what does it mean to
set it to null?  Should this be unsetting the property or explicitly
setting it to xsd:nil?<br>
<br>
We could support unsetting of properties for non-primitive types that
are not nillable and have the unset convention be setting to null as
proposed.  However, if want to support unsetting, perhaps a better
approach is to provide an explicit unset&lt;property&gt; method?<br>
<br>
I'm not convinced this is a bug as reported.  It might be a good idea
to generate the suggested code, but only in the cases for which it is
valid, which is not all cases.<br>
<br>
<blockquote type="cite"><font face="sans-serif" size="2">6.   Bug:  In
the </font><font face="Courier New" size="2">AppReleaseResponse.setReturn</font><font
 face="sans-serif" size="2">
method, the value of </font><font face="Courier New" size="2">local_returnTracker</font><font
 face="sans-serif" size="2">
may be set to </font><font face="Courier New" size="2">true</font><font
 face="sans-serif" size="2">,
but it will never be unset.</font>
  <br>
  <font face="sans-serif" size="2">Similar to Bug #3, the </font><font
 face="Courier New" size="2">local_returnTracker</font><font
 face="sans-serif" size="2">
should be set using the following code to ensure that it is unset when
the supplied </font><font face="Courier New" size="2">parm</font><font
 face="sans-serif" size="2">
is </font><font face="Courier New" size="2">null</font><font
 face="sans-serif" size="2">:</font>
  <br>
  <font face="Courier New" size="2">    public void
set_return(com.wendys.ws.apprelease.AppRelease[]
param) {</font>
  <br>
  <br>
  <font face="Courier New" size="2">        validate_return(param);</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // update
the setting tracker</font>
  <br>
  <font face="Courier New" size="2">        local_returnTracker
= (param != null);</font>
  <br>
  <font face="Courier New" size="2">        local_return
= param;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
</blockquote>
<br>
This is the same as issue 5.<br>
<br>
<blockquote type="cite"><font face="sans-serif" size="2">7.  
Annoyance:  In the </font><font face="Courier New" size="2">AppReleaseResponse.addReturn</font><font
 face="sans-serif" size="2">
method, </font><font face="Courier New" size="2">local_returnTracker</font><font
 face="sans-serif" size="2">
only needs to be set to </font><font face="Courier New" size="2">true</font><font
 face="sans-serif" size="2">
when the </font><font face="Courier New" size="2">local_return</font><font
 face="sans-serif" size="2">
array is instantiated, not every time an </font><font
 face="Courier New" size="2">AppRelease</font><font face="sans-serif"
 size="2">
is added to the array.</font>
  <br>
</blockquote>
<br>
The generated code supports adding values using only the add() method. 
I.e., it is not necessary to first initialize an array with the set()
method.  So, the suggested optimization would entail a test and is thus
not any less cycles that just setting the tracker.  I think the current
code is fine.<br>
<br>
Chuck<br>
<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Mike_McAngus@wendys.com">Mike_McAngus@wendys.com</a>
wrote on 05/11/2006 03:38 PM:
<blockquote
 cite="midOF220CACBE.411DB84B-ON8525716B.0074F142-8525716B.007C5C4F@wendys.com"
 type="cite"><br>
  <font face="sans-serif" size="2">I am trying to create a Proof of
Concept
(POC) for Enterprise and B2B Services at Wendy's Int'l, Inc.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">As part of this POC, I created a
WSDL
for an in-house service and then used the WSDL2Java tool to translate
this
WSDL to Java Classes for use with ADB binding.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">In this document, I describe the
issues
I encountered setting up what I consider to be a simple POC.</font>
  <br>
  <font face="sans-serif" size="2">Some, if not most, of these issues
should
be opened as JIRA Bugs and Enhancement Requests, but I didn't want to
open
a bunch of little requests that may seem disconnected, nor did I want
to
create one huge request with all this stuff in it.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">I encountered most of these issues
in
Axis2 0.95 and all of them in 1.0.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">I'm attaching my WSDL file so that
you
may generate the files and follow along.  In the WSDL I documented
choices that I was forced to make (like not including our Global Schema
in the WSDL).  These choices were forced by the limitations of the
ADB binding.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">I'm also including my build.xml so
you
too can build the aar.  However, without the business logic and our
legacy code and tables the resulting application will not do anything.
  Finally, I'm including my AppReleases.css so you can compare how
the returned WSDL appears in the Browser and to the way I want it to
appear
(assuming JIRA issue Axis2-618 is resolved).</font>
  <br>
  <br>
  <font face="sans-serif" size="2">I should say here that I chose ADB
because
the application framework created under ADB is more intuitive and
lighter
weight than the framework created under XMLBeans.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Some preliminary information about
my
environment and what was created by WSDL2Java.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Environment:</font>
  <br>
  <font face="sans-serif" size="2">        Windows
XP Pro SP2</font>
  <br>
  <font face="sans-serif" size="2">        Tomcat
5.0.28</font>
  <br>
  <font face="sans-serif" size="2">        Java
1.4.2_10</font>
  <br>
  <font face="sans-serif" size="2">        Axis2
1.0 (and Axis2 0.95 except where noted)</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Service Name:</font>
  <br>
  <font face="sans-serif" size="2">        AppRelease</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Messages In:</font>
  <br>
  <font face="sans-serif" size="2">        getAppReleasesRequest</font>
  <br>
  <font face="sans-serif" size="2">        getAppReleasesSortedRequest</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Message Out:</font>
  <br>
  <font face="sans-serif" size="2">        getAppReleasesResponse</font>
  <br>
  <br>
  <font face="sans-serif" size="2">WSDL2Java command:</font>
  <br>
  <font face="sans-serif" size="2">        wsdl2java
-o ..\ -s -p com.wendys.ws -t -ss -sd -d adb -g -ssi -pn AppReleasePort
-sn AppRelease -uri .\AppRelease.wsdl</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Files created by WSDL2Java (I've
identified
one new file that was created because of the new -ssi runtime
directive):</font>
  <br>
  <font face="sans-serif" size="2">        &lt;mypackagepath&gt;/</font>
  <br>
  <font face="sans-serif" size="2">         
      AppReleaseMessageReceiverInOut.java</font>
  <br>
  <font face="sans-serif" size="2">         
      AppReleaseSkeleton.java</font>
  <br>
  <font face="sans-serif" size="2">         
      AppReleaseSkeletonInterface.java  (new)</font>
  <br>
  <font face="sans-serif" size="2">         
      AppReleaseStub.java</font>
  <br>
  <font face="sans-serif" size="2">       
&lt;mypackagepath&gt;/apprelease</font>
  <br>
  <font face="sans-serif" size="2">         
      AppRelease.java</font>
  <br>
  <font face="sans-serif" size="2">         
      GetAppReleasesRequest.java</font>
  <br>
  <font face="sans-serif" size="2">         
      GetAppReleasesResponse.java</font>
  <br>
  <font face="sans-serif" size="2">         
      GetAppReleasesSortedRequest.java</font>
  <br>
  <font face="sans-serif" size="2">         
      GetAppReleasesType.java</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">The reason that the following issues
are important is because if I modify my application to fix them, and if
I subsequently have to modify my WSDL (perhaps to add a new Operation
or
to change the definition of an element) and run WSDL2Java again, the
following
files will be overwritten (thus necessitating some reapplying my
changes):</font>
  <br>
  <font face="sans-serif" size="2">       
&lt;mypackagepath&gt;/apprelease/AppRelease.java</font>
  <br>
  <font face="sans-serif" size="2">       
&lt;mypackagepath&gt;/apprelease/GetAppReleasesRequest.java</font>
  <br>
  <font face="sans-serif" size="2">       
&lt;mypackagepath&gt;/apprelease/GetAppReleasesResponse.java</font>
  <br>
  <font face="sans-serif" size="2">       
&lt;mypackagepath&gt;/apprelease/GetAppReleasesSortedRequest.java</font>
  <br>
  <font face="sans-serif" size="2">       
&lt;mypackagepath&gt;/apprelease/GetAppReleasesType.java</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">Now, for the issues.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">1.   Annoyance:  WSDL2Java.bat
issues a warning because Log4J cannot be properly configured.</font>
  <br>
  <font face="sans-serif" size="2">When running WSDL2Java.bat, the
following
warning is displayed:</font>
  <br>
  <font face="Courier New" size="2">        log4j:WARN
No appenders could be found for logger
(org.apache.axis2.i18n.ProjectResourceBundle).</font>
  <br>
  <font face="Courier New" size="2">        log4j:WARN
Please initialize the log4j system properly.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">To fix this, add the following line:</font>
  <br>
  <font face="Courier New" size="2">        set
AXIS2_CLASS_PATH=%AXIS2_CLASS_PATH%;%AXIS2_HOME%\modules\core\conf</font>
  <br>
  <br>
  <font face="sans-serif" size="2">into the WSDL2Java.bat file, after
these
lines:</font>
  <br>
  <font face="Courier New" size="2">        rem
loop through the libs and add them to the class path</font>
  <br>
  <font face="Courier New" size="2">        set
AXIS2_CLASS_PATH=%AXIS2_HOME%</font>
  <br>
  <font face="Courier New" size="2">        FOR
%%c in ("%AXIS2_HOME%\lib\*.jar") DO set
AXIS2_CLASS_PATH=!AXIS2_CLASS_PATH!;%%c</font>
  <br>
  <br>
  <font face="Courier New" size="2">%AXIS2_HOME%\modules\core\conf</font><font
 face="sans-serif" size="2">
is the location of the Axis2-distributed log4j.properties file.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Once I made this change I learned
that
the Sourceforge Jalopy jar is not available, and so the output of my
Source
files is not is not tidied up.  I don't know if the tidying up of
files was available in Axis2 0.95, so I've continued to work with
untidy
java files.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">2.   Bug:  Jalopy jar is not
available in the Axis2 binary distribution.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">3.  Annoyance:  WSDL2Java
has the capability to tidy up Java source using Jalopy, but no similar
functionality has been provide for the XML files nor the generated WSDL
using xmlTidy.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">4.   Bug:  </font><font
 face="Courier New" size="2">GetAppReleasesType.java</font><font
 face="sans-serif" size="2">
does not compile.</font>
  <br>
  <font face="sans-serif" size="2">In the </font><font
 face="Courier New" size="2">GetAppReleasesType#Factory.parse</font><font
 face="sans-serif" size="2">
method, a reference is made to the nonexistent method "</font><font
 face="Courier New" size="2">org.apache.axis2.databinding.utils.ConverterUtil.convertToNonNegativeInteger(content)</font><font
 face="sans-serif" size="2">".</font>
  <br>
  <font face="sans-serif" size="2">The correct method name is "</font><font
 face="Courier New" size="2">org.apache.axis2.databinding.utils.ConverterUtil.convertTononNegativeInteger(content)</font><font
 face="sans-serif" size="2">"</font><font face="Courier New" size="2">.</font><font
 face="sans-serif" size="2">
 Note:  There is a correct reference to the </font><font
 face="Courier New" size="2">org.apache.axis2.databinding.utils.ConverterUtil.convertTononNegativeInteger</font><font
 face="sans-serif" size="2">
method in the </font><font face="Courier New" size="2">AppRelease#Factory.parse</font><font
 face="sans-serif" size="2">
method.  This leads me to conclude that you are not using common
methods
to determine which conversions to perform on input vs. output content,
and so bugs that are caught in one class may still be unidentified in
another
class.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">5.   Bug:  In </font><font
 face="Courier New" size="2">AppRelease.java</font><font
 face="sans-serif" size="2">,
the values for </font><font face="Courier New" size="2">localAvailabilityStopTracker</font><font
 face="sans-serif" size="2">
and </font><font face="Courier New" size="2">localReleaseDescTracker</font><font
 face="sans-serif" size="2">
are not set properly.</font>
  <br>
  <font face="sans-serif" size="2">In the setters for the attributes
that
these Trackers track, the following code should be used to ensure that
the Trackers are set properly:</font>
  <br>
  <font face="sans-serif" size="2">For </font><font face="Courier New"
 size="2">localAvailabilityStopTracker</font><font face="sans-serif"
 size="2">
- </font>
  <br>
  <font face="Courier New" size="2">    public void
setAvailabilityStop(java.util.Date
param) {</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // update
the setting tracker</font>
  <br>
  <font face="Courier New" size="2">       
localAvailabilityStopTracker
= (param != null);</font>
  <br>
  <br>
  <font face="Courier New" size="2">        this.localAvailabilityStop
= param;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <font face="sans-serif" size="2">For </font><font face="Courier New"
 size="2">localReleaseDescTracker</font><font face="sans-serif" size="2">
- </font>
  <br>
  <font face="Courier New" size="2">    public void
setReleaseDesc(java.lang.String
param) {</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // update
the setting tracker</font>
  <br>
  <font face="Courier New" size="2">        localReleaseDescTracker
= true;</font>
  <br>
  <br>
  <font face="Courier New" size="2">        this.localReleaseDesc
= param;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <font face="sans-serif" size="2">As generated by WSDL2Java, the
Tracker
is set to true even if the variable it is tracking is unset back to
null.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">6.   Bug:  In the </font><font
 face="Courier New" size="2">AppReleaseResponse.setReturn</font><font
 face="sans-serif" size="2">
method, the value of </font><font face="Courier New" size="2">local_returnTracker</font><font
 face="sans-serif" size="2">
may be set to </font><font face="Courier New" size="2">true</font><font
 face="sans-serif" size="2">,
but it will never be unset.</font>
  <br>
  <font face="sans-serif" size="2">Similar to Bug #3, the </font><font
 face="Courier New" size="2">local_returnTracker</font><font
 face="sans-serif" size="2">
should be set using the following code to ensure that it is unset when
the supplied </font><font face="Courier New" size="2">parm</font><font
 face="sans-serif" size="2">
is </font><font face="Courier New" size="2">null</font><font
 face="sans-serif" size="2">:</font>
  <br>
  <font face="Courier New" size="2">    public void
set_return(com.wendys.ws.apprelease.AppRelease[]
param) {</font>
  <br>
  <br>
  <font face="Courier New" size="2">        validate_return(param);</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // update
the setting tracker</font>
  <br>
  <font face="Courier New" size="2">        local_returnTracker
= (param != null);</font>
  <br>
  <font face="Courier New" size="2">        local_return
= param;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">7.   Annoyance:  In the </font><font
 face="Courier New" size="2">AppReleaseResponse.addReturn</font><font
 face="sans-serif" size="2">
method, </font><font face="Courier New" size="2">local_returnTracker</font><font
 face="sans-serif" size="2">
only needs to be set to </font><font face="Courier New" size="2">true</font><font
 face="sans-serif" size="2">
when the </font><font face="Courier New" size="2">local_return</font><font
 face="sans-serif" size="2">
array is instantiated, not every time an </font><font
 face="Courier New" size="2">AppRelease</font><font face="sans-serif"
 size="2">
is added to the array.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">8.   Bug:  Under Axis2 1.0,
only the system generated WSDL is served up in response to the
Service?wsdl
command.  Under Axis2 0.95 if a WSDL was located in the META-INF
directory
then that WSDL would be served up instead.  This has already been
submitted as JIRA Bug Axis2-690.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">9.   Annoyance:  WSDLs are
not served up with the Stylesheet that is specified in the original
WSDL.
 In fact, under 0.95, even if the original WSDL is returned that WSDL
has the stylesheet element removed.  This has been submitted as JIRA
Enhancement Request Axis2-618</font><font size="3">.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">10.   Annoyance:  In </font><font
 face="Courier New" size="2">AppReleaseStub</font><font
 face="sans-serif" size="2">,
the default constructor is not necessary.</font>
  <br>
  <font face="sans-serif" size="2">This constructor is used only by the
Test class, which can supply the necessary service endpoint URL when it
instantiates the stub class.  This way, the URL of the Service is
not hard-coded anywhere in the application.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">11.   Annoyance:  WSDL2Java
reverses the order of the Operations listed in the WSDL.</font>
  <br>
  <font face="sans-serif" size="2">In my WSDL the Operations are listed
in this order:  </font><font face="Courier New" size="2">getAppReleases</font><font
 face="sans-serif" size="2">,
  </font><font face="Courier New" size="2">getAppReleasesSorted</font><font
 face="sans-serif" size="2">.
 Yet, in all the artifacts created by WSDL2Java, the operations, their
messages, their associated methods, their entries in the </font><font
 face="Courier New" size="2">services.xml</font><font face="sans-serif"
 size="2">
file, their order in the generated WSDL file and their order in the
axis2-admin/listServices
page is reversed from what exists in my WSDL file.  I prefer to have
messages and operations in WSDLs and attributes and methods in Classes
in alphabetical order.  I prefer that my tools maintain the order
that I have established.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">12.  Annoyance:  WSDL2Java
replaces my defined namespace prefix with "ns1".</font>
  <br>
  <font face="sans-serif" size="2">See </font><font face="Courier New"
 size="2">AppRelease</font><font face="sans-serif" size="2">,
  </font><font face="Courier New" size="2">GetAppReleasesRequest</font><font
 face="sans-serif" size="2">,
  </font><font face="Courier New" size="2">GetAppReleasesResponse</font><font
 face="sans-serif" size="2">,
  </font><font face="Courier New" size="2">GetAppReleasesSortedRequest</font><font
 face="sans-serif" size="2">
and </font><font face="Courier New" size="2">GetAppReleasesType</font><font
 face="sans-serif" size="2">.</font>
  <br>
  <font face="sans-serif" size="2">I see no reason not to use the
namespace
prefix specified in the WSDL that WSDL2Java reads, but if you MUST
change
the namespace prefix couldn’t you use the more traditional "tns"?</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">13.  Annoyance:  There are
a large number of unused private methods, method parameters and method
variables in the generated classes.</font>
  <br>
  <font face="sans-serif" size="2">Eclipse can tell you about unused
junk
in the generated classes.  Perhaps these artifacts are no longer needed
and can be removed?</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">14.  Annoyance:  The
log4j.properties
file shipped with Axis2 circumvents the ability for the developers to
change
the logging level of their classes.</font>
  <br>
  <font face="sans-serif" size="2">I have included a modified
log4j.properties
file that actually allows me to put my classes into DEBUG level while
leaving
Axis2 and Tomcat logging at their levels.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">15.  Annoyance:  Axis2 only
allows for Log4J.properties to configure logging, not Log4J.xml</font>
  <br>
  <font face="sans-serif" size="2">Log4J can be configured using either
a properties or an xml file.  There is a growing number of Logging
capabilities that are only configurable using the XML file.  The code
that sets up configuration of Log4J in Axis2 should allow for both
types
of configuration files.</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">16.  Annoyance:  Axis2 does
not use ConfigureAndWatch capabilities of Log4J</font>
  <br>
  <font face="sans-serif" size="2">Log4J can be configured using a
ConfigureAndWatch
method that causes Log4J to monitor its configuration file and
automatically
apply changes made to that file to its configuration.  This means
that if support personnel need to modify the logging configuration of a
production application, only the log4j configuration file needs to be
modified
and the Application server does not need  to be restarted.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">Following is a snippet of code for a
Log4jUtils class that addresses Annoyances 15 and 16.</font>
  <br>
  <font face="sans-serif" size="2">The configureAndWatch method of this
utility class should be called by an initialization servelet or some
other
configuration and initialization class.</font>
  <br>
  <br>
  <font face="sans-serif" size="2">------</font>
  <br>
  <br>
  <font face="Courier New" size="2">import
org.apache.log4j.BasicConfigurator;</font>
  <br>
  <font face="Courier New" size="2">import
org.apache.log4j.PropertyConfigurator;</font>
  <br>
  <font face="Courier New" size="2">import
org.apache.log4j.helpers.FileWatchdog;</font>
  <br>
  <font face="Courier New" size="2">import
org.apache.log4j.net.SyslogAppender;</font>
  <br>
  <font face="Courier New" size="2">import
org.apache.log4j.xml.DOMConfigurator;</font>
  <br>
  <br>
  <font face="Courier New" size="2">    .</font>
  <br>
  <font face="Courier New" size="2">    .</font>
  <br>
  <font face="Courier New" size="2">    .</font>
  <br>
  <font face="Courier New" size="2">/**</font>
  <br>
  <font face="Courier New" size="2"> * A collection of static utility
methods for logging with Log4J.</font>
  <br>
  <font face="Courier New" size="2"> */</font>
  <br>
  <font face="Courier New" size="2">public final class Log4jUtils {</font>
  <br>
  <font face="Courier New" size="2">    private static final
Logger LOG = Logger.getInstance(Log4jUtils.class);</font>
  <br>
  <font face="Courier New" size="2">    private static
loggingConfigured
= false;</font>
  <br>
  <br>
  <font face="Courier New" size="2">    private Log4jUtils()
{</font>
  <br>
  <font face="Courier New" size="2">        // All
methods are static, this class should not be instantiated</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <font face="Courier New" size="2">    .</font>
  <br>
  <font face="Courier New" size="2">    .</font>
  <br>
  <font face="Courier New" size="2">    .</font>
  <br>
  <br>
  <font face="Courier New" size="2">    /**</font>
  <br>
  <font face="Courier New" size="2">     * Implements configureAndWatch
for the current ClassLoader hierarchy using the Log4J</font>
  <br>
  <font face="Courier New" size="2">     * default number
of seconds.</font>
  <br>
  <font face="Courier New" size="2">     */</font>
  <br>
  <font face="Courier New" size="2">    public static void
configureAndWatch()
{</font>
  <br>
  <font face="Courier New" size="2">       
configureAndWatch(FileWatchdog.DEFAULT_DELAY);</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <font face="Courier New" size="2">    </font>
  <br>
  <font face="Courier New" size="2">    /**</font>
  <br>
  <font face="Courier New" size="2">     * Implements configureAndWatch
for the current ClassLoader hierarchy.</font>
  <br>
  <font face="Courier New" size="2">     * </font>
  <br>
  <font face="Courier New" size="2">     * @param watchMillisecs
The number of milliseconds to wait between checking to see if the </font>
  <br>
  <font face="Courier New" size="2">     * log4j configuration
file has changed.</font>
  <br>
  <font face="Courier New" size="2">     */</font>
  <br>
  <font face="Courier New" size="2">    public static void
configureAndWatch(long
watchMillisecs) {</font>
  <br>
  <font face="Courier New" size="2">        if (loggingConfigured)
return;</font>
  <br>
  <br>
  <font face="Courier New" size="2">        Class myClass
= Log4jUtils.class;</font>
  <br>
  <font face="Courier New" size="2">        ClassLoader
classLoader = myClass.getClassLoader();</font>
  <br>
  <br>
  <font face="Courier New" size="2">        // Initialize
LOG4J</font>
  <br>
  <font face="Courier New" size="2">        URL resourceUrl
= classLoader.getResource("log4j.xml");</font>
  <br>
  <font face="Courier New" size="2">        if (resourceUrl
!= null) {</font>
  <br>
  <font face="Courier New" size="2">         
  String configFile = resourceUrl.getFile();</font>
  <br>
  <font face="Courier New" size="2">         
  DOMConfigurator.configureAndWatch(configFile, watchMillisecs);</font>
  <br>
  <font face="Courier New" size="2">        } else
{</font>
  <br>
  <font face="Courier New" size="2">         
  resourceUrl = classLoader.getResource("log4j.properties");</font>
  <br>
  <font face="Courier New" size="2">         
  if (resourceUrl != null) {</font>
  <br>
  <font face="Courier New" size="2">         
      String configFile = resourceUrl.getFile();</font>
  <br>
  <font face="Courier New" size="2">         
      PropertyConfigurator.configureAndWatch(configFile,
watchMillisecs);</font>
  <br>
  <font face="Courier New" size="2">         
  } else {</font>
  <br>
  <font face="Courier New" size="2">         
      // Since we aren't going to be able to pull our "real"
settings,</font>
  <br>
  <font face="Courier New" size="2">         
      // let's at least make sure we get some output </font>
  <br>
  <font face="Courier New" size="2">         
      BasicConfigurator.configure();</font>
  <br>
  <br>
  <font face="Courier New" size="2">         
      // Log an error with detail regarding the problem
(and suspected cause)</font>
  <br>
  <font face="Courier New" size="2">         
      LOG.error(myClass.getName(), "Unable to find
log4j.xml or log4j.properties. " + </font>
  <br>
  <font face="Courier New" size="2">         
                     
             "Make sure the log4j
configuration file is in the Classpath.");</font>
  <br>
  <font face="Courier New" size="2">         
  }</font>
  <br>
  <font face="Courier New" size="2">        }</font>
  <br>
  <font face="Courier New" size="2">        loggingConfigured
= true;</font>
  <br>
  <font face="Courier New" size="2">    }</font>
  <br>
  <br>
  <br>
  <font face="sans-serif" size="2">Hope this all helps.</font>
  <br>
  <br>
  <font face="sans-serif" size="2"><br>
  </font><font face="Helvetica" size="3"><b><br>
Mike McAngus</b></font><font face="Helvetica" size="1"><br>
Associate Chief Engineer, Enterprise Architecture<br>
Wendy's International, Inc.<br>
  <br>
  </font>
  <br>
  <br>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<div
 style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal;
font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal; color:
black;">
<b>Chuck Williams</b><br>
Manawiz<br>
Principal<br>
V: (808)885-8688<br>
C: (415)846-9018<br>
<a href="mailto:chuck@manawiz.com">chuck@manawiz.com</a><br>
Skype: manawiz<br>
AIM: hawimanawiz<br>
Yahoo: jcwxx<br>
</div>
</div>
</body>
</html>

Mime
View raw message