php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69515 Error on Zend SOAP (sorry if duplicated)
Submitted: 2015-04-23 14:54 UTC Modified: 2015-04-23 18:12 UTC
From: jorgeley at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.5Git-2015-04-23 (snap) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jorgeley at gmail dot com
New email:
PHP Version: OS:

 

 [2015-04-23 14:54 UTC] jorgeley at gmail dot com
Description:
------------
(sorry if duplicated)
Got an error when my SOAP class client return special characters.
When my data on database has no special chars everything is fine, but if I have some special chars "ç, ~" the bug happens.

Test script:
---------------
<?php
//WebserviceController.php
namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController,
    Zend\View\Model\ViewModel,
    Zend\Soap\Client as SoapClient;

class WebserviceController extends AbstractActionController{
    private static $SERVIDOR = "192.168.1.103:8888"; //my server
    private $_WSDL_URI = "http://192.168.1.103:8888/WEB/GPA/public/webservice";
    
    public function autenticaAction(){
            $cliente = new SoapClient($this->_WSDL_URI.'/wsdl');
            $usuario = $cliente->autentica("jorgeley","123"); //my credentials on database
            return = new ViewModel(array('autentica' => $usuario));
    }

//my WSDL
   public function WsdlAction() {
        $wsdl = new AutoDiscover();
        $wsdl->setClass('\Application\Webservices\gpa')
            ->setUri($this->_WSDL_URI.'/soap');
        $wsdl->handle();
   }

//my SOAP
   public function soapAction(){
        $soap = new Soap(null, array('uri' => $this->_WSDL_URI."/wsdl", 'encoding' => 'UTF-8'));
        $soap->setClass('\Application\Webservices\gpa');
        $soap->handle();
    }
?>

<?php
//gpa.php
namespace Application\webservices;
use MyClasses\Conn\Conn,
    DoctrineModule\Authentication\Adapter\ObjectRepository,
    Zend\Authentication\AuthenticationService;

class gpa{
    public function autentica(string $login, string $senha){
        $adapter = new ObjectRepository();
        $auth = new AuthenticationService();
        $adapter->setOptions(array(
                                'object_manager' => Conn::getConn(), //my EntityManager
                                'identity_class' => 'MyClasses\Entities\AclUsuario',
                                'identity_property' => 'login',
                                'credential_property' => 'senha'
                                )
                            );
        $adapter->setIdentityValue($login);
        $adapter->setCredentialValue(sha1($senha));
        $resultado = $auth->authenticate($adapter);
        if ($resultado->isValid()){
            return array($resultado->getIdentity()->getId(), $resultado->getIdentity()->getNome());
        }else
            return array(0=>"login invalido");
    }
}
?>

Actual result:
--------------
An error occurred during execution; please try again later.
Informação adicional:
SoapFault

Arquivo:

    /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/Soap/Client.php:1118

Mensagem:

    SOAP-ERROR: Encoding: string 'adm \xe7...' is not a valid utf-8 string

Pilha de execução:

    #0 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/Soap/Client.php(1118): SoapClient->__soapCall('autentica', Array, NULL, NULL, Array)
    #1 /mnt/sda3/PROJETOS/WEB/GPA/module/Application/src/Application/Controller/WebserviceController.php(62): Zend\Soap\Client->__call('autentica', Array)
    #2 /mnt/sda3/PROJETOS/WEB/GPA/module/Application/src/Application/Controller/WebserviceController.php(62): Zend\Soap\Client->autentica('jorgeley', '123')
    #3 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83): Application\Controller\WebserviceController->autenticaAction()
    #4 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
    #5 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
    #6 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #7 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(116): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #8 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(113): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
    #9 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
    #10 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
    #11 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #12 /mnt/sda3/PROJETOS/WEB/GPA/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(313): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #13 /mnt/sda3/PROJETOS/WEB/GPA/public/index.php(17): Zend\Mvc\Application->run()
    #14 {main}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-23 16:40 UTC] jorgeley at gmail dot com
I dont know if this is the correct way to solve, but i did this:
return array($resultado->getIdentity()->getId(), mb_convert_encoding($resultado->getIdentity()->getNome(),'UTF-8'));

It's working.
Any Suggestions???
 [2015-04-23 18:12 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2015-04-23 18:12 UTC] cmb@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Quick hint: fix the service's output.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC