You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Yoav Abrahami <yo...@gmail.com> on 2008/07/26 17:10:15 UTC

Fwd: Introducing J2XB for Axis

Hi all,

I have implemented an Axis2 module with J2XB binding.
The module adds ability to use J2XB binding with Axis2 web services as well
as WSDL generation from the service class.

At introduction page to the module can be found at
http://j2xb.sourceforge.net/Axis%202%20Introduction.html

For anyone who is looking for a simple example to demonstrate the J2XB Axis2
module, see at
the module introduction page and at
http://j2xb.sourceforge.net/Axis%202%20Advanced%20Example.html

The module can be downloaded from
https://sourceforge.net/project/showfiles.php?group_id=228363

I'd appreciate if you update the Axis2 website with the new binding module.

cheers,
  Yoav

---------- Forwarded message ----------
From: Yoav Abrahami <yo...@gmail.com>
Date: Mon, Jun 2, 2008 at 5:03 PM
Subject: Re: Introducing J2XB for Axis
To: axis-dev@ws.apache.org


Hi all,

I have found the following so far -

1. I can write new implementations of the receivers to implement J2XB
marshaling and unmarshaling. doing so seems quite simple given the provided
samples. This will require the J2XB service to include in the service.xml
file the mapping to the new J2XB receivers. Is there a better way to do
this?

The receivers to subclass -
AbstractInMessageReceiver
AbstractInOutAsyncMessageReceiver
AbstractInOutSyncMessageReceiver
AbstractMessageReceiver

2. WSDL generation - I have found the Axis2 generates WSDL automatically for
services who do not provide a ready-made WSDL. The process is performed by
the AxisService, AxisService2OM and AxisService2WSDL2 classes and does not
appear to allow extensions.I can integrate J2XB Schema generation into those
classes but it will require changes to those classes. Is there any plugin /
extension mechanism that I am missing?

Cheers,
  Yoav





On Mon, Jun 2, 2008 at 3:54 PM, Yoav Abrahami <yo...@gmail.com> wrote:

> Hi Amila,
>
> As you have noticed, J2XB is going in the direction of Java2WSDL, not
> WSDL2Java. In fact, writing WSDL2Java in the case of J2XB is a challenge
> because J2XB allows to map the same WSDL (actually the same XSD) to
> different Java representations.
>
> I have looked at the Java2WSDL code and it does not seem to allow any
> extensions. Extending Java2WSDL to support J2XB will allow this tool to be
> able to support more advanced Java structures (including collections,
> constructors, etc) and generate more detailed XML schemas (constraints,
> substitution groups, etc). It looks like we can either change the Java2WSDL
> tool itself or write a new one.
>
> Note that the J2XB Java code does not include methods such as toOM and
> fromOM, instead we use a separate engine (from the model classes). How do I
> implement the marshaling and unmarshaling of the WS call parts (I assume
> those are converted to OMElements by Axis2) to J2XB? J2XB has the methods to
> marshal and unmarshal an OMElement to Java classes. For unmarshling we
> require the OMElement to unmarshal and it's QName. For marshaling we require
> only the Java instance.
>
> I have tried to find where XmlBeans is integrated into Axis2 for the
> marshal and unmarshal and failed to find it. Can you point me at the right
> direction?
>
> Cheers,
>   Yoav
>
>
>
>
> On Mon, Jun 2, 2008 at 9:12 AM, Amila Suriarachchi <
> amilasuriarachchi@gmail.com> wrote:
>
>> hi Yoav,
>>
>> As I understood from your mail it is not an alternative to ADB, Xmlbeans
>> and jaxb. What these frameworks does is that they generate the java classes
>> from a given schema.
>> For me this is some what similar to jibx.
>> you can have an idea of how Axis2 codegeneration works and overall axis2
>> architecture (WSDL2java tool) here[1].
>>
>> And also please see the xmlbeans module. And see how xmlbeans integrated
>> to Axis2.
>> Here mainly you have to write a Codegen utility class
>> (org.apache.axis2.xmlbeans.CodeGenerationUtility) to generate the java code
>> from the XmlSchema and return a Map which contain the QName and the
>> generated class name. Axis2 codegen engine use this information to generate
>> the classes.
>>
>> And also you need to write a binding template which mainly implement the
>> toOM and fromOM methods.
>>
>> Then add an extension to Codegen module (eg.
>> org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension)
>>
>> to register with the WSDL2java tool.
>>
>> feel free to ask any question. I'll bit busy for this week. certainly be
>> able to answer any thing from next week.
>>
>> thanks,
>> Amila.
>>
>> [1] http://ws.apache.org/axis2/1_0/Axis2ArchitectureGuide.html
>>
>>
>> On Sun, Jun 1, 2008 at 11:35 PM, Eran Chinthaka <er...@gmail.com>
>> wrote:
>>
>>> Hi Yoav,
>>>
>>> Good points. I think first you should approach to WSDL2Java generation.
>>> You can see [1] for some information on it. That article was written by our
>>> Mr. ADB and I think he will help you if you have any problem during the
>>> process.
>>>
>>> I think first you will have to convince the devs here, that J2XB is
>>> really good by some sorta performance or features implemented. Then they
>>> will deep dive in to J2XB.
>>>
>>> Please read the above article [1] and let us know when you have problems.
>>> Ajith and Amila (gurus of ADB) will help you for sure. ("A" in ADB can be
>>> any of "Axis2", "Ajith" or "Amila" ;) )
>>>
>>> One another point. ADB is not meant to be a complete data binding
>>> framework. We designed it to be a simple framework which is tightly
>>> integrated in to things like AXIOM within Axis2. ADB might serve the purpose
>>> most of the time, I think. I specially like it since it is light weight and
>>> tightly coupled in to the internals of Axiom.
>>>  If J2XB is a light weight framework to generate schema from Java
>>> classes, then perhaps we might be able to use that to improve our Java2WSDL
>>> as well. For the time being, IIRC, we use some sorta reflection and
>>> annotations mechanism and definitely we like to get some help for that too.
>>>
>>> Thanks,
>>> Eran Chinthaka
>>>
>>> [1] : http://wso2.org/library/35
>>> On Sun, Jun 1, 2008 at 1:51 AM, Yoav Abrahami <yo...@gmail.com> wrote:
>>>
>>>> Hi Eran,
>>>>
>>>> J2XB certainly introduces new functionality beyond ADB, XmlBeans or
>>>> JiBX.
>>>>
>>>> * XMLBeans Supports Java code generation from an XML schema - it
>>>> requires that the generated binding classes be separate then the application
>>>> classes and it does not generate an XML schema from Java code.
>>>>
>>>> * JiBX has good support for binding Java Beans to XML and back. However,
>>>> it is still missing some features such as XML Schema generation (which is
>>>> important for WSDL generation), XML list styles, flexibility in enumeration
>>>> support, etc.
>>>>
>>>> * ADB - well, ADB is a simplistic databinding framework, but still has a
>>>> lot of features missing compared to J2XB.
>>>>
>>>> I think that integrating J2XB into Axis 2 is a good idea (and hence this
>>>> thread). However, I find it difficult to do so myself - I am not a member in
>>>> the Axis 2 dev team. As such, except the technical difficulty, I do not have
>>>> the knowledge now Axis 2 is structured and where the I should integrate J2XB
>>>> (in the code). I am seeking help from you guys here to help in this
>>>> integration.
>>>>
>>>> I can think of 4 possible integration points:
>>>>
>>>> * marshaling and unmarshaling XML to Java classes used as parameters for
>>>> an Axis WS (in an AAR archive).
>>>>
>>>> * marshaling and unmarshaling MXL to Java classes used as parameters for
>>>> an Axis WS client
>>>>
>>>> * automatic WSDL generation for a service in an AAR.
>>>>
>>>> * extending Java2WSDL to support J2XB binding
>>>>
>>>> I am basically looking of developer involvement (from the Axis team) to
>>>> help creating those integrations.
>>>>
>>>> Cheers,
>>>>   Yoav
>>>>
>>>>
>>>> On Sat, May 31, 2008 at 5:13 AM, Eran Chinthaka <
>>>> eran.chinthaka@gmail.com> wrote:
>>>>
>>>>> Perhaps you can integrate J2XB into Axis2 and prove, using some
>>>>> experimental results, the areas J2XB is better than ADB or XMLBeans or JiBX.
>>>>>
>>>>> And I hope this will motivate our ADB team and Mr. JiBX (Dennis) to
>>>>> compete with J2BX :)
>>>>>
>>>>>
>>>>> On Fri, May 30, 2008 at 4:30 AM, Yoav Abrahami <yo...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Axis dev team.
>>>>>>
>>>>>> (I hope this is the right mailing list. if not, my apologies)
>>>>>>
>>>>>> I have recently released the J2XB (Java 2 XML Binding) project as an
>>>>>> open source project. I believe J2XB can be used as a new binding for Axis 2
>>>>>> and offer some unique advantages over the existing bindings.
>>>>>> see at http://j2xb.sourceforge.net/index.html
>>>>>>
>>>>>> J2XB is unique in that it allows to annotate Java classes and generate
>>>>>> the XML schema (XSD) from the Java classes, including facets, constraints,
>>>>>> etc. In addition, it allows to map any Java class to XML structure in a vary
>>>>>> flexible way, supporting any Java class (POJO) including classes with
>>>>>> non-trivial constructors and factories. All this is performed without need
>>>>>> to write code or to generate code.
>>>>>>
>>>>>> Connecting J2XB and Axis 2 will result in the ability to white a Web
>>>>>> Service the axis way (POJO in an AAR) with WSDL generated including XSD
>>>>>> generated form the Java classes. The XSD generated can then be controlled
>>>>>> using the J2XB annotations.
>>>>>>
>>>>>> Note that J2XB allows considerably more control over the XML structure
>>>>>> compared to JAXB.
>>>>>>
>>>>>> In hope that there is interest to join forces,
>>>>>>
>>>>>> Cheers,
>>>>>>    Yoav
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> With Mettha,
>>>>> Eran Chinthaka
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> Health is the greatest gift; contentment is the greatest wealth;
>>>>> trusting is the best relationship; nirvana is the highest joy. - Dhammapada
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> With Mettha,
>>> Eran Chinthaka
>>>
>>> --------------------------------------------------------------------
>>> Health is the greatest gift; contentment is the greatest wealth; trusting
>>> is the best relationship; nirvana is the highest joy. - Dhammapada
>>>
>>
>>
>>
>> --
>> Amila Suriarachchi,
>> WSO2 Inc.
>
>
>