SOAP ERROR - Encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,


I created a simple wsdl web service. Everything works fine, but when I fill
the fields with accents and send the soap request, the PHP returns me an
error:


*Fatal error*: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding:
string 'ol\xe1...' is not a valid utf-8 string in PATH\cilent.php 16 Stack
trace: #0 [internal function]: SoapClient->__call('Send', Array) #1
PATH\cilent.php(16): SoapClient->Send(Array) #2 {main} thrown in *
PATH\cilent.php* on line *16*


I tested this same request using the eclipse web service explorer(It's a
java client web service inside the eclipse IDE) and the response was ok.


I found few topics about this issue on the google. One related solution to
this problem is use the utf8_encode() function. I tried add this function
before to send the soap request but didnt worked.


I think that this problem is in the PHP soap client because using the
eclipse web service explorer it works fine.


Here is my php soap client:


$client = new SoapClient('http://app/webservice.wsdl');
$return = $client->Send(array('token' => '123123', 'message' => array(
'text' => 'This is a string with special characters á é í ó ú', 'dest' =>
'John', 'sender' => 'Augusto')));

As I said I tried to use the utf8_encode() here:

$return = $client->Send(array('token' => '123123', 'message' => array(
'text' => utf8_encode('This is a string with special characters á é í ó ú'),
'dest' => 'John', 'sender' => 'Augusto')));

But the problem still.

I tried also add the propertie defencoding in the soap server:

$server->soap_defencoding = 'UTF-8';

But still not working.


What I'm missing?



Thanks



Augusto Morais

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux