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: [email protected]
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;
                        }
                    }
   ...
---

Attachment: Axis2SampleDocLit.wsdl
Description: Axis2SampleDocLit.wsdl

Reply via email to