Soap Response Error

Can anyone help me with my problem?

I’m trying to get data from my web service and sometimes server responses with invalid XML.

I’ve noticed that it depends on data size. When response reach a certain size it ends with </SOAP-ENV:Envelop instead of </SOAP-ENV:Envelope>.

Here is my example code: client and server in one controller.

Method "success" works fine, but similiar method "fail" does not.

Even more: for nginx and php-fpm "success" method fails too (for apache with php_mod "success" method works).




<?php


class SoapController extends CController

{

    public function actions()

    {

        return array('wsdl' => array('class' => 'CWebServiceAction'));

    }


    private function getData($size)

    {

        return array_fill(0, $size, '18ad96e6-5526-11e0-9c19-00248c654095');

    }


    /**

     * @return array

     * @soap

     */

    public function success()

    {

        return $this->getData(104);

    }


    /**

     * @return array

     * @soap

     */

    public function fail()

    {

        return $this->getData(105);

    }


    public function actionTest()

    {

        $client = new SoapClient($this->createAbsoluteUrl('wsdl'), array('trace' => true));


        $methods = array('success', 'fail');


        foreach ($methods as $method) {


            try {

                $result = call_user_func(array($client, $method));

                $result = count($result);

            } catch (SoapFault $ex) {

                $result = $ex->getMessage();

            }


            echo $method . ' result: ' . $result . '<br>';

            echo $method . ' response: <br>' . htmlspecialchars($client->__getLastResponse()) . '<br><br>';

        }

    }

}



Software versions:

Ubuntu Server 12.10

Yii 1.1.13

PHP 5.4.6

Apache 2.2.22

Nginx 1.2.1

Problem was in controller file.

It has UTF-8 charset with BOM. After removing BOM it works fine.