Cosminexus アプリケーションサーバ V8 Webサービス開発の手引
ストリーミングを使用しているときに添付ファイルを含むMIME Multipart/Related構造のSOAPメッセージを受信すると,JAX-WSでは受信した添付ファイルをjavax.activation.DataHandlerクラスではなく,com.sun.xml.ws.developer.StreamingDataHandlerクラスにマッピングし,ストリーミングされた添付ファイルとして操作できます。
com.sun.xml.ws.developer.StreamingDataHandlerクラスについては,「15.4.2 com.sun.xml.ws.developer.StreamingDataHandlerクラス」を参照してください。
ストリーミングされた添付ファイルを操作する例を次に示します。この例では,ストリーミングされた添付ファイルを"C:/portrait.png"として別名で出力します。
package com.sample;
・・・・・・
@MTOM
@StreamingAttachment(dir="C:/TMP", parseEagerly=true, memoryThreshold=50000L)
@BindingType(・・・)
public class UserInfoImpl implements UserInfo {
public DataHandler getUserInfo(DataHandler dataHandler)
throws UserDefinedException {
if (dataHandler instanceof StreamingDataHandler) {
File file = new File("C:/portrait.png");
StreamingDataHandler sdh = null;
try {
sdh = (StreamingDataHandler)dataHandler;
sdh.moveTo(file);
・・・・・・
} finally {
try {
if (sdh != null) {
sdh.close();
}
} catch(Exception ex) {
・・・・・・
}
}
}
}
}
|
All Rights Reserved. Copyright (C) 2008, 2011, Hitachi, Ltd.