You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Amila Suriarachchi <am...@gmail.com> on 2007/08/27 08:33:43 UTC

[Axis2] Xml beans databinding with WSDL2java tool improvments.

hi,
I added a new option to wsdl2 java. (-Ewdc  -- without databinding code)
When someone put this option with the Xmlbeans data binding then Axis2
generates an dummy schema set with only contain top xml elements
needed to generate other codegen classes.
Then users can generate the xmlbeans correct code (with resources) using the
scomp command comes with the xmlbeans distribution.
eg. scomp test.wsd -d temp -src temp -srconly to generate code for a temp
folder.

Here is the complete set of steps

1. generate the code with wsdl2java. give -d xmlbeans -Ewdc as arguments.
2. generate the code with scomp command --> eg. scomp test.wsd -d temp -src
temp -srconly
3. replace the xmlbeans generated code with the code generated with the
Axis2 .

After that either deploy service or access client in the normal way.

In addition to this.
now it uses the OMDataSource in serializing the xmlbeans generated code.

org.apache.axiom.om.OMDataSource omDataSource = new
org.apache.axiom.om.OMDataSource() {


                    public void
serialize(javax.xml.stream.XMLStreamWriterxmlStreamWriter)
                            throws javax.xml.stream.XMLStreamException {

org.apache.axiom.om.impl.MTOMXMLStreamWritermtomxmlStreamWriter =
                                                        (
org.apache.axiom.om.impl.MTOMXMLStreamWriter) xmlStreamWriter;
                        try {
                            param.save(mtomxmlStreamWriter.getOutputStream
());
                            mtomxmlStreamWriter.getOutputStream().flush();
                        } catch (java.io.IOException e) {
                            throw new
javax.xml.stream.XMLStreamException("Problem
with saving document", e);
                        }
                    }

                    public javax.xml.stream.XMLStreamReader getReader()
                            throws javax.xml.stream.XMLStreamException {
                        return param.newXMLStreamReader();
                    }
                };

                return  new
org.apache.axiom.om.impl.llom.OMSourcedElementImpl(xmlReader.getName(),
                        org.apache.axiom.om.OMAbstractFactory.getOMFactory
(),
                        omDataSource);
            }

As you can see this improvs the perfornamce and it serialize the xmlbeans
directly using xmlbeans.

Can people have problems with xmlbeans try out with -Ewdc with a nighly
build?


-- 
Amila Suriarachchi,
WSO2 Inc.