Expand my Community achievements bar.

UTF-8

Avatar

Former Community Member
I don't know how to define charset="utf-8" on a soap message.<br /><br />I've read that the default value is ASCII encoding, and I would like UTF-8.<br />My soap message always starts with: <br /><?xml version="1.0"><br /><soap:Envelope .......<br /><br />And I need: <br /><?xml version="1.0" encoding="UTF-8"?><br /><br />Any idea?<br />Thanks!<br /><br />This is my function to create a soap connection:<br />function doWS(theURL, theHeader, theRequest, theAction){<br /> try {<br /> var oResponse = "";<br /> SOAP.wireDump = true;<br /><br /> var oService = SOAP.connect(theURL);<br /><br /> if (oService != "[object SOAPService]") {<br /> oResponse = "ERROR - No connection";<br /> }<br /> else {<br /> var processRequest = {<br /> soapType: "xsd:string", <br /> soapValue: theRequest<br /> };<br /> var mySOAPAction = theAction;<br /> var sendHeader = {<br /> soapType: "xsd:string",<br /> soapValue: theHeader<br /> };<br /> var responseHeader = {};<br /> oResponse = SOAP.request ({<br /> cURL: theURL,<br /> oRequest: processRequest,<br /> cAction: mySOAPAction,<br /> bEncoded: false,<br /> oReqHeader: sendHeader,<br /> oRespHeader: responseHeader,<br /> cResponseStyle: SOAPMessageStyle.XML<br /><br /> <br /> }); <br /> }<br /> return oResponse;<br /> oService = null;<br /> }<br /> catch(e) { }<br />}
3 Replies

Avatar

Former Community Member
I just created a simple echo web service and used Ethereal, the network packet sniffer, to see what was actually sent over the wire. For my echo request, this is the request that was generated:<br /><br />POST /echo.asmx HTTP/1.1<br />Accept: */*<br />Content-Type: text/xml; charset=utf-8<br />SOAPAction: "http://stevex.org/events/echo/EchoString"<br />Content-Length: 455<br />User-Agent: Mozilla/3.0 (compatible; Spider 1.0; Windows)<br />Host: www.ottawaevents.org<br />Connection: Keep-Alive<br />Cache-Control: no-cache<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><br /> <soap:Body><br /> <tns:EchoString xmlns:tns="http://stevex.org/events/echo"><br /> <tns:stringToEcho>hello</tns:stringToEcho><br /> </tns:EchoString><br /> </soap:Body><br /></soap:Envelope><br /><br />Notice that it did add the UTF-8 encoding.<br /><br />I tried including a parameter that contained characters that can't be expressed using ASCII and it was transmitted and came back fine.<br /><br />So I don't think it's a problem. Where did you read that the message is ASCII encoded?<br /><br />--<br />SteveX<br />Adobe Systems

Avatar

Former Community Member
I have the same issue, i use soap.wiredump = true to display de soap message in the debugger console and I it starts like he said:<br /><br /><?xml version="1.0"> <br /><soap:Envelope ....... <br /><br />without the UTF-8, so how are we certain that the message is sent with UTF encoding??<br /><br />And how do we indicate UTF-8 encoding??