axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anne Thomas Manes" <atma...@gmail.com>
Subject Re: How to reproduce "WSDL2Java okay"+"uncompilable code generated"
Date Thu, 30 Mar 2006 13:55:13 GMT
There are other problems with this WSDL besides the wrong qnames in your
message parts. (Note that they aren't unqualified because there is a default
namespace (the wsdl namespace); but these elements are in the xsd1
namespace.)

When using RPC style, your message parts must reference types, not elements.
To fix the WSDL, either change the style to "document" (and remove the
namespace attributes from the <soap:body> definitions) or change the message
parts to reference types rather than elements.

I disagree with you that wsdl2java should have a built-in WSDL validator and
should be able to catch all WSDL errors. As a best practice, you should
validate your WSDL before running wsdl2java. Many WSDL editors provide WSDL
validators. I'm not aware of an open source WSDL validator, though. (Perhaps
someone would like to volunteer to build one?) I do think that wsdl2java
should generate an error when it encounters an unresolvable reference,
though. e.g.,

"http://schemas.xmlsoap.org/wsdl/}echoStringParam is referenced but not
defined"

Anne

On 3/30/06, Morten Mortensen <MOMOR@tdc.dk> wrote:
>
>
> I can now directly provoke, what I said yesterday: WSDL2Java running
> smoothly, but the generated coded in an uncompilable state!
>
> To reproduce, take the "Axis2SampleDocLit.wsdl" from the 0.95
> distribution, make the error like I did in my own WSDL by removing the
> qualification from the message-elements like this (see the attached
> file; slightly modified variant of the original sample):
>
> Change e.g. -
>
>     <message name="echoString">
>         <part element="xsd1:echoStringParam" name="a"/>  <- remove
> "xsd1"
>     </message>
>
> - into -
>
>     <message name="echoString">
>         <part element="echoStringParam" name="a"/> <- no "xsd1"
>     </message>
>
> Now the WSDL2Java runs without any errors, but the compilation fails
> since the code shown in my original message below is produced.
>
> I think, that there ought to be a negative test-case for WSDL2Java with
> this type of WSDL!
> It is very good, that given correct WSDL, then all is fine - but in real
> life, we fiddle with WSDL for a long time, maybe do not get it right for
> the first number of times and then it is important to have tools like
> WSDL2Java do some aggressive verification of the WSDL...
> Having to track down the cause of generated, uncompilable code is too
> tough.
> Developers - are you listening?
>
> Regards,
> Morten Sabroe Mortensen
>
>
>
> -----Oprindelig meddelelse-----
> Fra: Morten Mortensen
> Sendt: 29. marts 2006 17:38
> Til: axis-user@ws.apache.org
> Emne: Mode "Document/literal" vs. "Document/literal wrapped"
>
>
> Hi all
>
> With the 0.95 version, how come I can use WSDL2Java to generate
> *un-compilable* code?
> Apparently, when I write WSDL as "Document/literal wrapped", the
> generated "XXXReceiverInOut" has bad "toOM()", "fromOM()" and
> "toEnvelope()" (for an example, see the below "toOM()"-implementation;
> the parameter does not have the right type!).
>
> Why does this happen? What to do?
>
> Regards,
> Morten Sabroe Mortensen
>
> ---
>    ...
>                     private  org.apache.ws.commons.om.OMElement
> toOM(org.apache.ws.commons.om.OMElement param){
>                         if (param instanceof
> org.apache.axis2.databinding.ADBBean){
>
> org.apache.ws.commons.om.impl.builder.StAXOMBuilder builder = new
> org.apache.ws.commons.om.impl.builder.StAXOMBuilder
>
> (org.apache.ws.commons.om.OMAbstractFactory.getOMFactory(),
> param.getPullParser(org.apache.ws.commons.om.OMElement.MY_QNAME));
>                             org.apache.ws.commons.om.OMElement
> documentElement = builder.getDocumentElement();
>                             ((org.apache.ws.commons.om.impl.OMNodeEx)
> documentElement).setParent(null); // remove the parent link
>                             return documentElement;
>                         }else{
>
>                            //todo finish this onece the bean serializer
> has the necessary methods
>                             return null;
>                         }
>                     }
>    ...
> ---
>
>
>

Mime
View raw message