Anonymous - 2012-02-16


We have a service to connect to another service that it response and XML into ISO-8859-1, but we need response to our customer like a UTF-8 content-type, I paste a part of the code from de WS, and mistake that appear into the client.

         $clientALZ = new nusoap_client($PathWSDL, 'wsdl');
         $clientALZ->URL = $URLConnect;
         $err = $clientALZ->getError();
           $OKGrabar = GrabarXML("Certificado: Constructor error \r\nError: $err \r\nXMLDialog FIN \r\n" , '\\XMLDialog');
           return new soapval('return',
                                           '<Error><type>Constructor error</type><err>' . $err . '</err></Error>' );
         $result = $clientALZ->call("$FunctionConnect",

          /* put result 3 like example to test the answer to the client */                          
         $result3 = '<?xml version="1.0" encoding="UTF-8"?>';
         $result3 .= "<DataVehiclesResponse>";
         $result3 .= "<ReturnCode>0</ReturnCode>";
         $result3 .= "<ReturnText/>";
         $result3 .= "<ReturnPgr>DataVehiclesService</ReturnPgr>";
         $result3 .= "<ManufacturerContainer>";
         $result3 .= "<Manufacturer>ABARTH</Manufacturer>";
         $result3 .= "<Manufacturer>ACE</Manufacturer>";
         $result3 .= "<Manufacturer>ACM</Manufacturer>";
         $result3 .= "<Manufacturer>ADRIA</Manufacturer>";
         $result3 .= "</ManufacturerContainer>";
         $result3 .= "</DataVehiclesResponse>";
         header('Content-Type: text/html; charset=utf-8');
         $result3 = iconv('ISO-8859-1', 'UTF-8', $result3);

return new soapval('return',
                                implode(" ",utf8_encode($result3) ) );

Into the client appear this mistake:

The content type text/xml; charset=ISO-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 457 bytes of the response were: '<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC=""><SOAP-ENV:Body><ns1:getAlz2Response xmlns:ns1=""><return/></ns1:getAlz2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>'.

How We can send a full UTF-8 SOAP-ENV?