Simon,

I know for the IBM Java 1.6 JDK I'm using, it works with:

 xmlns:jaxb="http://java.sun.com/xml/ns/jaxb";
       <jaxb:serializable uid="....."/>

I believe the JAXB spec specifies this.   Yes, it's definitely useful
in SCA where we have both styles of serialization.

Scott

On Tue, Aug 24, 2010 at 2:45 PM, Simon Nash <[email protected]> wrote:
> Scott Kurz wrote:
>>
>> Sebastian,
>>
>> Just wanted to jump in with a tip that will help you write an
>> exception class that is both Java-serializable (for RMI) as well as
>> XML-serializable (for binding.ws).  This is to use the JAXB
>> serializable customization.
>>
>> If you add something like this to the <schema> element containing the
>> definition of the schema type of the element your fault bean maps to:
>>
>> <schema targetNamespace="http://my.company"; jaxb:version="2.0"
>>  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb";
>>  xmlns="http://www.w3.org/2001/XMLSchema";>
>>  <annotation>
>>    <appinfo>
>>      <jaxb:globalBindings>
>>        <jaxb:serializable uid="....."/>
>>     </jaxb:globalBindings>
>>    </appinfo>
>>  </annotation>
>>
>> then I believe the default Java implementation of
>> readObject()/writeObject() will allow you to serialize/deserialize the
>> generated fault bean type just fine.
>>
>> I'd like to have tried it out before suggesting it, but I'm switching
>> machines and don't have Tuscany set up at this instant.
>>
>> Another general point to make about exception handling is that, from
>> the client catching the exception, you should only rely on the fault
>> bean obtained via getFaultInfo(), rather than other regular Java
>> exception features like getMessage() and getCause() which won't
>> necessarily be preserved across all bindings.  I think you already
>> recognize this point though...
>>
>> Not sure I understand your second question about interface
>> compatibility and package names so I wont' comment on that.
>>
>> Scott Kurz
>>
>>
> Hi Scott,
> I wasn't aware thar JAXB could generate Java classes that support
> Java serialization.  This could be very useful when designing interfaces
> that are intended to be RMI-friendly as well as XML/Web Services-friendly.
>
> I did a bit of googling for more information about this and I found a
> few web pages saying that the tag is <xjc:serializable> where the
> xjc prefix corresponds to "http://java.sun.com/xml/ns/jaxb/xjc";.
>
>  Simon
>
>

Reply via email to