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 Ofer Karp <ok...@mercury.com> on 2005/09/28 12:55:52 UTC

wsdl2java - generating custom java classes

Hello, 

 

I am trying to extend WSDL2Java so that except from the normal classes which
are generated, it will generate a custom class for each operation exposed in
the specified wsdl.

In some senses what I am trying to do is similar to JavaTestCaseWriter.java,
but while in their case only one java file should be generated (a
junit.framework.TestCase extension that contains one test method for each
operation), I need to generate a separate java file for each operation. Do I
need to implement a completely new Generator, or can I still extend on of
axis implementations (like JavaClassWriter)?

I also couldn't find where exactly the Generator implementations are
"registered" in the emitter, or in other words how do I instruct the emitter
to invoke my generator as well as all the pre-defined generators.

 

Can anyone help? Thanks.



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Re: wsdl2java - generating custom java classes

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi Ofer,
It's nice to see you guys going deep inside the code generator.Here are some
hints that you'll find useful.
The code generator has the emitter and the writers closely related. The
writers are not really registered in the emitter but directly used. The
template each writer uses however is given as part of the properties in the
codegen-config.properties file.
If you need to generate a completely different class then you'll need to add
a custom writer and incorporate that into the emitter. Writing a writer is
just extending the class writer, not much overiding to do. You can modify
the java emitter to call the new writer.
When you are modifying the emitter you'll have to basically create an XML
model and then feed it to the class writer. You'll also need to write a
template.
The emitters are registered in the config property file.


On 9/28/05, Ofer Karp <ok...@mercury.com> wrote:
>
>  Hello,
>
>  I am trying to extend WSDL2Java so that except from the normal classes
> which are generated, it will generate a custom class for each operation
> exposed in the specified wsdl.
>
> In some senses what I am trying to do is similar to
> JavaTestCaseWriter.java, but while in their case only one java file should
> be generated (a junit.framework.TestCase extension that contains one test
> method for each operation), I need to generate a separate java file for each
> operation. Do I need to implement a completely new Generator, or can I still
> extend on of axis implementations (like JavaClassWriter)?
>
> I also couldn't find where exactly the Generator implementations are
> "registered" in the emitter, or in other words how do I instruct the emitter
> to invoke my generator as well as all the pre-defined generators.
>
>  Can anyone help? Thanks.
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>



--
Ajith Ranabahu