Dobry den, nepodarilo se mi ve VB6 dosahnout posilani XML(kodovani utf-8) souboru pomoci http, tak, aby jej adresat precetl (jedna se o azbuku). Proto jsem se rozhodl pro VB.NET, kde lze urcovat kodovani posilaneho retezce, ale server mi pise chybu 500: VB6 funkcni(az na citelnost na adresatove strane): Dim o As New xmlHttp xmlContent() = fs.GetFileContent(Replace(Me.txtOutputFileName.Text, fs.GetFileNameByPath(Me.txtOutputFileName.Text), "") & xmlFileNames(i)) xmlString = MFunctions.GetString(xmlContent()) o.Open "POST", server, False, EE_XML_EXCHANGE_ID, EE_XML_EXCHANGE_PWD o.setRequestHeader "Content-Type", "text/xml" ' "text/xml;charset=utf-8" o.setRequestHeader "SOAPAction", "" o.send xmlString Me.txtResponseHeaders = o.getAllResponseHeaders Me.txtResponse = o.responseText VB.NET 2010 Express (chyba 500 - internal server error): Dim xdoc As XDocument = XDocument.Load("z:\Operations\RU\_TEST\xml\send\RUWP121001_01_05_01.xml") Dim request As WebRequest = WebRequest.Create("http://217.159.234.77:8080/epmx/services...") request.Method = "POST" Dim postData As String = xdoc.ToString Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData) request.ContentType = "text/xml" request.ContentLength = byteArray.Length request.Credentials = New System.Net.NetworkCredential(EE_XML_EXCHANGE_ID, EE_XML_EXCHANGE_PWD) Dim dataStream As Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = request.GetResponse() Console.WriteLine(CType(response, HttpWebResponse).StatusDescription) dataStream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() Console.WriteLine(responseFromServer) reader.Close() dataStream.Close() response.Close() Predem diky za kazdou radu
|