On Aug 6, 2013, at 8:41 AM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:

> As it happens Dan has just enhanced CXF JAXBUtils to support the Moxy JAXB 
> implementation directly, so that may help in your case as well.

Kind of….  Every time I try updating the code in CXF to work with Moxy, I run 
into another bug in Moxy that I need to log with them and wait for a fix.   :-( 
  Hit another one yesterday.   The good news is that they HAVE been fixing the 
issues fairly quickly.

The other thing I keep running into are tests that use direct XML -> String and 
assert information about text in that String.   Moxy uses completely different 
default namespace prefixes so all those tests end up failing.   Kind of a slow 
going side project.


> I can see from the Dan's comments that Moxy supports a Map directly as a 
> namespace mapper.
> So I'd like to ask, would it help if I also added a custom NamespaceMapper 
> object setter, assuming that in your case, you have nether RI or Moxy JAXB 
> implementations used and also have to use some custom NamespaceMapper 
> representation, something different than a Map ?

The best option is to use a Map<String, String> in the implementation and use 
the JAXBUtils.setNamespaceMapper(Map, Marshaller) to handle adding it to the 
context.   That will automatically handle the two Sun implementations and 
Eclipse depending on the implementation it finds.

Dan



> Or may be even Map but not with Moxy ?
> 
> Let me know please
> Thanks, Sergey
> 
> On 01/08/13 22:06, Sergey Beryozkin wrote:
>> Hi
>> On 01/08/13 19:03, Osvaldo Pina wrote:
>>>   Sergey,
>>> 
>>>   Sorry to bother you again with this problem but I did some research in
>>> the cxf source code and I think that changing the property will not solve
>>> the problem because the AbstractJAXBProvider will always try to create
>>> a NamespaceMapper (inside protected void setNamespaceMapper) which is a
>>> child of jaxb-impl com.sun.xml.bind.marshaller.NamespacePrefixMapper (and
>>> in vm runtime the class is
>>> com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper). So, I think
>>> that the best solution for that is to create a child
>>> of JAXBElementProvider, overriding setNamespaceMapper in order to
>>> create a
>>> custom NamespaceMapper. Am I correct? If so how can I instruct
>>> the JAXRSClientFactoryBean to programmatically create an instance of my
>>> custom JAXBElementProvider instead of the default one?
>>> 
>> well, it is me who is sorry for not addressing this issue properly :-).
>> Thanks for your investigation. Yes, at the moment, registering a
>> JAXBElementProvider extension will do, I will also get rid of
>> "namespaceMapperProperty" and see what else might be improved
>> 
>> Thanks, Sergey
>>>    Ats,
>>>    Osvaldo Pina.
>>> 
>>> 
>>> On Wed, Jul 31, 2013 at 12:07 PM, Osvaldo Pina
>>> <osvaldo.p...@gmail.com>wrote:
>>> 
>>>> Thanks a lot for the information!
>>>> 
>>>> 
>>>> On Wed, Jul 31, 2013 at 11:55 AM, Sergey Beryozkin
>>>> <sberyoz...@gmail.com>wrote:
>>>> 
>>>>> On 31/07/13 15:52, Osvaldo Pina wrote:
>>>>> 
>>>>>>   Sergey,
>>>>>> 
>>>>>>    You mean 2.6.7? because I could not find the 2.7.7 version.
>>>>>> 
>>>>>>  Actually, I got confused, I'm telling everyone CXF 2.7.7 is the
>>>>>> latest
>>>>> :-) I meant 2.7.6, sorry about it. CXF 2.6.9 should also have those
>>>>> properties supported
>>>>> 
>>>>> Cheers, Sergey
>>>>> 
>>>>> 
>>>>>      Ats,
>>>>>>     Osvaldo Pina.
>>>>>> 
>>>>>> 
>>>>>> On Tue, Jul 30, 2013 at 6:09 AM, Sergey Beryozkin
>>>>>> <sberyoz...@gmail.com
>>>>>>> wrote:
>>>>>> 
>>>>>>  Hi
>>>>>>> 
>>>>>>> On 29/07/13 21:32, Osvaldo Pina wrote:
>>>>>>> 
>>>>>>>       Hi all,
>>>>>>>> 
>>>>>>>>      I have a very strange scenario. I need to use CXF 2.7.1 for
>>>>>>>> jax-rs (I
>>>>>>>> can change to another version) in a IBM JVM (build 2.6, JRE 1.6.0)
>>>>>>>> without
>>>>>>>> including the jaxb-impl that cxf requires. I have a lot of
>>>>>>>> serialization
>>>>>>>> tests that I executed under IBM Jvm and all passed. In my scenario I
>>>>>>>> noticed only a problem with namespaces. Which is not a problem
>>>>>>>> for me
>>>>>>>> to
>>>>>>>> remove them. Does anyone knows other compatibility issues?
>>>>>>>> 
>>>>>>>>  One thing I'm aware of is that up to CXF 2.6.6 (inclusive) XML or
>>>>>>> Jettison
>>>>>>> (JAXB-based) providers will fail if namespace prefixes have to be
>>>>>>> customized due to these provides using JAXB RI specific properties to
>>>>>>> set
>>>>>>> namespace mappers. The same issue would apply to JAXBProvider
>>>>>>> trying to
>>>>>>> set
>>>>>>> XML Processing Instructions.
>>>>>>> In CXF 2.7.7 I added properties to these providers (ex,
>>>>>>> "namespaceMapperProperty") which can be used to set a property
>>>>>>> recognized
>>>>>>> by non JAXB-RI implementations and which will be used to set
>>>>>>> namespace
>>>>>>> mappers if needed.
>>>>>>> 
>>>>>>> May be that can help ?
>>>>>>> 
>>>>>>> Sergey
>>>>>>> 
>>>>>>> 
>>>>>>>>      Ats,
>>>>>>>>      Osvaldo Pina.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> --
>>>>> Sergey Beryozkin
>>>>> 
>>>>> Talend Community Coders
>>>>> http://coders.talend.com/
>>>>> 
>>>>> Blog: http://sberyozkin.blogspot.com
>>>>> 
>>>> 
>>>> 
>>> 
>> 
>> 
> 
> 

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

Reply via email to