Why use NuSOAP rather than PHP SOAP? Any benefits? - php

As far as I have scourged the web, I can see an abundance of articles on how to setup NuSOAP and use it to setup a SOAP server and client in PHP.
However, none of them seem to point to any advantages of using it than PHP's own native SOAP library. What are the pros/cons between:
NuSOAP
PHP
SOAP
PEAR::SOAP
Zend SOAP

NuSOAP generates WSDL.
PHP's SoapServer does not.
That is why I decided to use NuSOAP.
For client, I use native client, it has better error reporting.

PHP's SoapClient class requires PHP5 or above. Nusoap and Pear Soap run on PHP4. That's the main difference. At last check NuSoap wasn't officially compatible with PHP5. I had to find a port someone put on google code in order to run it under php5.
That's pretty much it. Although I have run into random weird WSDL parsing issues when using PHP's SoapClient as opposed to NuSoap. Most notably netenberg.com's licensing API. But basically if you are running PHP5, you'll probably just want to use PHP's SoapClient and save yourself the hassle of using an external library

Related

BeSimple Soap Library

Does anyone have experience using the "BeSimple Soap Library"?
I'm looking for a php client to consume a ws-* soap service - and I have yet to find one. I am wondering if this will work for all ws-* features. There's very little by means of documentation.
It works with some of the WS-Security and WS-SecurityPolicy which is just tricky to do with the stock SoapClient class. Also it supports better determined namespacing, which is also problematic with some broken SOAP servers.
nuSoap and ZF2 SoapClient are ok, but BeSimple is more flexible in architectural PoV.
The usual SOAP client in PHP would be the SoapClient class. See documentation. It works reasonably well, but is also not documentat that well.
Another alternative would be NuSoap.

Using Fixed WSDL file with PHP SOAP

I' developing a Soap Server using php nusoap library, however , I don't need to use dynamic generated WSDL file feature that's generated by nusoap, I just want to tell nuSoap to use the Fixed WSDL file that's written manully by an another team.
What do you suggest ?
My suggestion - give up. I'm not entirely sure that you can do what you want.
As you know, NuSOAP creates the WSDL on the fly only from the functions that you specify and then returns the resultant WSDL when requested.
If you could use an external fixed WSDL, what would happen if it is changed later on without your knowledge? A call to a SOAP method which is not handled by one of your functions could provide unknown results and would need to be handled by the calling machine in a nice, non-customer impacting way. Conversely, if you provide a new functionality but the other team won't adjust the WSDL for you, what do you do? Try and shoe-horn it into some other function?
Trying to match your functions to a pre-defined WSDL without errors would far out-strip any benefit you could get.
Stick with the "on-the-fly" generation for consistency and lack of headaches. Use the pre-generated WSDL as a reference but don't bother investigating whether you can use it
Also, I agree with #chrfin. If they are available on your server, consider using the native PHP SOAP functions - they are noticeably faster than NuSOAP as they are compiled rather than interpreted. The only reason I used NuSOAP in the first place was that (about 5 years ago) the native SOAP had problems communicating with a provider I needed (incorrect variable types etc). Now though, I will be re-factoring all of my code to native PHP SOAP

Features of PHP SOAP

I am wondering the features that are fully supported within PHP Soap, I have tried researching this, but there is very little documentation to support PHP Soap.
Also how is Soap used during the exchange of data through client machine to web service then server.
I know this is fairly vague, but as I am constantly being asked this myself I thought it was better to find more about it.
PHP has some build in SOAP classes for both client and server. Docs is on here.
But you have to be sure that your PHP build is compilled with SOAP support.
"The features that are fully supported within PHP" are pretty much non-existent.
Built in SOAP client is ok only for basic services. It doesn't support any WS extensions, so you have to add support manually, e.g. including headers for WS-Security.
Also, there are some problems with namespace handling and creating requests.
If you'll be using it and are having trouble with missing parameters or badly formatted requests, you'll probably want to modify requests - this can be done by extending SoapClient class and overriding doRequest function.

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 have 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.

Advantages of nuSOAP WebService?

I've been writing a demo web service in PHP using nuSOAP.
I wanted to know what is the advantage of nuSOAP to SOAP PHP5 class.
Also, this is a test web service to use as a model.
I was wondering which were the typical scenarios (general to Webservices, not just PHP) I should test out e.g. providing a web method that returns an object from the server returning a list of items.
The only advantage IMO is that it is a set of PHP classes and No PHP extensions are required.
So, if your webhost uses an older version of PHP or does NOT have SoapClient extension installed, you can use this.
To test the webservice, there is an awesome tool: soapUI.
I could tell one .
Nusoap could provide wsdl uri.
e.g.
https://www.domain.com/nusoap?wsdl

Categories