24

Which is better PHP SOAP or NuSOAP ? Please help me out ?

Abdul Vahaf
  • 350
  • 2
  • 3
  • 10
  • Can you provide more information ? PHP SOAP is available since PHP 5.0.1 . If you are in PHP4, you have to use NuSOAP. – Raptor Mar 14 '13 at 06:01
  • No I am using PHP 5.0.1 – Abdul Vahaf Mar 14 '13 at 06:22
  • If you going to consume WCF services, definitely use PHP SOAP, otherwise you might face lots of pitfalls. Probably they will fix it later, but for now thats headache(Problems with default collections in request, problems with complex types declared in different namespace, forcing single element arrays to be converted into objects) – Uriil Feb 21 '14 at 06:00
  • @Uriil i agree I switched from NuSoap to PHP Soap as I couldn't create Service Reference using WSDL generated by NuSoap – zachu Oct 27 '15 at 13:49

5 Answers5

32

PHP SOAP is available since PHP 5.0.1 . If you are in PHP4, you have to use NuSOAP.

Native PHP codes are usually better in performance & relatively bug free, so if PHP SOAP is available, use it. More, NuSOAP has not much documentation on their official website.

Raptor
  • 48,613
  • 43
  • 209
  • 344
  • 7
    this is an example, I think, of a really good question and answer pair (that could potentially be though of as too 'basic'). In reality, we all know the answer here, and we knew it before we decided to google it. But it's reassuring that now we know there isn't some amazingly special feature of the library that we're missing out on. Even if we may have checked this before. – lol May 08 '14 at 11:48
  • Somebody has tried the newest NuSOAP? https://sourceforge.net/projects/nusoapforphp53/ (the webpage says "The version at http://sourceforge.net/projects/nusoap/ is now up-to-date.") – Richard Rebeco Feb 14 '17 at 13:33
12

Although there is some nuance to mention, I think NuSoap is better:

  1. Nusoap has some predefined methods that in case of using Soap you should write some of your own.
  2. because SOAP performance bottleneck is server response time, there is no fear to use a predefined class Like Nusoap.
  3. Handling UTF-8 is a lot more easy in Nusoap.
  4. Nusoap offers some good functions to create a SOAP server.
Community
  • 1
  • 1
hpaknia
  • 2,223
  • 3
  • 28
  • 52
  • do you mean PHP SOAP does not support UTF-8 ? – Raptor Mar 14 '13 at 06:04
  • 4
    No It supports for sure. But I've challenged this problem for many days in php SOAP, While in NUSOAP its a configuration variable! For me it's like choosing between php mysql functions or adodb driver. I use adodb, again bottleneck is not the class itself. Mysql response time is more than all resources the class take from server. – hpaknia Mar 14 '13 at 06:09
  • 1
    I switched from NuSoap to PHP Soap as WSDL generated by NuSoap was incompatible with C# clients (.NET in particular) – zachu Oct 27 '15 at 13:47
5

Using nusoap, no need to write the WSDL file

Kiran Kadali
  • 59
  • 1
  • 1
4

Nusoap is no longer maintained. It is supported up to version 4.X of PHP. Newer versions can start giving problems

1

Another advantage of using Nusoap is that the result you get is already in an array. Normal PHP you get an object and you need to convert into an array yourself. and I did a small bench mark Nusoap is micro seconds faster than my own implementation including converting into an array. Nusoap = -1370852340.1761 Native PHP = -1370852340.2057

 public function objectToArray($obj) 
{
    if(!is_array($obj) && !is_object($obj)) 
    return $obj;

    if(is_object($obj)) 
    $obj = get_object_vars($obj);

    return array_map(array($this, 'objectToArray'), $obj);
}
kouwen
  • 113
  • 1
  • 1
  • 8