WebService, presumably everyone is familiar with, is a way of providing service to the service caller by the "service provider". There are several key technologies:
XML: A standard way to describe data
SOAP: Simple Object Access protocol for information exchange
Wsdl:web Service Description Language
UDDI: Universal Description, Discovery, and integration, a platform-independent protocol for describing business on the Internet, based on an XML language.
Soap defaults to the UTF-8 encoding, which also determines that WebService is UTF-8 encoded by default.
The project that is now maintained is a PHP project with all the GBK, and the coding problem is encountered when invoking the WebService method provided by itself. The PHP page calls WebService, and this webservice calls another PHP class that calls COM components. That's probably what the scene is.
Copy Code code as follows:
PHP page (GBK)-> WebService (UTF-8)-> PHP class (GBK)
Everything was calm before we had a problem, and it took many years. One day, the company acquired other companies, in order to integrate services, user information is also integrated together, the original company all user accounts are composed of English characters alphanumeric figures, and the acquisition of the company did not do such a qualification, the account has the situation of Chinese characters. After the integration, the problem arose, "Error in msg parsing:xml error parsing SOAP payload on line 1:invalid character [detail]"!
PHP has just come in contact, not very well, and the debugging of NetBeans is often hard to complete. So just open vs, quote WebService, and start testing. Return the result, can not find the user, and is garbled, OK, looked at after, because WebService UTF-8 encoding to the PHP class, encoding inconsistent results! Convert to GBK again pass past, receive the data, find the user, but still garbled. After converting the returned data back to UTF-8, everything ok! VS under Test everything is OK! On the test machine! Start the test! After opening, garbled! is still "error in msg parsing:xml error parsing SOAP payload on line 1:invalid character [detail]" embarrassing!
Calm down and continue to analyze! It should be caused by the PHP page call 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 back to calm.
Copy Code code as follows:
Call: PHP page, parameter conversion to UTF-8-> WebService, convert to GBK-> PHP class
Return: PHP class-> Web Service, converted to UTF-8-> PHP page after receiving, convert to GBK