블로그 이미지
올해목표 // 10월 어학연수 떠나자~ 자수씨

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
Spring (31)
JAVA (176)
JavaScript (59)
WEB (49)
Database (20)
OS (26)
Tools (8)
Tips (26)
IT정보 (1)
Book (21)
Programming (37)
외부행사 (43)
주변인들 (17)
여행노트 (60)
학교생활 (30)
회사생활 (52)
사회생활 (5)
외국어공부 (12)
잡동사니 (30)
Total
Today
Yesterday
 
03-29 11:30
 

달력

« » 2024.3
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
 

최근에 올라온 글

최근에 달린 댓글

'MtoM'에 해당되는 글 1건

  1. 2008.11.02 JAX-WS Attachment 처리

첨부파일을 JAX-WS 에서는 어떻게 넘길가가 궁금해서 한번 도전해보았습니다.
무모한 도전의 결과는 무한삽질의 반복이...
여튼 어느정도 성공을 한 듯 합니다. ㅋㅋㅋㅋ

ㅁ Server Side
kr/co/vicki/webservices/conf/uploadWebservicesContext.xml


WEB-INF/web.xml


kr.co.vicki.webservices.webservice.UploadWebService.java


  - @MTOM: binary attachment 전송을 위한 어노테이션
  - @SOAPBinding(style = SOAPBinding.Style.RPC)... 이건 무슨 말인지 모르겠습니다. 
    아래와 같은 설명이 어딘가에 있더라구요... 해석이 딸리므로... 읽으시는 분께 맡기겠습니다.
    그러나 해당 어노테이션이 정의되어 있지 않으면 클라이언트쪽에서 제너레이션 된 메소드의 파라미터가
    byte[] 이 아닌 DataHandler 가 되므로 일단 어노테이션을 위와 같이 설정합니다.
No, this is specified by the SOAPBinding annotation on the service class. Notice this in the original post above:

@SOAPBinding(style = SOAPBinding.Style.RPC)

This is telling wsgen that this is an rpc/literal service. A document/literal (doc/lit) service is specified thusly:

@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)

Actually, things are a little more complicated. This is actually specifying a doc/lit/wrapped service, meaning that the SOAP message body can contain multiple parameters. By contrast, in a doc/lit/bare service, the SOAP message body can contain only one parameter. For all the gory details, see the Annotations section of the JAX-WS User's Guide. 




ㅁ Client Side
kr/co/vicki/client/conf/webservicesContext.xml



kr/co/vicki/client/Client.java


서버의 public void fileUpload(String filename, DataHandler handler) 메소드는
클라이언트에서 public void fileUpload(String filename, byte[] arg1) 로 제너레이션 됩니다.
파일을 byte[] 로 변환하여 파일명과 함께 넘겨주게 되면 서버쪽에서 inputStream 으로 접근이 가능하게 됩니다.

첨부파일을 7KB와 4MB, 20MB 로 테스트 해본결과 20MB 는 힙 메모리 부족이라는 익센션을 날려주었습니다.
JAX-WS User Guide를 보면 용량 제한하는 어노테이션도 보이던데 테스트는 해보지 못했습니다.

이걸 해보며서 알게된 사항은 org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter 이놈은 한 컨텍스트에
한개의 웹서비스를 Export 해주는 것 같습니다. 크흑..

웹서비스는 재밌습니다?

[참고자료]
JAX-WS User Guide
  - https://jax-ws.dev.java.net/guide/Large_Attachments.html
  - https://jax-ws.dev.java.net/guide/Binary_Attachments.html
  - https://jax-ws.dev.java.net/guide/Creating_a_MTOM_Web_Service.html
java.net Forums
  - http://forums.java.net/jive/thread.jspa?threadID=25614

Posted by 자수씨
, |

글 보관함

최근에 받은 트랙백