List of usage examples for javax.xml.soap SOAPMessage createAttachmentPart
public AttachmentPart createAttachmentPart(DataHandler dataHandler)
From source file:org.cerberus.service.soap.impl.SoapService.java
@Override public void addAttachmentPart(SOAPMessage input, String path) throws CerberusException { URL url;/*from w w w . jav a2 s. c om*/ try { url = new URL(path); DataHandler handler = new DataHandler(url); //TODO: verify if this code is necessary /*String str = ""; StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); while (null != (str = br.readLine())) { sb.append(str); }*/ AttachmentPart attachPart = input.createAttachmentPart(handler); input.addAttachmentPart(attachPart); } catch (MalformedURLException ex) { throw new CerberusException(new MessageGeneral(MessageGeneralEnum.SOAPLIB_MALFORMED_URL)); } catch (IOException ex) { throw new CerberusException(new MessageGeneral(MessageGeneralEnum.SOAPLIB_MALFORMED_URL)); } }