users@jaxb.java.net

Re: Setting marshaller properties with JAX-WS

From: Adam Zell <zellster_at_gmail.com>
Date: Tue, 3 Aug 2010 21:33:43 -0700

Hello,

On Tue, Aug 3, 2010 at 3:21 PM, Adam Zell <zellster_at_gmail.com> wrote:

> Hello,
>
> On Tue, Aug 3, 2010 at 2:21 PM, Glen Mazza <glen.mazza_at_gmail.com> wrote:
>
>> This is how it can be done in CXF at least:
>> http://cxf.apache.org/docs/jaxb.html#JAXB-NamespacePrefixManagement
>>
>> Metro is weaker here apparently:
>> http://forums.java.net/jive/message.jspa?messageID=348514 (scroll to
>> Andreas' response at the very end of this thread.)
>>
>> I tried the suggestion in the above thread, but for whatever reason the
> JAXBRIContext object is not being called for a marshaller. Next step is
> probably going through the JAX-WS source code.
>

Just for completeness, I believe the reason that wrapping the JAXBRIContext
does not work is the coupling between JAXBContextImpl and Bridge.
JAXBContextImpl defines the following, which is used for marshalling by
Bridge:

    /**
     * Pool of {_at_link Marshaller}s.
     */
    public final Pool<Marshaller> marshallerPool = new
Pool.Impl<Marshaller>() {
        protected @NotNull Marshaller create() {
            return createMarshaller();
        }
    };

When Bridge needs a marshaller, it directly accesses the pool instead of
calling createMarshaller.


>
>> Glen
>>
>>
>> Adam Zell wrote:
>>
>>> Hello,
>>>
>>> I would like to control namespaces using a NamespacePrefixMapper and the
>>> "com.sun.xml.bind.namespacePrefixMapper" property on a Marshaller. This is
>>> fairly straight-forward using JAXB. However, I can't quite see how to do
>>> this with JAX-WS.
>>> I created a custom JAXBRIContext called via @UsesJAXBContext which
>>> wrapped the JAXBRIContext.newInstance() return value, but it doesn't appear
>>> that the createMarshaller() method is ever called.
>>>
>>> Is there a better way to do this?
>>>
>>> --
>>> Adam
>>> zellster_at_gmail.com <mailto:zellster_at_gmail.com>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>
> --
> Adam
> zellster_at_gmail.com
>



-- 
Adam
zellster_at_gmail.com