I still think that the original poster (below) has found an error worth
logging in JIRA. Either Axis should generate a compilable webservice from
his WSDL, or it should emit an error message explaining why it can't. It
appears that neither is happening in this case.

In general, I think errors of that sort should be fixed, so that Axis at
least emits reasonable error messages when people do something wrong. 

I'm going to get on a soapbox for a moment, because this is starting to
become a pet peeve of mine. It seems to be pretty common on this mailing
list to have dialogues of the form:

A: When I do <blah>, I get a NullPointerException from WSDL2Java!
B: Your WSDL is broken. Don't do <blah>. Do <blargh> instead.
A: OK. I fixed the WSDL. But now, WSDL2Java produces uncompilable code!
B: I noticed another way that your WSDL is broken. Don't do <foo>. Do <bar>
instead.
A: OK. I fixed that too. Now everything works great. Thanks!

with the implication being that a NullPointerException or producing
uncompilable code is a perfectly valid way for WSDL2Java to tell the user
that something is wrong, and that fixing the user's WSDL is therefore enough
to fix the problem. Thus, the original user's problem is solved with no JIRA
having been created, so that Axis never gets fixed. This means that the next
person who does <blah> hits the same problem, and MAYBE eventually resolves
it by searching the mailing list archive, or maybe just wanders off and
finds another SOAP server with a less user-hostile interface. This is part
of why there is so much traffic and so many confused people on the Axis
mailing lists.

I would like to see more dialogue like the following:
A: When I do <blah>, I get a NullPointerException from WSDL2Java!
B: WSDL2Java should never throw a NullPointerException under any
circumstances. Please file a JIRA. Also, I noticed that your WSDL is broken.
Don't do <blah>. Do <blargh> instead.
A: OK. I filed JIRA #1234. But now, WSDL2Java produces uncompilable code!
B: WSDL2Java should never produce uncompilable code under any circumstances.
Please file a JIRA. Also, I noticed another way that your WSDL is broken.
Don't do <foo>. Do <bar> instead.
A: OK. I filed JIRA #5678. Also, fixing my WSDL as per your suggestion fixed
my problem. Thanks!
C: I fixed JIRA #1234 by having WSDL2Java detect attempts to use <blah>, and
emit an error message suggesting <blargh> instead.
D: I fixed JIRA #5678 by having WSDL2Java detect attempts to use <foo>, and
emit an error message stating that <foo> is not supported.

I'm guilty of this myself a bit -- I have seen some bizarre Axis WSDL2Java
behavior that I haven't reported to JIRA yet because I found a workaround.
In particular, WSDL that isn't WS-I compliant seems to frequently produce
malignant chaos of one sort or another instead of nice, comprehensible error
messages. I'm going to report the bugs that I found when I get a chance. I
encourage others to do likewise.

It seems to me that if WSDL2Java or similar tools EVER fail due to a
NullPointerException, ClassCastException or other RuntimeException, or if
they appear to run but produce uncompilable code, a JIRA should be filed in
every case.

Derek

> -----Original Message-----
> From: robert lazarski [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 19, 2006 9:57 AM
> To: [email protected]
> Subject: Re: Problems with WSDL2Java
> 
> 
> Your WSDL doesn't validate - try using one of the many wsdl 
> validators and that should point you in the right direction. 
> In the w3 case, you also need to supply the external schema reference.
> 
> HTH,
> Robert
> http://www.braziloutsource.com/
> 
> On 7/19/06, Christian Pöcher <[EMAIL PROTECTED]> wrote:
> > Hi there,
> >
> > since I am still very fresh to the area of webservices, I'm 
> not sure, 
> > if my problem is related to a bug in the code gerneration 
> of Axis2 or 
> > if I made an error.
> >
> > I try to write a simple webservie that adds two integers and gives 
> > back the sum. After writing the WSDL file and and 
> generating code with 
> > WSDL2Java, I notice errors in the code. I tried both Axis2 
> 1.0 and the 
> > nightly build of today. In 1.0 I get an error about 
> > newXMLStreamReader() as described in 
> > http://issues.apache.org/jira/browse/AXIS2-760?page=all
> > and in the nightly I get totally funny code like this:
> > wrappedParam =
> > ()fromOM(
> > msgContext.getEnvelope().getBody().getFirstElement(),
> > .class,
> > getEnvelopeNamespaces(msgContext.getEnvelope()));
> >
> > I'd appriciate an explaination and a workaround very much.
> >
> > I used the following WSDL file:
> >
> > <?xml version="1.0"?>
> > <definitions name="mathWS"
> >
> > targetNamespace="http://chris.math.ut.ee/plus.wsdl";
> >            xmlns:tns="http://chris.math.ut.ee/plus.wsdl";
> >            xmlns:xsd1="http://chris.math.ut.ee/plus.xsd";
> >            xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
> >            xmlns="http://schemas.xmlsoap.org/wsdl/";>
> >
> >      <types>
> >         <schema xmlns="http://www.w3.org/2000/10/XMLSchema";>
> >            <element name="sum" type="integer"/>
> >            <element name="summands">
> >               <complexType>
> >                  <all>
> >                     <element name="summand0" type="integer"/>
> >                     <element name="summand1" type="integer"/>
> >                  </all>
> >               </complexType>
> >            </element>
> >         </schema>
> >      </types>
> >
> >      <message name="getSum">
> >         <part name="rightHandSide" type="sum"/>
> >      </message>
> >
> >      <message name="getSummands">
> >         <part name="leftHandSide" type="summands"/>
> >      </message>
> >
> >      <portType name="mathWSPortType">
> >         <operation name="plus">
> >            <input message="tns:getSummands"/>
> >            <output message="tns:getSum"/>
> >         </operation>
> >      </portType>
> >
> >      <binding name="mathWSSoapBinding" type="tns:mathWSPortType">
> >          <soap:binding style="document" 
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >          <operation name="plus">
> >             <soap:operation 
> soapAction="http://chris.math.ut.ee/plus"/>
> >             <input>
> >                 <soap:body use="literal"/>
> >             </input>
> >             <output>
> >                 <soap:body use="literal"/>
> >             </output>
> >          </operation>
> >      </binding>
> >
> >      <service name="MathWS">
> >          <documentation>Does your maths</documentation>
> >          <port name="MathWSPort" binding="tns:mathWSSoapBinding">
> >             <soap:address location="http://example.com/mathws"/>
> >          </port>
> >      </service>
> >
> > </definitions>
> >
> > Afterwards, I decided to try the example WSDL file from the spec 
> > (http://www.w3.org/TR/wsdl#_wsdl), which gives an exception 
> with both 
> > versions of Axis2. Exception in thread "main"
> > org.apache.axis2.wsdl.codegen.CodeGenerationException: 
> Error parsing WSDL
> >          at
> > 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(Code
> GenerationEngine.java:123)
> >          at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
> >          at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
> > Caused by: org.apache.axis2.AxisFault: null; nested exception is:
> >          java.lang.NullPointerException
> >          at
> > 
> org.apache.axis2.description.WSDL11ToAxisServiceBuilder.popula
> teService(WSDL11ToAxisServiceBuilder.java:226)
> >          at
> > 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(Code
> GenerationEngine.java:114)
> >          ... 2 more
> > Caused by: java.lang.NullPointerException
> >          at
> > 
> org.apache.axis2.description.WSDL11ToAxisServiceBuilder.genera
> teWrapperSchema(WSDL11ToAxisServiceBuilder.java:888)
> >          at
> > 
> org.apache.axis2.description.WSDL11ToAxisServiceBuilder.popula
> teService(WSDL11ToAxisServiceBuilder.java:192)
> >          ... 3 more
> >
> > Any suggestions?
> >
> > TIA, Chris
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to