0

Just a little background: I have a wsdl and schema files with a lot of hierarchy, meaning there are a lot of import/include tags in the schema. I have a netbeans project and used wsimport to generate the client code. I’m successfully calling the web service operations and getting data.

What I need: I'm looking to get access to the model the xjc compiler uses to generate the java code from the schema. I would like to do this without writing my own plugin if possible. I want to use this model to generate my own code with codemodel.

The question is: Is there a way to get access (preferably from my client project described above) to the model or 'outline' without writing a xjc plugin?

I’m new to java and jaxb so any direction and detailed instructions are much appreciated.

1 Answers1

0

You can invoke the xjc compiler directly by using Ant or Maven. Just point it at the schemas referenced. If you need some control over the code generated, you could look at custom binding in JAXB.

What exactly are you trying to accomplish?

davidfmatheson
  • 3,409
  • 16
  • 25
  • Thanks David! I don't want to manipulate the generated code. I want to iterate through the operations, and for each operation in the wsdl I want to create functions to instantiate all the required fields (elements, attributes) and due to the hierarchy this touches many xsd files. – Marine Kosh Aug 17 '12 at 19:19
  • I'm still not clear. You have `wsimport` which generates a bunch of objects for you, and you have code that then instantiates those generated classes and fills in fields, correct? You're trying to do something different? – davidfmatheson Aug 17 '12 at 19:25
  • Yes, I have code, that I wrote, that instantiates the classes and fills in the fields. What I'm trying to do is based on the model auto-generate some of that code that I had to write myself. So when another developer uses the wsdl/wsimport to create a client they can call my auto-generated functions to instantiate and set default values. At the moment I'm just interested in playing with the model to see what it looks like. I'm not sure I'm on the right path yet. – Marine Kosh Aug 17 '12 at 19:34
  • They can't just grab your "fill in stuff" code from source control? Alternatively, you could use Spring to set up default values for all the generated beans. – davidfmatheson Aug 17 '12 at 19:51
  • Thanks, I was thinking of using Spring for the default values. The point is to get access to the model. When you said invoke the xjc compiler directly does that re-generate all the code the wsimport already did? – Marine Kosh Aug 17 '12 at 21:01
  • I'm going ahead with an xjc plugin. – Marine Kosh Aug 27 '12 at 16:03