[ 
https://issues.apache.org/jira/browse/TUSCANY-3911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13078944#comment-13078944
 ] 

Simon Nash commented on TUSCANY-3911:
-------------------------------------

JAXB provides the @XmlJavaTypeAdapter annotation to do custom marshalling and 
unmarshalling. The marshalling side is easy (for example, an adapter could 
convert a ServiceReferenceImpl to a String containg the XML representation), 
but it might be harder to persuade the JAXB unmarshaller to do the right thing 
with the XML element that it reads from the wire. There's a example in [1] that 
may provide some useful pointers, though it seems like quite a complex approach.

[1] http://stackoverflow.com/questions/512337/custom-serialization-in-jaxb

> ServiceReference type not marshalled to XML correctly
> -----------------------------------------------------
>
>                 Key: TUSCANY-3911
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3911
>             Project: Tuscany
>          Issue Type: Bug
>          Components: SCA Java Runtime
>    Affects Versions: Java-SCA-2.0
>            Reporter: Scott Kurz
>            Priority: Minor
>         Attachments: 3911.recreate.patch
>
>
> When using a binding with an XML wireformat, the ServiceReference type is 
> going to be treated as a JAXB by the Tuscany databinding framework, and is 
> not going to get serialized correctly.
> E.g. see this intf from the itest/service-reference module:
> @Remotable
> public interface DComponent {
>     String foo(ServiceReference<AComponent> aReference); 
> It works fine when we use a binding.sca config that does Java serialization, 
> but if we try to use an XML wireformat we get the JAXB error:
>   org.oasisopen.sca.ServiceReference is an interface, and JAXB can't handle 
> interfaces.
> I'm guessing the solution is to use JAXBs customizations/annotations to tell 
> JAXB how to handle our ServiceReference impl.    But I'd have to look into 
> that.
> I guess there's also the idea of defining a new databinding but that seems 
> odd.
> Will attach a recreate patch.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to