WSI

Attachments attachments = _returnMessageContext.getAttachmentMap();
attachments.getAllContentIDs();

return new ResponseWithAttachments(a,b)


*********************************************************
// 构造请求消息
AbcServiceStub.QueryReq req = new AbcServiceStub.QueryReq();

req.setUserId(USERID);
ResponseWithAttachments rwa = stub.Query(req);


--------------------------
attachments = rwa.getAttachments();
// String[] content_id = attachments.getAllContentIDs();
String[] strings = new String[0];
String[] content_id = (String[])attachments.getContentIDList().toArray(strings);


for (int i = 0; i < content_id.length; i++)
{
DataHandler dataHandler = attachments.getDataHandler(content_id[i]);

File file = null;
String contentType = dataHandler.getContentType();
if (contentType.contains("image"))
{

dataHandler.writeTo(fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
}

}
}


-----------------------------------------------------------------

你可能感兴趣的:(WSI)