Which is better PHP SOAP or NuSOAP?

吃可爱长大的小学妹 提交于 2019-11-29 02:31:34

问题


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


回答1:


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.




回答2:


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.



回答3:


Using nusoap, no need to write the WSDL file




回答4:


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




回答5:


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);
}


来源:https://stackoverflow.com/questions/15402233/which-is-better-php-soap-or-nusoap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!