View Single Post
04-13-2013, 02:37 AM
#1
Sketch is offline Sketch
Sketch's Avatar
Status: Member
Join date: Aug 2005
Location: Melbourne, Australia
Expertise:
Software:
 
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;

Code:
require_once('nusoap.php');

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

$server->register('GetServiceInfo',
    array(),
    array('GetServiceInfoResult' => 'xsd:string'),
    'http://schemas.microsoft.com/office/Outlook/2006/OMS',
    'http://schemas.microsoft.com/office/Outlook/2006/OMS/GetServiceInfo',
    '',
    '',
    'Read service properties.'
);

//

function getServiceInfo() {
    $oDom = new DOMDocument();
    $oDom->encoding='UTF-16';

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

    $oDom->appendChild($oElement);

    $response = $oDom->saveXML();

    return $response;
}

$server->service($HTTP_RAW_POST_DATA);
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;

Code:
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:GetServiceInfoResponse xmlns:ns1="http://schemas.microsoft.com/office/Outlook/2006/OMS"><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?