powered by simpleCommunicator - 2.0.59     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Soap and Dime attachment
1 сообщений из 1, страница 1 из 1
Soap and Dime attachment
    #36472543
Фотография bbbdum
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Привет всем
возникла небольшая проблема, есть клиент , который шлет запрос к вебсервису с прикрепленным файлом как Dime attachment,

примерный код ниже

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
 static void WriteToDime(byte[] att, Stream dimeStr, string mediaType)
        {

            DimeWriter dw = new DimeWriter(dimeStr);


            Guid guid = Guid.NewGuid();
            string id = string.Format("uuid:{0}", guid.ToString());


            DimeRecord rec = dw.NewRecord(id, mediaType, TypeFormatEnum.MediaType, - 1 );
            rec.ChunkSize =  4096 ;

            BinaryWriter myWriter = new BinaryWriter(rec.BodyStream);
            myWriter.Write(att,  0 , att.Length);

            dw.Close();

        }


        string dir = Directory.GetCurrentDirectory();




        private WebResponse MakeCall(string act, byte[] header, byte[] body)
        {
            var url = "***";

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.Method = "POST";

            request.ContentType = "text/xml";

            request.ContentLength = header.Length + body.Length;

            request.Headers.Add("SOAPAction: " + act);

            request.Timeout =  30000 ;

            #region Send The Request

            try
            {
                //Set the request Stream
                var str = request.GetRequestStream();

                str.Write(header,  0 , header.Length);
               
                str.Write(body,  0 , body.Length);

                str.Close();

                //request.
                WebResponse WebResp = request.GetResponse();

                return WebResp;


            }
            catch (WebException ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
            #endregion


        }


если закоментировать
// str.Write(body, 0, body.Length);
то я могу получить ответ от вебсервиса, но как только добавляю к запросу Dime attachment str.Write(body, 0, body.Length) , получаю ошибку 500 от вебсервиса
как правльно добавить этот attach ?
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Soap and Dime attachment
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]