I'm using Zend Soap Server with autodiscover, this is my code:
$wsdl = new Zend_Soap_Autodiscover();
$wsdl->setClass('SoapParser');
if (isset($_GET['wsdl'])) {
$wsdl->handle();
} else {
$server = new Zend_Soap_Server('http://zzz.zz.zz/store.php?wsdl');
$server->setClass('SoapParser');
$server->setEncoding('UTF-8');
$server->setObject(new SoapParser());
$server->handle();
}
When I invoke some methods through a SOAP client, I receive this error:
SOAP-ENV:ServerSOAP-ERROR: Encoding: string '00127920110531 xxx zzz Dom 67 开发者_JAVA百科av Ren\xe9...' is not a valid utf-8 string
the "\xe9" is a "é"... source table is in UTF-8
if I change
$server->setEncoding('UTF-8');
in
$server->setEncoding('ISO-8859-1')
i don't receive the error but the strings aren't correctly parsed, there are stranges chars...
Any idea?
This is not a problem with your server, this is a problem with your client.
Your client is submitting an ISO-8859-1
string, you may try to utf8_encode()
the data prior to submitting it.
If you still see weird chars when both the client and the server use the same encoding, then you might have a source string mixing several encodings. Is it built from a single source? Is it being displayed correctly somewhere?
精彩评论