![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - encoding="utf-8" gets suppressed on http post >Thread Next - Re: encoding="utf-8" gets suppressed on http post Re: encoding="utf-8" gets suppressed on http postTo: NULL Date: 8/10/2007 12:36:00 PM
<jvanderhulst@v...> wrote in message
news:1186735503.829412.75320@x......
> On a windows 2000 machine, we use Biztalk 2002 to transport XML
> messages.
>
> One of the machines that it is communicating with, is a SAP R/3
> platform. We want to use the native HTTP capability that it has, but
> that requires XML to be encoded with UTF8 and also to have that
> explicit in the XML header so it must be: <?xml version="1.0"
> encoding="UTF-8"?>
>
> Now I have tried different alternatives, but every time I had
> something that should be a working solution the encoding="UTF-8" was
> suppressed from the actual message.
>
> In the mean time I have shifted to programming it out in ASP using
> xmlHttp.send.
>
> I tried to use transform node with an XSL that explictly adds the
> desired encoding or hard inserting the text string in front of the XML
> message. I could see the mechanisms themselves working correctly with
> adding something else than UTF-8.
> But when the actual message was posted encoding of UTF-8 was
> suppressed (left out).
It's a pity you left it out cos that the most likely place things are going
wrong.
>
> I also tried this before the actual sending:
> xmlhttp.setRequestHeader "Content-Type", "text/xml"
> xmlhttp.setRequestHeader "charset", "utf-8"
Charset isn't a header, its an attribute on the content type header. Like
this:-
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
however it isn't necessary.
>
> but then received an internal error:
> Error Type:
> msxml3.dll (0x80004005)
> Unspecified error
> /SAPReceiveIDOC/Repost_to_SAP.asp, line 18
>
>
> Browser Type:
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
> 1.0.3705; .NET CLR 1.1.4322)
>
> Page:
> POST 58 bytes to /SAPReceiveIDOC/Repost_to_SAP.asp
>
> POST Data:
>
> Microsoft VBScript runtime error '800a000d'
> ----------------------
> How can I get that utf-8 on the actual posted XML message to SAP ?
>
You should build your XML in a DOMDocument then pass the DOM object to the
send method of the xmlhttp object:-
Example:-
Dim oDOM : Set oDOM = Server.CreateObject("MSXML2.DOMDocument.3.0")
Dim oXMLHttp : Set oXMLHttp =
Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
oDOM.appendChild oDOM.createProcessingInstruction("xml", "version=""1.0""
encoding=""UTF-8""")
oDOM.appendChild oDOM.createElement("root")
oXMLHttp.open "POST", "http://server/page.asp", false
oXMLHttp.send oDOM
By posting the DOM the xmlhttp object will add the correct content type
header for you.
--
Anthony Jones - MVP ASP/ASP.NET
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
