Yii Framework Forum: Soap Response Error - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Soap Response Error Rate Topic: -----

#1 User is offline   KiaPlayer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 16-February 11

Posted 15 February 2013 - 07:03 AM

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
0

#2 User is offline   KiaPlayer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 16-February 11

Posted 20 February 2013 - 01:10 AM

Problem was in controller file.
It has UTF-8 charset with BOM. After removing BOM it works fine.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users