![]() |
#4 |
Участник
|
Ошибка может быть, из за того что кодировка при отправке становится Win-1251, из-за этого xml на сервере кривится, и становится не правильный.
В интернете прочитал Что после open, можно попробовать использовать метод setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); А так можно даже попробовать через обычные HTTP GET/POST запросы сделать. Для GET нужно всего-то собрать такую строку msid=string&message=string&naming=string&login=string&password=string И сделать запрос: "http://www.mcommunicator.ru/m2m/m2m_...assword=string" Написал простой пример в ax2009 с использованием NET. X++: public static str GET(URL _url, boolean useProxy = false) { CLRObject clro = null; System.Net.HttpWebRequest httpRequest = null; System.Net.HttpWebResponse httpResponse = null; System.Reflection.TargetInvocationException error2; str response, errorText; System.Exception exseption ; System.IO.StreamReader sr; System.Net.WebHeaderCollection headersCollection; System.Net.HttpStatusCode httpStatusCode; System.IO.Stream stream; int i,y; System.Version httpVersion; int counter; container con; System.Net.WebProxy proxy; System.Net.NetworkCredential nc; System.Net.WebClient WebClient; System.Object clr; str userName; System.Text.RegularExpressions.Regex regex; System.Text.RegularExpressions.Match matches; int lenthMatch; ; try { new InteropPermission(InteropKind::ClrInterop).assert(); clro = System.Net.WebRequest::Create(_url); httpRequest = clro; httpRequest.set_Credentials( System.Net.CredentialCache::get_DefaultCredentials()); httpRequest.set_AllowAutoRedirect(true); nc = httpRequest.get_Credentials(); if(useProxy) { proxy = new System.Net.WebProxy( , ); proxy.set_Credentials(System.Net.CredentialCache::get_DefaultCredentials()); httpRequest.set_Proxy(proxy); proxy.get_Credentials(); } httpRequest.set_Method("GET"); httpVersion = new System.Version(1,0); httpRequest.set_ProtocolVersion(httpVersion); httpRequest.set_ContentType("application/x-www-form-urlencoded"); httpResponse = httpRequest.GetResponse(); sr = new System.IO.StreamReader(httpResponse.GetResponseStream()); headersCollection = httpResponse.get_Headers(); httpStatusCode = httpResponse.get_StatusCode(); response = sr.ReadToEnd(); sr.Close(); sr.Dispose(); CodeAccessPermission::revertAssert(); } catch(exception::CLRError) { CodeAccessPermission::revertAssert(); new InteropPermission(InteropKind::ClrInterop).assert(); error2 = ClrInterop::getLastException(); if (error2 != null) { exseption = error2.get_InnerException(); if (exseption != null) { errorText = exseption.get_Message(); CodeAccessPermission::revertAssert(); throw error(errorText); } } CodeAccessPermission::revertAssert(); } return response; } |
|
|
За это сообщение автора поблагодарили: Товарищ ♂uatr (1). |
|
|