View Single Post
04-13-2013, 02:37 AM
Sketch is offline Sketch
Sketch's Avatar
Status: Member
Join date: Aug 2005
Location: Melbourne, Australia
Posts: 419
iTrader: 0 / 0%

Sketch is on a distinguished road

  Old  NuSoap - Return UTF-16

I've got a problem with a NuSoap server I'm trying to setup;


$server = new soap_server();
$server->configureWSDL('SoapService', $namespace);
$server->wsdl->schemaTargetNamespace = $namespace;
$server->soap_defencoding = 'UTF-8';

    array('GetServiceInfoResult' => 'xsd:string'),
    'Read service properties.'


function getServiceInfo() {
    $oDom = new DOMDocument();

    $oElement = $oDom->createElement('SampleResponse', 'HelloWorld');


    $response = $oDom->saveXML();

    return $response;

The call to the service works fine - however I cannot return a UTF-16 Encoded XML document. As per the specification I'm working to it's required to be UTF-16.

If I change the DOM Encoding to UTF-8 it's happy days and Fiddler (Network sniffer) shows the correct response. But UTF-16 and I get this;

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC=""><SOAP-ENV:Body><ns1:GetServiceInfoResponse xmlns:ns1=""><GetServiceInfoResult xsi:type="xsd:string">&lt;
Where &lt; is my UTF-16 string.

I'm sure there is a setting in NuSoap I'm needing to change to get this working but I can't find out where it is?