>
>
> 2. Try CXF JAXBDataBinding, by embedding the following fragment in the
> jaxrs:server:
>
> <jaxrs:dataBinding>
>       <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
>
>         <property name="namespaceMap">
>               <map>
>                       <entry>
>                               
> <key><value>http://cxf.apache.org/anonymous_complex_type/</value></key>
>                               <value>BeepBeep</value>
>                       </entry>
>                       </map>
>         </property>
>       </bean>
>       </jaxrs:dataBinding>
>
> The namespaceMap property is just an example on how  CXF JAXBDataBinding
> can be configured but I believe one can specify additional packages/classes
> for which JAXBContexts will be precreated.
>
> the property is called 'extraClasses' [1] but I'm not sure it will help in
your case

[1]
http://iona.com/support/docs/artix/5.1/jaxws_pguide/JAXWSDataMappingOverMoreClasses.html

Perhaps, it is also possible to use JAXBContext explicitly in your code.
>

I meant 'JAXBElement'

so perhaps extending JAXBElementProvider is the only viable option at the
moment


>
> Hope it helps, Sergey
>
>
>
>
> On Wed, Apr 14, 2010 at 12:01 PM, Gareth Hughes <
> [email protected]> wrote:
>
>> Hi,
>>
>> Background: I'm implementing an OAIPMH repository server using JAXRS.
>> I've written the client (called a harvester) already and the server is
>> up and running.
>>
>> The server returns XML using the OAIPMH namespace
>> http://www.openarchives.org/OAI/2.0/ and this thing is used to return
>> information from archives and libraries. The clever bit is that the
>> information about each entry can be in any other xml format. Usually
>> Dublin Core which is a different xml namespace.
>>
>> In code I use objectFactory to build the OAIPMH objects and then add in
>> my other object from a different namespace. When the server returns I get
>>
>> JAXBException occurred : com.foo.domain.binding.CatalogueSearchResultDTO
>> is not known to this context.
>>
>> This class can be unmarshalled but the server doesn't know where to find
>> this class.
>>
>> When I wrote the Harvester, which unmarshal all the xml in the other
>> direction, I had to write lines like this to get my marshaller to know
>> about all the possible packages:
>>
>> String OAI_DC_PACKAGE
>>
>> ="gov.loc.mets:org.openarchives.oai._2_0.oai_dc:org.purl.dc.elements._1:gov.loc.marc21.slim:org.openarchives.oai._1_1.oai_marc";
>> private Unmarshaller oaiDCUnmarshaller =
>> JAXBContext.newInstance(OAI_DC_PACKAGE).createUnmarshaller();
>>
>>
>> What's equivalent of this for the Spring config of the jaxrs:server? How
>> do I tell it what java packages it can unmarshal?
>>
>> I currently have the following.
>>
>>    <bean id="jaxbProvider"
>> class="org.apache.cxf.jaxrs.provider.JAXBElementProvider" />
>>
>>    <jaxrs:server id="oaipmhServiceServer" address="/">
>>        <jaxrs:serviceBeans>
>>            <ref bean="oaiServerInvocation" />
>>        </jaxrs:serviceBeans>
>>        <jaxrs:providers>
>>            <ref bean="jaxbProvider" />
>>        </jaxrs:providers>
>>    </jaxrs:server>
>>
>> Hope this all makes sense
>>
>> Is there a reference guide for the values in jaxrs:server? I found that
>> the API docs have no comments.
>>
>>
>> Thanks very much
>>
>> Gareth Hughes
>>
>> Axiell Limited (registered no. 01607548) is a private limited company
>> registered in England. The address of the Registered Office is Unit 2, Hall
>> View Drive, Bilborough, Nottingham, NG8 4GD. VAT registration no. GB 610
>> 5069 78.
>>
>> DISCLAIMER:
>> This e-mail is only for the use of the intended recipient and may contain
>> confidential information. If you have received this e-mail in error, please
>> notify the sender immediately, delete it and do not use or disseminate its
>> contents. Any views or opinions are solely those of the author and do not
>> necessarily represent those of the Company. This e-mail may be monitored.
>>
>
>

Reply via email to