Showing posts with label Contract first. Show all posts
Showing posts with label Contract first. Show all posts

Developing WSF/PHP Webservices With Contract First Approach - 2 Minutes Introduction

Monday, September 8, 2008

Are you finding a quick guide to develop a web service starting from a WSDL (contract first approach). Have a look at my blog on Developing WSF/PHP Webservices With Contract First Approach - 2 Minutes Introduction

How Code Generation Makes Development Easy Over Traditional WSDL Mode

Thursday, February 14, 2008

Yesterday Samisa's blog revealed new approach that WSF/PHP is going to take in the next major release.

WSF/PHP is going to introduce pre code generation for both Web Service clients and services for PHP developers. I think this may little strange to PHP people who used to expect things happening in run time. But sometime it s better to tests different paths to test and pick the ideal method.

I see several advantages in static code generation over current run-time support for the WSDL mode.
1. The usability is high,
Currently we should write classes manually in order build the data tree of the payload, For that you need to have at least some idea of WSDL and XML Schema. But we cannot expect an average user identify these types and write PHP Classes by hand. So it is better we have systems generating classes.

2. Low error-prone
If you have set of classes pre-defined to use in your system it will be no doubt less error-prone than using classes written by yourself. Because current way you may do errors both in writing classes and invoking services, so generated code will eliminate the errors in writing classes.

3. Rapid Development
It would give you some part of code written for you

4. Sample Demos
Easy to generate sample demos for a particular WSDL, so users will be able to follow them in their application

5. Performance,
If we can bypass the wsdl mode with the newer code generation approach that would enhance the performance, So surely in the first step the generated code would be mostly run using the current wsdl mode, so there will be no performance improvement.

6. Easiness in testing
Mostly this open the path to automate testing.

Approaches you can select in developing your PHP Web Service

Wednesday, January 9, 2008

When you start writing a Webservice you will have to choose one of the two popular approaches of developing a Webservice, i.e. code-first approach or contract-first approach.

In code first approach, initially you will code the interfaces you want to publish as the web service even with the business logic inside. Then you generate WSDL which become the contract (at least the major part of the contract) based on the written code.

Whereas In contract-first approach, you first start with writing the WSDL and then you generate codes for the programming language to provide and consume the service. From these two approaches you need to selectively choose the best one for you based on your problem environment. You may find some good explanation of this topic by Ajith Ranabahu in here.

WSO2 Web Service Framework for PHP
give you the maximum support for both kind of approaches.

If you already have written the service code and deployed it, you can get generated the WSDL by just adding "?wsdl" to the end of service URI. That is for the people who uses code-first approach.

If you already have the WSDL, then you will be able to use the WSDL mode API to write the service enabling the contract-first approach. This really minimize the effort and time you have to spend in writing a service, although it is encouraged to use the XML in/out mode API, which no doubt gives you more performance.