简体   繁体   中英

SOAP UTF-8 encoding

I have a strange problem. In PHP I want to communicate to a Web Service with SOAP.

$soapURL = "http://www.somedomain.com/xyz.asmx?WSDL";
$soapParameters = Array('login' => "123", 'password' => "pwd", 'soap_version' => SOAP_1_2, 'exceptions' => True) ;
$client = new SoapClient($soapURL, $soapParameters);

With XAMPP it works locally without problems.

When I try it on my web server, I get the following error message:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.somedomain.com/xyz.asmx?WSDL' : Input is not proper UTF-8, indicate encoding ! Bytes: 0xFC 0x6C 0x74 0x69 in ...

The error raises at the last line of my code example.

Any Ideas?

  • mb_detect_encoding($soapURL); says the String is of format ASCII
  • I tried to convert every string to UTF-8 with utf8_encode , iconv and mb_convert_encoding...
  • first line of php file is: header('Content-type: text/html; charset=utf-8');

I finally solved it. The problem was the communication from Windows server and Linux client. I don't know why it works on some Linux machines, but never mind.

I added a local wsdl file at the source and use that for the SOAPClient. For the server I used the __setLocation function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM