You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Cristiano Costantini <cr...@gmail.com> on 2012/11/24 18:11:14 UTC

Contributing to java2ws tool for maven

Hello all,

I'm in search for help to orient myself in the source code of the
java2ws tool and most importantly on using it from maven.

To study it, I've spent some time debugging the following projects:
cxf-java2ws-plugin, cxf-tool-common, cxf-tool-java2ws and also
cxf-codegen-plugin
but when I get deep on the stack I get in classes which have limited
comments and it is very hard to understand their behavior and how to
eventually modify them respecting the application philosophy...

I'm in search for some help, hints and guideline to try working on it
and produce some patches, is there any expert who can give me some
help and illuminate me on the tool architecture? It would be great the
get in touch via some instant messaging application (irc or gtalk or
anything else).


Background:
I work using the java first approach and writing classes annotated
with jaxb it are our "modeling framework".
This approach works good as the generated WSDL is natively friendly to
Java, in the sense that the generated XML Schemas match Java classes
and rules and we can avoid validation of input XML safely: for
example, the schema will not have an <xsd:element minOccurs="5"
maxOccurs="72" /> that require a validation step, I will only get
<xsd:element minOccurs="0" maxOccurs="unbounded" /> from lists. This
approach is developer friendly and I like it, and just dropping the
Java classes into ObjectAid plugin for Eclipse and I get wonderful
documentation.

For generating the WSDL and the XSD schemas I use cxf-java2ws-plugin,
however I have some limitations and I would like to improve the tool.

The first big limit I have in cxf-java2ws-plugin, is that I cannot
control the name of the xsd files generated from the the tool: when I
use the maven-jaxb-schemagen-plugin, I can do this by using the
following options:
<schemas>
  <schema>
    <namespace>http://cristcost.net/ns/model</namespace>
    <file>model.xsd</file>
  </schema>
  <schema>
    <namespace>http://cristcost.net/ns/service</namespace>
    <file>service.xsd</file>
  </schema>
  ...
</schemas>
and in  cxf-java2ws-plugin nothing similar is available.

The second big limit I have, is that I need to generate multiple WSDLs
files reusing the same XSDs, so I would need a tool which accepts
multiple service endpoint's implementation (SEI) classes, and only
generate one XSD file in case it is generate from the same annotated
pojo. (Currently, I have multiple executions to generate these WSDLs,
but in this way the same xsd is generated multiple for each SEI).



thank you all, I hope I have not broken any rules of the mailing list
(mail to dev-faq@cxf.apache.org and dev-info@cxf.apache.org returned
nothing), else please forgive me.

Cristiano

Re: Contributing to java2ws tool for maven

Posted by Cristiano Costantini <cr...@gmail.com>.
Hello Daniel and thank you for your response!

the indications you have given to me are a good next step, I think the
best thing to do for me is taking a new debug sessions with some
breakpoint on the classes you have listed.
I'll try to do this on the next weekend and I hope to understand how
it work and be lucky to come out with an idea for an elegant solution.

For other data binding, unfortunately I have have experience only for JAXB...

I hope to give some feedback asap,

regards,
Cristiano


2012/11/26 Daniel Kulp <dk...@apache.org>:
>
> This is a relatively "complex" thing to do as it more or less would trace through a bunch of things.   The main place you would need to look is in JAXBUtils.generateJaxbSchemas.  That is where the schemas are "created".   It's done by calling into the JAXB context which then generates the schemas.   We pass in a SchemaOutputResolver to create the DOMResult objects.   For the most part, we just use the "suggested" name that JAXB provides.   However, that method could be updated to allow passing some sort of Namespace -> Filename map or similar that could be used.   We'd then need to trace the calls into there to provide enough hooks for the java2ws to be able to pass that map in.  Patches would certainly be welcome.
>
> That said, that would just solve the JAXB case.   If you need this for the other data bindings (like Aegis), we'd have to look into each of those as well.
>
> Dan
>
>
> On Nov 24, 2012, at 12:11 PM, Cristiano Costantini <cr...@gmail.com> wrote:
>
>> Hello all,
>>
>> I'm in search for help to orient myself in the source code of the
>> java2ws tool and most importantly on using it from maven.
>>
>> To study it, I've spent some time debugging the following projects:
>> cxf-java2ws-plugin, cxf-tool-common, cxf-tool-java2ws and also
>> cxf-codegen-plugin
>> but when I get deep on the stack I get in classes which have limited
>> comments and it is very hard to understand their behavior and how to
>> eventually modify them respecting the application philosophy...
>>
>> I'm in search for some help, hints and guideline to try working on it
>> and produce some patches, is there any expert who can give me some
>> help and illuminate me on the tool architecture? It would be great the
>> get in touch via some instant messaging application (irc or gtalk or
>> anything else).
>>
>>
>> Background:
>> I work using the java first approach and writing classes annotated
>> with jaxb it are our "modeling framework".
>> This approach works good as the generated WSDL is natively friendly to
>> Java, in the sense that the generated XML Schemas match Java classes
>> and rules and we can avoid validation of input XML safely: for
>> example, the schema will not have an <xsd:element minOccurs="5"
>> maxOccurs="72" /> that require a validation step, I will only get
>> <xsd:element minOccurs="0" maxOccurs="unbounded" /> from lists. This
>> approach is developer friendly and I like it, and just dropping the
>> Java classes into ObjectAid plugin for Eclipse and I get wonderful
>> documentation.
>>
>> For generating the WSDL and the XSD schemas I use cxf-java2ws-plugin,
>> however I have some limitations and I would like to improve the tool.
>>
>> The first big limit I have in cxf-java2ws-plugin, is that I cannot
>> control the name of the xsd files generated from the the tool: when I
>> use the maven-jaxb-schemagen-plugin, I can do this by using the
>> following options:
>> <schemas>
>>  <schema>
>>    <namespace>http://cristcost.net/ns/model</namespace>
>>    <file>model.xsd</file>
>>  </schema>
>>  <schema>
>>    <namespace>http://cristcost.net/ns/service</namespace>
>>    <file>service.xsd</file>
>>  </schema>
>>  ...
>> </schemas>
>> and in  cxf-java2ws-plugin nothing similar is available.
>>
>> The second big limit I have, is that I need to generate multiple WSDLs
>> files reusing the same XSDs, so I would need a tool which accepts
>> multiple service endpoint's implementation (SEI) classes, and only
>> generate one XSD file in case it is generate from the same annotated
>> pojo. (Currently, I have multiple executions to generate these WSDLs,
>> but in this way the same xsd is generated multiple for each SEI).
>>
>>
>>
>> thank you all, I hope I have not broken any rules of the mailing list
>> (mail to dev-faq@cxf.apache.org and dev-info@cxf.apache.org returned
>> nothing), else please forgive me.
>>
>> Cristiano
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: Contributing to java2ws tool for maven

Posted by Daniel Kulp <dk...@apache.org>.
This is a relatively "complex" thing to do as it more or less would trace through a bunch of things.   The main place you would need to look is in JAXBUtils.generateJaxbSchemas.  That is where the schemas are "created".   It's done by calling into the JAXB context which then generates the schemas.   We pass in a SchemaOutputResolver to create the DOMResult objects.   For the most part, we just use the "suggested" name that JAXB provides.   However, that method could be updated to allow passing some sort of Namespace -> Filename map or similar that could be used.   We'd then need to trace the calls into there to provide enough hooks for the java2ws to be able to pass that map in.  Patches would certainly be welcome.

That said, that would just solve the JAXB case.   If you need this for the other data bindings (like Aegis), we'd have to look into each of those as well.

Dan


On Nov 24, 2012, at 12:11 PM, Cristiano Costantini <cr...@gmail.com> wrote:

> Hello all,
> 
> I'm in search for help to orient myself in the source code of the
> java2ws tool and most importantly on using it from maven.
> 
> To study it, I've spent some time debugging the following projects:
> cxf-java2ws-plugin, cxf-tool-common, cxf-tool-java2ws and also
> cxf-codegen-plugin
> but when I get deep on the stack I get in classes which have limited
> comments and it is very hard to understand their behavior and how to
> eventually modify them respecting the application philosophy...
> 
> I'm in search for some help, hints and guideline to try working on it
> and produce some patches, is there any expert who can give me some
> help and illuminate me on the tool architecture? It would be great the
> get in touch via some instant messaging application (irc or gtalk or
> anything else).
> 
> 
> Background:
> I work using the java first approach and writing classes annotated
> with jaxb it are our "modeling framework".
> This approach works good as the generated WSDL is natively friendly to
> Java, in the sense that the generated XML Schemas match Java classes
> and rules and we can avoid validation of input XML safely: for
> example, the schema will not have an <xsd:element minOccurs="5"
> maxOccurs="72" /> that require a validation step, I will only get
> <xsd:element minOccurs="0" maxOccurs="unbounded" /> from lists. This
> approach is developer friendly and I like it, and just dropping the
> Java classes into ObjectAid plugin for Eclipse and I get wonderful
> documentation.
> 
> For generating the WSDL and the XSD schemas I use cxf-java2ws-plugin,
> however I have some limitations and I would like to improve the tool.
> 
> The first big limit I have in cxf-java2ws-plugin, is that I cannot
> control the name of the xsd files generated from the the tool: when I
> use the maven-jaxb-schemagen-plugin, I can do this by using the
> following options:
> <schemas>
>  <schema>
>    <namespace>http://cristcost.net/ns/model</namespace>
>    <file>model.xsd</file>
>  </schema>
>  <schema>
>    <namespace>http://cristcost.net/ns/service</namespace>
>    <file>service.xsd</file>
>  </schema>
>  ...
> </schemas>
> and in  cxf-java2ws-plugin nothing similar is available.
> 
> The second big limit I have, is that I need to generate multiple WSDLs
> files reusing the same XSDs, so I would need a tool which accepts
> multiple service endpoint's implementation (SEI) classes, and only
> generate one XSD file in case it is generate from the same annotated
> pojo. (Currently, I have multiple executions to generate these WSDLs,
> but in this way the same xsd is generated multiple for each SEI).
> 
> 
> 
> thank you all, I hope I have not broken any rules of the mailing list
> (mail to dev-faq@cxf.apache.org and dev-info@cxf.apache.org returned
> nothing), else please forgive me.
> 
> Cristiano

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com