• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Schema first approach with duplicate classnames

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have got this problem with an external provided response.xsd and original.wsdl, where the generated (response)object contains a nested structure that looks simplified like


Using XSD as source with JAXB2-XJC, I have found a solution for this by renaming the duplicate elements in an external XJB binding file.




Now I need to do the proxy object generation using the original.wsdl as source with Apache-CXF. The complication is that the WSDL imports the xsd that I try to customize:

My custom.xjb:

The CXF part of my pom.xml:

The original.wsdl gets compiled but my custom.xjb binding file does not result in any class name modification.

mvn clean generate-sources gives as only logging


 
Saloon Keeper
Posts: 15529
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Customizing the XSD simply is not the solution. Does CXF not generate a valid client from the original WSDL? If not, then you really need to take up this problem with the creators of the WSDL. Hacking around by redefining the data types WILL lead to more problems further down the road.

Can you not share the relevant parts of the XSD with us? We don't need everything, just the type definition of the outer Person type (including namespace declarations) and the nested elements up until the inner Person type. If possible, the entire XSD is preferable.
 
Kenji Watanabe
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stephan,

No client generated but constructed manually.

For clarification of the structure I have included the real xsd here, after anonymization and shortcutting it because of the original size and complexity:
 
Kenji Watanabe
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The wsdl:


I have validated the wsdl and xsd's with XMLSpy.

When I worked with JAXB2-XJC directly I had a lot more duplication problems but I could fix them with a binding file on the response.xsd.

With Apache CFX the wsdl compiles without problems and only when using the Response object I see a problem with PrimaryPerson, so I would like to customize the name of that class for each occurrence,
but I don't know how I use XPath to get to the specific xsd in the binding file.
 
Kenji Watanabe
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's only down to the right XPath expression to get to the response.xsd where I am trying to modify the Person class name.
I did try an alternative binding but the schema node of the imported XSD can not be found:

This is the result from my XJB

Background info: my directory structure is

└───resources
   │   application.yml
   │   logback.xml
   │
   ├───custom
   │      custom.xjb
   │
   ├───schema
   │      applicationfault.xsd
   │      header.xsd
   │      request.xsd
   │      response.xsd
   │
   └───wsdl
           original.wsdl

 
Kenji Watanabe
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I got it solved.

You do not need to reference the import path in the wsdl, only include the path to the xsd in the external binding file:
reply
    Bookmark Topic Watch Topic
  • New Topic