AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: Программирование
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.11.2015, 13:00   #4  
DeAmouSE is offline
DeAmouSE
Участник
 
2 / 11 (1) +
Регистрация: 16.10.2013
Ошибка может быть, из за того что кодировка при отправке становится 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).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Взаимодействие с Excel через .NET (семейство классов SysExcel) gl00mie DAX: Программирование 102 11.08.2022 17:09
Ошибка с подключением через ODBC + глюк с работой через connection Corel DAX: Программирование 8 17.05.2012 11:58
4.0SP2: Создание записи в ForecastSales через API Jab Straight DAX: Программирование 8 30.11.2007 11:39
Inside Dynamics AX 4.0: The AxInternalBase API Blog bot DAX Blogs 2 09.10.2007 00:48
Запуск программы из Аксапты через 2-хзвенку Migel_84 DAX: Программирование 25 27.04.2006 09:41

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 11:03.