Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what do contract-first and contract-last mean?

Tags:

web-services

I am doing some research on web services. I have not written any web service but I am doing a small write up on them.

During my research I've come across terms contract-first and contract-last.

Can someone explain these two in an understandable form ?

like image 992
Omnipresent Avatar asked Dec 14 '09 04:12

Omnipresent


People also ask

What is contract-first?

In a contract-first approach, you start development by defining the contract, or the 'interface' of the service. In the code-first approach you start development from code and then create the contract. Software that is designed using interfaces hides implementation details and promotes code reuse.

What is contract-first approach in SOAP?

The Contract-first approach tells us to create first WSDL and then create end-point interface and implementation class. The Contract-last approach tells us to create first end-point interface and implementation class then create WSDL file.

What is contract-first web service?

In the contract-first web service, the “contract” (a WSDL definition of operations and endpoints and XML schema of the messages) is created first, without actually writing any service code. In the contract-last web service, existing logic is “exposed” as a web service and the contract is created at the very end.

What is a WSDL contract?

WSDL contracts define services using Web Service Description Language and a number of possible extensions. The contracts have a logical part and a physical part. The abstract part of the contract defines the service in terms of implementation neutral data types and messages.


2 Answers

To expound on the answer by Kaleb, contract-first is where you create the WSDL, and then you can create the implementation from this, and since the WSDL is your contract, this would be contract-first.

Contract-last is where the WSDL is created from the source code, or implementation, so it will most likely be generated by a tool rather than created by the developer.

Update:

For a nice explanation with code, in Java, you can look at this explanation from the Spring Web Services 1.5 documentation.

They will discuss the pros and cons, though they will be biased toward their approach (which is contract-first). Anyway, I think it is a nice explanation.

like image 180
James Black Avatar answered Oct 04 '22 02:10

James Black


Contract-first means you design the way your services are going to communicate with each other before you design the services themselves.

Contract-last is the other way around – you design how your service is going to work, then make one or more methods available as the interface for other services.

like image 23
Kaleb Brasee Avatar answered Oct 04 '22 01:10

Kaleb Brasee