WebService, presumably everyone is familiar with, is a way that the service provider provides services to the service callers. There are several key technologies in it:
XML: A standard way to describe data
SOAP: Simple Object Access protocol for information exchange
Wsdl:web Service Description Language
UDDI: General description, Discovery, and integration, a platform-independent, XML-based protocol for describing commerce on the Internet.
SOAP is transmitted by default UTF-8 encoding, which also determines that WebService is UTF-8 encoded by default.
The project that is currently being maintained is a PHP project, which is full of GBK, and will encounter coding problems when invoking the WebService method provided by itself. The PHP page calls WebService, and this webservice calls another PHP class that calls the COM component. This is probably the scenario.
Copy CodeThe code is as follows:
PHP page (GBK), WebService (UTF-8), PHP class (GBK)
Everything was calm before the problem was met, and it took many years. One day, the company acquired other companies, in order to integrate services, user information is also integrated, the original company all users of the account is composed of English characters multibyte numbers, and the acquisition of the company did not do such a qualification, the account has the Chinese character situation. After the integration, the problem arose, "Error in msg parsing:xml error parsing SOAP payload on line 1:invalid character [detail]"!
PHP is not very familiar with the recent contact, and NetBeans debug ash is often not good. So just open vs, quote WebService, and start testing. The results returned, can not find the user, and is garbled, OK, after looking at a bit, due to the WebService UTF-8 encoding to PHP class, the code inconsistency caused! Convert to GBK to pass the past, after receiving the data, to find the user, but still garbled. After converting the returned data to UTF-8 again, everything ok! VS under Test everything is OK! On the test machine! Start testing! After opening, garbled! Still is "error in msg parsing:xml error parsing SOAP payload on line 1:invalid character [detail]" embarrassed!
Calm down, continue to analyze! This should be the result of the PHP page calling WebService! vs the test page below is UTF-8, there is no problem between them, but this page of PHP is GBK. Once again, everything was calm again.
Copy CodeThe code is as follows:
Call: PHP page, convert parameter to UTF-8-WebService, convert to GBK, PHP class
Back to: PHP Class-WebService, after receipt conversion to UTF-8 PHP page, converted to GBK
http://www.bkjia.com/PHPjc/321952.html www.bkjia.com true http://www.bkjia.com/PHPjc/321952.html techarticle WebService, presumably everyone is familiar with, is a way that the service provider provides services to the service callers. There are several key technologies: XML: A standard for describing data ...