Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2005, 06:52 AM
Registered User
 
Join Date: Jun 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending XML through Sockets (ASP)?

Hi,

I need to send XML-Document(Request) to another Webserver through sockets. I wrote the following script but I have a problem with encoding. I put <?xml version="1.0" encoding="ISO-8859-1"?> in my XML-Document and the receiver finally got <?xml version="1.0"?>. It seems that encoding has been ignored... Does anybody has an idea?

Thanks
Gilles

strServer = "xxx.xxx.xx.xx"
    Set SendDoc = server.createobject("Msxml2.DOMDocument")
    SendDoc.async="false"
    SendDoc.Load(Server.MapPath("/Bookings/XML/PriceRequest/test.xml"))

    Set socket = Server.CreateObject("Socket.TCP")
    Socket.Host = strServer + ":6100"
    Socket.Open
    Socket.timeout = 100000
    Socket.SendLine(SendDoc.XML)
    Socket.SendText(chr(0))

    Socket.WaitForDisconnect()

    Set NewDoc = server.createobject("Msxml2.DOMDocument")
    newDoc.async="false"
    newDoc.LoadXML(Socket.Buffer)

    ' Save XML-File back to BookingResponse
    newDoc.save(Server.MapPath("/Bookings/XML/BookingFile/test.xml"))

 
Old June 27th, 2005, 11:02 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The XML property of a domdocument is a utf-16 string. You will have to pass and receive a different way if you need to keep the encoding. Does Socket.TCP have any other way of receiving the data to send?

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
sending xml parameswaranvv XML 1 September 23rd, 2008 01:41 PM
Sending XML via http post, using servlet kermitus Servlets 1 March 14th, 2006 07:03 PM
Error in Sending XMl file to Server r_arvindk2000 XML 0 April 8th, 2005 01:52 PM
Error in sending XML file to server r_arvindk2000 XML 0 April 8th, 2005 01:49 PM
XML, Sockets, Streams and a headache owain General .NET 4 September 8th, 2004 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.