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 Mike Cassisa <MC...@cricketcommunications.com> on 2005/02/18 17:57:42 UTC

Custom Serializer write schema problem with some answers....

Hello,

            I am setting up a document/literal/wrapped web service and
have used XMLBeans to bind my schema/java beans.  I have written custom
Serializer/Deserializers and  I am working on using the dynamic wsdl
provided by axis however I seem to have hit a wall.  I think this will
partially answer some previous questions on this board IRT writing
schemas but I was not subscribed when they were sent and I am not sure
how to reply.

 

>From the serializer.writeSchema method I use the types.loadSchema
function to get my actual schema document into the return however axis
is adding the wrapper elements to the schema and I do not seem to be
able to set their types attributes or deal with them in any way.  So my
question is this if there is a way to do this from the
Serializer.writeSchema method then what is it?  If it cannot be done
there is there a way to insert some custom code into the mix (a handler
maybe?) to massage the wsdl output somehow.  Otherwise I have to write
my own wsdl and pass that back via a separate url/webRoot etc... which I
would rather avoid since it will add to maintenance.  Using an import
element sounds like a good solution if I can get the schema to load from
the same base url as the web service, of course there is still the
matter of the auto generated method elements.

 

Also I need this app to scale so reading from disk every time does not
seem to be the best way to do this either.  I tried passing back a DOM
node that I was keeping in memory but the types object does not use the
correct method (as far as I can tell) to merge the nodes.  I think it
uses the appendElement method or some such instead of importElement.
Any thoughts on how to do this?

 

Currently I have my schema.xsd file in my classpath in the default
package (root dir).  I find the resource url when I create a new
deserializer then load it into the types like this:

 

    public MySerializer() {

        ClassLoader cl =
(Thread.currentThread()).getContextClassLoader();

        URL schemaUrl = cl.getResource("schema.xsd");

        xsdUrl = schemaUrl.toString();

    }

 

    public Element writeSchema(Class javaType, Types types) throws
Exception {

        //this method is for returning the schema that is in the dynamic
wsdls

        types.loadInputSchema(xsdUrl 

        types.updateNamespaces();

        return null;

    }

 

Thanks,

MC

 

Mike Cassisa

Software Engineer