WSImport generates conflicting XMLTypes for multiple Dynamics CRM 4.0 WSDL's

ⅰ亾dé卋堺 提交于 2019-12-04 03:06:57

This is Microsoft inconsistency combined with wsimport being somewhat hard to use.

The PickList and the CRMAuthenticationToken sound like custom datatypes, you'd expect for these to get reused from service to service. You'd also expect certain CRM-specific entities (say, Customer or Business or Address) to get reused from service to service.

It is bad manners on the Microsoft side of things that they define these differently for different services. This makes it hard to take the answer of one service and send it on to another service.

Had the services shared one or more common schemas, you could've compiled those first, using xjc. Then you could've provided a so-called episode file to wsimport to tell it to use those classes instead of generating new ones. See the metro guide. This is quite a puzzle, I can tell you from experience, I ran into bug JAXB-829, xjc forgets to generate if-exists attributes in the episode file.

What I'd do, I'd compile each wsdl to its own package and treat the generated classes as simple unintelligent Data Transfer Objects. If I wanted to send an object I'd just retrieved from one service on to a second service, I'd convert between the both. If this results in terribly unwieldy code, or if you wish to add logic to certain entities, I'd suggest you write your own proper model classes for the Entities you wish to share and write converters to and from the DTO objects in the web services packages you wish to use them with.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!