Categories


Loading feed
Loading feed

Adventures in Web Services


I had the pleasure this morning to present a screencast titled "Web Services with PHP" that was announced several days ago here on the Devzone. We had a tremendous turnout--nearly 2000 registrants! Due to technical limitations with our streaming software, we could only allow the first 550 folks into the presentation. Because of the network load, this was a difficult presentation to pull off due to lag. Paging from slide-to-slide was very delayed, so showing the code-completion capabilities of Zend Studio was nearly impossible.  Despite the technical difficulties, several good questions were asked and feedback was very positive. 

In order for everyone to see the presentation, I re-recorded it this afternoon, and it's available for your viewing. This one is much smoother, and I expanded on some of the topics that I glanced over in the first one. So even if you viewed the first attempt, you'll probably get more out of the second.

Oh yeah, congrats to Bill Rose from TX for winning a shiny new iPod Nano! 

Watch "Web Services with PHP" 

My personal thanks to Jen Walsh at Zend for all of her help with the presentation :)

Q & A 

Q: I would like to know if any standard WSDL generator for PHP is on development? SOAP works great in PHP5 but we are defintely missing a simple integrated WSDL generator.A: Zend Studio has a WSDL generation wizard that's a snap to use. You can read more about WSDL generation in code at George Schlossnagle's blog.

Q: To figure out the methods in $client object, I still have to inspect the wsdl right?
A: Yes. PHP creates a proxy object from the WSDL file that Zend Studio can inspect.

Q: Can the Zend Studio Client debug files that you're editing on remote sites, or do you need to have PHP/Apache installed locally?
A: Zend Studio uses a remote debugger, so you don't have to run a local webserver.

Q: When will PHP allow us to read/work with I/O devices and ports?
A: PHP at its lowest level is text in/text out, so doing this in Linux should not be a problem. PHP has COM support for Windows that could be used to interact with dlls. Also, you're always free to write your own PHP extension to add lower level functionality. Check out Sara Goleman's new book on writing extensions.

Q: The majority of web developers still use php4. How do they best consume web services or proprietary XML formats?
A: For those still in PHP4, you are limited to the old XML parsing functionality. Heavy XML wranglers should seriously consider upgrading to version 5. The programming interface is much more elegant and the performance boost with PHP5 is worth the upgrade. Porting legacy code to 5 is not as bad a task as it may sound.

Q: With the zend platform, is it saving all the POST/GET data in a log? How can that work in a CISC compliant environment?
A: Because one of the debugging goals of Zend Platform is to completely recreate the runtime environment of a script, organizations with special privacy requirements should take this fact into account. Zend Platform offers a highly configurable authentication system so that different people can have customized access levels to logged data.

Q: What about creating web services?
A: See the re-recorded webcast for an example of SoapServer and WSDL Generation.

Q: Any examples of _building_ a web service?
A: See above.

Q: what about linux debugging support? Does it work as well as with windows?
A: Zend Platform is available for both platforms, so you can run the debugger on Linux and debug with Zend Studio on Windows, or vice-versa.

Q: I have found that debugging can be slow or lock when it is done remotely - is there anything that can be done to speed this up?
A: Network latency can be an issue with remote debugging. Contact technical support for individual issues regarding debugging performance issues.

Q: Is there a Firefox 1.5 Zend toolbar?
A: Yes! http://www.zend.com/products/zend_studio/plug_ins

Q: Is there a source for rich web controls in PHP? Similar to the control suites available in the .NET world?
A: Zend has done some experimental prototyping with design-time components.

Q: Are your code examples available for download?
A: Keep an eye on the Zend Developer Zone for code tutorials.

Q: currently in zend studio you have to have a local wsdl file for the
ide to recognize your web service classes. Will there be any support in the future for loading remote wsdl files?
A: Correct. You need a local copy of the WSDL file to do code completion. Remote WSDL support for future versions has not been decided.

Q: Can you explain how Zend Platform "Code Acceleration", What it is? and How does it help the performance?
A: Zend Platform supports code acceleration through an opcode cache.
Normally, PHP parses the source file, compiles it to machine code, and executes it. While this is a swift process, the opcode cache stores the machine code in RAM so the parsing and compilation steps aren't necessary, leading up to a 300% performance increase in some cases.
Code acceleration is handed automatically, and RAM allocation for opcode caching is configurable.

Q: Any object relational mapping available in ZF?
A: Yes. Check out the Zend_DB module at http://framework.zend.com/manual/en/zend.db.html for OR mapping functionality.

Q: php is a good solution If I had an application that simultaneously wrote xml in the server with many users working simultaneously in real time? or is better develop the application in c++ or Perl and after read them with php?
A: This is more an issue of file access and locking than a PHP issue.
Write concurrency is certainly an issue that a developer has to tackle in any language. PHP's performance for file handling should not be a bottleneck in this case. If you are battling write blocking issues, it may be time for a different approach such as using a database.

Q: We downloaded a trial of the Zend IDE and it seemed to max out CPU usage and took a long time to load projects compared to other IDEs (like Dreamweaver). Is this normal?
A: Zend Studio runs on a Java virtual machine, so depending on your platform there will be CPU and RAM issues inherent of Java applications.

Q: If I want to have a drop down list of values from the XML web service, how do I set that up?
A: I'm assuming you are referring to code completion? It's a feature of the IDE that "just works." Zend Studio inspects the proxy object that PHP creates to provide code completion for SoapClient objects.

Q: please explain more how the wsdl file is generated.
A: Zend Studio provides a wizard interface to create WSDL files. You simply specify the appropriate service names, source files, and endpoint URLs and Studio creates a file for you.

Q: I find this xml->dom->SoapClient Wizzleness bizzare. I find it much less of a hassle loop a preg_match_all.
A: The nice thing about PHP5's XML handling is that you don't have to concern yourself with XML markup. The parsing ability of the library allows you to access and iterate XML hierarchies in an object-oriented interface. That being said, you are certainly free to write regex if you prefer.

Q: How do you install modules such as Smarty or PearDB into the Zend Studior?
A: Third-party libraries can be included in the IDE similar to the way include_path works on the server. In addition, Zend Studio will inspect your included libraries and provide code completion for them.

Q: what needs to happen for the remote methods to display? Does the
script need to run once, go through debug once?
A: Once you create a SoapClient object, the remote methods will be available in code completion. Remember, the WSDL file must be local.

Q: Have you ever run into the incompatibilities between the SoapClient
and the way that a .NET Soap server will return an aggregate object?
How do you deal with that problem?
A: About a year ago I succeeded in getting .NET and PHP to talk via SOAP, both using complex data types for input and output on both ends. There were several hacks involved, and I'd like to revisit the problem with PHP5. So while I'm not directly answering the question :) it can be done.

Q: Are you running the debugging software on localhost?
A: For the screencast, I was running Zend Platform on my local machine.
Normally you would run it on your production server and debug remotely.

Q: if the client is being called multiple times, does doing a new SoapClient everytime have any performance issue?
A: Network latency will normally be the bottleneck over object instantiation. You can reuse a client object to make multiple calls.

Q: Any benchmarks available comparing Java, .NET and PHP?
A: E-week did a benchmark article a couple weeks ago that concluded that PHP is enterprise-ready alongside of Java and .NET.

Q: In order to run the a wsdl server, do you run your php file from the
command line?
A: No. The script running on the webserver acts as the network endpoint. Instead of HTML output, it speaks in SOAP's XML format.

Q: the right syntax help for a webservice is only available with a
reference on a local wsdl. How does it work with an external file?
A: Currently you must save a local copy to get code completion.

Q: Should I use a content management system to upgrade my website or
stay with hand coding in html and php?
A: It depends on your requirements, coding ability, or access to programmers. This is more of a business question than a programming question.

Q: Where can we get support for Zend Framework? If we want to contribute to the project, how can we do it? Thanks.
A: Zend provides a support service that includes unlimited web-based support, continuous updates and hotfixes for Zend Core, which includes our reference implementation of PHP 5 and Zend Framework. If you would like to learn more about this service, please visit http://www.zend.com/products/zend_core/support.

If you are interested in learning more about Zend Framework, please visit http://framework.zend.com. There, you can learn about the different ways you can get involved and you can also sign up to join the Zend Framework mailing lists. The Zend Framework effort is comprised of and depends on contributions from a diversity of individual contributors and larger corporations. We are always looking for new contributors, so please don’t be shy!

Q: how far is the development of the Zend framework? Can it be used in a production environment?
Q: When do expect to release the first stable version of ZendFramework?
Q: is Zend Framework usable in a development environment?

A: The Zend Framework project was launched this past March. Currently, the Zend Framework Preview 0.1.5 release is available for download at http://framework.zend.com/download. Even though Zend Framework is still in an early preview stage, many companies and developers have downloaded Zend Framework for use in a development environment. We anticipate releasing a full 1.0 version sometime later this year. You can learn more about how we plan on evolving Zend Framework by visiting our roadmap at http://framework.zend.com/roadmap.

We’re just at the beginning of this journey – we will continue to collaborate with the PHP community on developing the best possible Framework that simplifies PHP and Web Services development. We will continue to increase native support for third-party Web Services APIs, increase support for XML databases, explore OO-RDBMS mapping, and continue to enhance our existing modules.

Q: Can you list some companies that are currently using ZF in production?
A: We don’t recommend Zend Framework for use in a production environment, unless you’re willing to tolerate changing APIs, although a few early adopters including us and php|Architect are using Zend Framework in a production environment.

Q: When do expect to release the first stable version of ZendFramework?

See Above.

A: What platform is Zend Platform available on?
Q: Zend Platform 2 is available for development and production on Linux x86 and x86-64, FreeBSD x86, MAC OS X on Power, and Solaris on Sparc and x86 platforms. Zend Platform for the Windows Platform is currently available for development purposes only.

Q: Can I use Zend Platform on Windows for production servers?
A: Currently, Zend Platform’s full feature set is not available for installation on production servers. You may still install Zend Platform for Windows on a production server as long as you specify during installation that you want to use the ‘Partial Support (Zend Studio Debug Support) option’. This option will configure the Zend Studio Debug component and will allow you to use the Zend Studio Server functionality only.

Q: What is the Zend Platform Developer’s License?
A: Zend Platform is now available with a free Developer License which permits the use of Zend Platform for application development. The Developer License does not limit the number of servers Zend Platform is installed on but it is server locked and limited to 1 year from the date acquired. To use Zend Platform in your development environment, you must download and install the Zend Platform trial and request a Developer License from within the product GUI using the ‘Manage License’ option.

Comments


Wednesday, July 19, 2006
GREAT
3:18PM PDT · vbabiy
Thursday, July 20, 2006
THE ONE-HOUR-AD
5:01PM PDT · lynweb
CORRECTING XFIRE URL
7:02PM PDT · kanok
Friday, July 21, 2006
XSMOKE...
12:51AM PDT · kucerar
WSDL GENERATOR
3:28AM PDT · beau6183
Thursday, February 22, 2007
XFIRE4PHP
6:33AM PST · lynweb