NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
NuSoap And Utf-8 - A Problem


Joined: 16 Jun 2009
Posts: 1
Reply with quote
I am using the NuSoap library to build a webservice. I send a single chinese character to the service. All that the webservice does is turn around and return the character back. Instead of sending back the chinese character, it is replying with a question mark (?) in the soap envelope. I've looked at the soap packets being sent back and forth with WireShark. Checked out the messages in hex to look at it on the byte level. I can't figure out what is going on.

Does NuSoap handle utf-8 correctly? Do I need to set some setting in PHP, NuSoap or in the soap envelopes? I've tried everything I can think of, searched all over the internet and can't solve this.

Other important information:
-I pull chinese characters out of a MySql database and return them through a different function in my webservice, and this works correctly
-I tried using both the 1.81 and the 1.114 builds of NuSoap without any luck.
-When pass a non-unicode character to the webservice, say the letter "f", it return the letter "f" correctly.

I am enclosing the php of my webservice, as well as the SOAP request and response (in ascii ) and the crucial character(s) in hex. Also including the headers etc. I am using with Fiddler2 to test my webservice.

Thanks in advance, any help appreciated!
Michael


The Webservice
---------------------
$server->register(
'test_nusoap',
array('singlecharacter'=>'xsd:string'),
array('return'=>'xsd:string'),
$NAMESPACE);

function test_nusoap($singlecharacter){
return $singlecharacter;
}


The Request
-------------------
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:test_nusoap xmlns:m="http://myserver/Ubelix">
<singlecharacter xsi:type="xsd:string">四</singlecharacter>
</m:test_nusoap>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The Response
----------------------
<?xml version="1.0" encoding="ISO-8859-1"?><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:test_nusoapResponse xmlns:ns1="http://myserver/Ubelix"><return xsi:type="xsd:string">?</return></ns1:test_nusoapResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

The Request + Headers In Fiddler2
-------------------------------------------

POST http://localhost/plugin/mywebservice.php HTTP/1.1

Host: localhost
User-Agent: /n software IPWorks HTTP/S Component - nsoftware
Connection: close
SOAPAction: http://myserver/Ubelix#test_nusoap
Content-Type: text/xml; charset=utf-8
Content-Length: 374

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:test_nusoap xmlns:m="http://myserver/Ubelix">
<singlecharacter xsi:type="xsd:string">四</singlecharacter>
</m:test_nusoap>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The Chinese Character I Send (in Hex)
--------------------------
E5 9B 9B

The Incorrect Character (in Hex) that comes back
-------------------
3F

If you want to see the whole hex of the request and response, let me know. I can send a screen shot as I can't figure out yet how to dump the complete hex directly out of Fiddler.
View user's profileFind all posts by aravenwoodSend private message
NuSoap And Utf-8 - A Problem
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic