My experiences with SOAP Web-service PHP vs .NET March 21, 2008
Recently I have been developing web-services for integration of one of our flagship product to other POS software at Meditab Software. My official working platform is PHP and we have been developing web services for communication between our products to internal web applications in the past but it was like "We understand what we speak..!" as we have not been dealing with any external entity during these communications the input parameters used to be simple data-types and for output we understand what we give back using single simple data-type.
When I read requirement specification for the web service which I have developed recently I thought I could finish it in a day or two as I have been developing web-services recently. I went on and started and went into trouble with "complexType" declaration in WSDL. I was having C# example to work with provided by the company which was going to use my webservice. I tried that but the thing is when you use Microsoft ASP.NET platform to develop web services what developer needs to is just expose their method with [WebMethod] attribute and you are done! All hardwork and complex WSDL generation will be done by .NET framework. But when it comes to PHP you gotta deal with WSDL generation and make sure you do it perfectly or else your web-service won't work.
In PHP we have SOAP extension which really helps when we need to develop web services and that's what I have been using previously. But it doesn't help you/me for generating WSDL files and that part we have to bare with. I have searched out google for help but it was difficult to find perfect working example of Web service which takes in and out Complex Data types. Here Complex Data Type means user defined Classes and Arrays. When we work with ASP.NET we just declare it as WebMethod and everything goes smooth, we don't need to worry about WSDL generation and anything else. I tried to use the same WSDL generated from ASP.NET C# example but it didn't worked in my case and won't work for anyone. Here I mean we can get some idea about but direct copy + paste won't work. Because it has to be made in a way that SOAP extension understand that and generate RESPONSE and REQUEST XML in desired way. It took me considerable amount of time to got through the proper WSDL generation and I took almost 4 and 1/2 days to get that project done.
Here I would like to mention that PHP SOAP extension is not well documented and it requires quite a lot of hardwork when we need to deal with complicated Web Services. Although some WSDL generators are available (I am talking about some WSDL generator projects and Zend WSDL generator which comes with Zend Studio), they sometimes don't work perfectly for our requirement.
Here I would like to mention one more thing that eviware soapUI tool helped me for checking that whether my WSDL file is proper or not as ultimately it was supposed to be consumed on some other platform. I even tested it out on PowerBuilder 10.5 as it is actually our company's main product's development platform to make sure it's compatibility.
Even getting web service port on other platform took some considerable amount of time and XML and SOAP namespace nitty-gritty are difficult for newbie to get through. I am lucky I got a chance to develop this project.
I am planning to post proper example post explaining how to deal with PHP and SOAP web-services soon. I would like all readers to share their experiences with me on this blog for this subject.