Why people don't do WSDL-first?

淺唱寂寞╮ 提交于 2019-12-11 01:39:13

问题


I'm currently making a presentation that deals with web services.

We created our service using WSDL+XSD-first approach, in which we first created (with the aid of tools) the XSD schema and WSDL and then compiled both to .NET and Java classes for interoperation.

I want to justify why we used this approach. I mentioned that it's more OOP-compliant (first define interface, then implementation, not vice versa) and that you have more control over interoperability constraints. Also, you can define namespaces explicitly and help reuse XSDs across applications

On the contrary, today, still many people prefer implementing the code in their IDE and generate WSDL from there. The question is, why?


回答1:


Both styles of development have advantages and disadvantages but I don't think contract last is used more just because it's easier and quicker on the newbies, as you say, but mainly because as tools and frameworks evolved, the WSDL quickly moved into what's cataloged as plumbing code, quote:

[...] the behind-the-scenes low-level code that bridges between the application and lower layers. The coding of that stuff is often fairly dull and repetitive, but it's required to make the system work.

Nobody wants to write boring, repetitive code, especially when there are plenty of tools and frameworks to do it for you. If you don't even have to understand SOAP, WSDL or XSD that's even better for some... or should I say "magic"... but that's a different discussion :).




回答2:


I disagree - I think it has to do with expressing a contract, not development ease.

And I think the WSDL should be generated from the .xsd.

The Spring web service page has a nice discussion about "contract first" web services. Read it and see what you think.




回答3:


Not sure if my self-answer is the only answer but that's what I know

Because it's easier and quicker for newbie developers

Simply people don't all like learning new languages, but they prefer using the ones they master, no matter if their product won't work with a client from another platform




回答4:


When I create webservices (we mostly use JBoss which has a nice built in webservices system) I always define the interactions first in a general sense, but not in XML, I don't particularly like writing the XML myself. It's an ugly, verbose language. So what I do is I map out my responses and parameters as Java objects, then annotate them appropriately, and then once I deploy the application I magically have a webservice without ever having to write XML. WSDLs and XSDs are kind of verbose and what JBoss generates for me isn't any better than what I used to have to write myself, and arguably it saves a lot of time. You don't necessarily have to implement the service at that point, just the response and input data structures. And then you can take that wsdl that it generates for you and use whatever tool you want to generate the objects the client needs.



来源:https://stackoverflow.com/questions/11586512/why-people-dont-do-wsdl-first

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