javax.xml.bind.attachment
import javax.xml.bind.annotation.*;
import javax.xml.bind.attachment.*;
@XmlRootElement(name = "Mail")
public class Mail {
private String from;
private String to;
@XmlAttachmentRef
private Attachment attachment;
}AttachmentPart part = attachment.getAttachmentParts().get(0);
part.getDataHandler().getInputStream(); // Read attachment contentimport javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.*;
import javax.xml.bind.attachment.*;
@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public class AttachmentWebService {
public void sendAttachment(@Param("mail") Mail mail) {
// Save attachment
}
}