Combine JAXB and JAXWS for an imported XML Schema

后端 未结 3 1263
遇见更好的自我
遇见更好的自我 2021-01-07 07:50

How can I specify a JAXB Binding for an imported XSD within a WSDL when using wsimport?

I tried following binding, which causes the error \"XPath evaluation of //xs:

3条回答
  •  一整个雨季
    2021-01-07 08:06

    Sorry for the necro-threading, I encountered this problem and although this is one of the first answer that showed up on google with various key word combination it didn't hold the answer I ended up using.


    For imported schemas, the easiest way to specify a JAXB binding on an imported XSD within a WSDL is... to treat it as a completely different schema !

    Short example :

    MyXSD.xsd

    
        
            
        
    
    

    No matter where this xsd is imported (wether it's at the root of the of my wsdl or within a nested import), all I need to write to bind my "ThingThatNeedsToBeBound" in my custom binding is :

    customBindings.xml

    
        
    
    

    So, it's just like a regular case, except that you specify the schemaLocation, but then you can consider the imported schema as a whole itself instead of a part of something.

    I hope this will help others stumbling upon this problem.


    Source : http://www.oracle.com/technetwork/articles/grid/jax-ws-jaxb-customization-082750.html

    (Note : in the source, the solution seems way more complicated, so my case might have been simpler than what they described, I found my solution using that none the less !)

提交回复
热议问题