Which tools to build a SOAP server in PHP?
We are investigating options to build a SOAP webservice in PHP. We have some requirements:
- Authentication via SOAP Headers
- HTTPS
- Fine control over XML used in SOAP response
- Good documentation and support community.
- (Optional) WS Security support
There's the following tools providing such functionality:
- Native PHP SoapServer
- Zend_Soap
- NuSoap
- WSO2 WSF/PHP
- PEAR::SOAP
Zend_Soap is actually a framework-compatible wrapper for the native PHP Soap-implementation. We h开发者_高级运维ave some simple tests running, but SOAP headers are not supported, and we don't have full control over the XML response. For instance, the response XML has a namespace on the root element, but not on it's child elements. Pretty annoying.
NuSoap is not really maintained anymore and I have read it has some issues with PHP 5.3 naming conventions.
WSO2 WSF/PHP uses a php extension which has to be compiled manually. There are some dependencies and the entire compile process is not clearly documented. The documentation is scattered around the website (sometimes outdated) and in the packaged downloads. A linux binary is mentioned, but nowhere provided for download (at least not in the last 5/6 releases).
I don't really know a lot about PEAR::SOAP, but I have some experience with PEAR classes. Usually they are not well-documented and do not catch errors gracefully, leaving you googling every error message, with varying outcomes.
Do you know of any other tools that can help me build a full-fledged SOAP server in PHP, considering our requirements?
If you need WS-Security, then WSO2 might be your only option. Did you install all the prerequisite packages (openssl, libxml2) before compiling. Compilation is simple with ./configure, make && make install (I didn't have any issues with 2.1.0 wrt. compiling). WSO2 offers full control of the payload XML structure.
If you can live without WS-Security, then any of the other options are good. I'd recommend PHP's own SOAP library. It's pretty decent, but doesn't offer very good control over the XML and lacks WSDL autogeneration.
I do not know any other. I used in the past always PEAR SOAP, but unfortunately it seems it is not maintained anymore. There you do not need a documentation, it is pretty easy to use.
But I would go the Zend-SOAP way if I had to build another SOAP client/server, because all others are not up-to-date.
精彩评论