귀하는 손님 이십니다
로그인
회원가입
  
  델마당 공식 은행계좌
  하나은행 227-910235-83607
  예금주 이상국(운영진)
프로젝트 게시판
투표게시판
델마당소개
기초부터 활용까지! 델파이 교육 - 데브기어
吏덈Ц怨 떟蹂 吏덈Ц怨 떟蹂 입니다.
글내용 - 吏덈Ц怨 떟蹂
 [吏덈Ц] indy http post 臾몄쓽
李몄깉
(源吏꾩슧)
2020-07-21 삤썑 8:42:44
175회 조회


첨부파일 다운로드
idhttp샇異.JPG

1. 媛쒕컻/떎뻾 뵆옯뤌

(1) OS : win

(2) 媛쒕컻댋 : 뜽뙆씠 2009

(3) 궗슜 Database :

2. 媛쒕컻 以묒씤 봽濡쒓렇옩 indy http rest api 샇異

3. 吏덈Ц 궡슜

븞뀞븯꽭슂. 理쒓렐뿉 湲쓣 뿬윭踰 궓湲곌퀬 엳꽕슂.. 떟떟븳 留덉쓬뿉 떎떆 吏덈Ц뱶由쎈땲떎. 뀪뀪

슦꽑 젣媛 븯怨 엳뒗嫄 JSON삎떇쑝濡 REST API 샇異쒗븯怨 엳쑝硫, 洹 以묎컙뿉 AES128, CBC, PKCS5PADDING 쑝濡 븫蹂듯샇솕 諛 BASE64濡 씤/뵒肄붾뵫븯뿬 샇異쒓컻諛쒗븯怨 엳뒿땲떎.

JAVA踰꾩쟾쑝濡 샇異쒖셿猷뚰븯뿬 뜽뙆씠踰꾩쟾쑝濡 蹂寃쏀빐꽌 媛쒕컻以묒씠硫, 씠젣 indy 궗슜븯怨 api 샇異 遺遺 媛쒕컻以묒뿉 엳뒿땲떎.

INDY 踰꾩쟾 10.2.5 궗슜以묒씠硫, 二쇱냼媛 https 씪꽌 tidhttp, TidSSLIOhandlerSocketOpenSSL, TidLogEvent 3媛 궗슜븯뿬 뿰寃고빐꽌 log源뚯 李띿뼱蹂대㈃꽌 媛쒕컻以묒씠硫, request 援щЦ뿉꽌 customHeaders履쎈룄 異붽븯뿬 由ы섏뒪듃 援щЦ 留뚮뱾뼱꽌 post 궇由ш퀬 엳쑝굹

connection 릺뿀떎怨 굹삤굹 exception 뿉꽌 Connection Closed Gracefully 濡 삁쇅굹삤怨 엳뒗 긽솴엯땲떎.

硫붿꽭吏媛 뿉윭媛 븘땲씪 뿰寃곗씠 젙긽醫낅즺濡 굹삤뒗 硫붿꽭吏뒗 븣寃좊뒗뜲 respons媛믪씠 븘臾닿쾬룄 궇븘삤吏 븡븘꽌 吏덈Ц쓣 궓湲곌쾶 릺뿀뒿땲떎.

    sslHandle := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
    sslHandle2.SSLOptions.Method := sslvSSLv23;
    sslHandle2.SSLOptions.Mode := sslmClient;

    idHTTP2.Request.ContentType := 'application/json; charset=utf-8';
    idHTTP2.Request.ContentEncoding := 'utf-8';
    idHTTP2.Request.Accept := 'application/json; charset=utf-8';

IdHTTP2.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 safari/537.36';

   IdHTTP2.Response.ContentType := 'application/json; charset=utf-8';

   idHTTP2.Request.CustomHeaders.Values['X-Openpoint'] := 'burC=OA26|aesYn=Y';

   url2 := 'https://샇異쐕rl:8903/op';

 

try
          showmessage('JsonToSend2 蹂대궡뒗뒪듃由쇱궗씠利' + IntToStr(JsonToSend2.Size));
//          IdHTTP2.Connect;
//          resultstr := idHTTP2.Post(url2, JsonToSend2);
          // post 뒪듃由쇱쑝濡
          idHTTP2.Post(url2, JsonToSend2, rcvStream2);
          //post 씠뱶뒪듃由.

          showmessage('뒪듃由쇱궗씠利' + IntToStr(rcvStream2.Size));
          showmessage('resultstr :' + resultstr);
        except
//          on e : EIdHTTPProtocolException do
//          begin
//            showmessage('씡뀎뀡EIdHTTPProtocolException = ' + e.Message);
//          end;
          on e: EIdHTTPProtocolException do
          begin

          end;

          on e: Exception do
          begin
            showmessage('뒪듃由쇱궗씠利' + IntToStr(rcvStream2.Size));
            showmessage('븞뿉 씡뀎뀡 洹몃젅씠뒪由촃ception = ' + e.Message);
          end;

        end;

        showmessage('wide뒪듃由 寃곌낵 :' + resultstr);
//        resStr2 := TEncoding.UTF8.GetString(rcvStream2.Bytes, 0, rcvStream2.Size);
//        showmessage('뒪듃由쇰궡슜 = ' + (rcvStream2.ToString));
//        showmessage('뒪듃由쇱궗씠利' + IntToStr(rcvStream2.Size));

 

냼뒪媛 꼫臾 씠寃껋寃 븯떎蹂대땲 꼫臾 議곗옟븯湲 븳뜲 臾몄젣젏 쓳떟stream쓣 諛쏆쓣닔 뾾떎뒗寃 臾몄젣젏씠硫,

샊떆굹 idhttp 샇異쒖씠 뵲濡 꽌踰꾨떒뿉꽌 萸 뿴뼱以섏빞븯嫄곕굹 洹몃윴寃 엳쓣源뚯슂 븘땲硫 뜽뙆씠떒뿉꽌 萸붽 뀑똿쓣 옒紐삵븳嫄멸퉴슂

씠誘몄뒗 留뚮뱾뼱吏 header遺遺꾧낵 body떒 븫샇솕 援щЦ엯땲떎.