URL url = new URL("http://greatproducts.com/gizmos/img.jpg"); DataHandler dataHandler = new DataHandler(url); AttachmentPart attachment = message.createAttachmentPart(dataHandler); attachment.setContentId("attached_image"); message.addAttachmentPart(attachment);
AttachmentPart attachment = message.createAttachmentPart(); String stringContent = "Update address for Sunny Skies " + "Inc., to 10 Upbeat Street, Pleasant Grove, CA 95439"; attachment.setContent(stringContent, "text/plain"); attachment.setContentId("update_address"); message.addAttachmentPart(attachment);
private AttachmentPart createAttachment( GetMap getMap, ByteArrayOutputStream stream, SOAPMessage message, String contentId ) { DataSource ds = new ByteArrayDataSource( stream.toByteArray() ); DataHandler dataHandler = new DataHandler( ds ); AttachmentPart attachmentPart = message.createAttachmentPart( dataHandler ); attachmentPart.setContentId( contentId ); attachmentPart.setContentType( getMap.getFormat() ); return attachmentPart; }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(dh); part.setContentId(contentId); saaj.addAttachmentPart(part); } }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(dh); part.setContentId(contentId); saaj.addAttachmentPart(part); } }
public Attachment addAttachment(String contentId, DataHandler dataHandler) { Assert.hasLength(contentId, "contentId must not be empty"); Assert.notNull(dataHandler, "dataHandler must not be null"); AttachmentPart saajAttachment = getImplementation().addAttachmentPart(getSaajMessage(), dataHandler); saajAttachment.setContentId(contentId); saajAttachment.setMimeHeader(TransportConstants.HEADER_CONTENT_TRANSFER_ENCODING, "binary"); return new SaajAttachment(saajAttachment); }
@Override public Attachment addAttachment(String contentId, DataHandler dataHandler) { Assert.hasLength(contentId, "contentId must not be empty"); Assert.notNull(dataHandler, "dataHandler must not be null"); SOAPMessage message = getSaajMessage(); AttachmentPart attachmentPart = message.createAttachmentPart(dataHandler); message.addAttachmentPart(attachmentPart); attachmentPart.setContentId(contentId); attachmentPart.setMimeHeader(TransportConstants.HEADER_CONTENT_TRANSFER_ENCODING, "binary"); return new SaajAttachment(attachmentPart); }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(dh); part.setContentId(contentId); saaj.addAttachmentPart(part); } }
@Override public Attachment addAttachment(String contentId, DataHandler dataHandler) { Assert.hasLength(contentId, "contentId must not be empty"); Assert.notNull(dataHandler, "dataHandler must not be null"); SOAPMessage message = getSaajMessage(); AttachmentPart attachmentPart = message.createAttachmentPart(dataHandler); message.addAttachmentPart(attachmentPart); attachmentPart.setContentId(contentId); attachmentPart.setMimeHeader(TransportConstants.HEADER_CONTENT_TRANSFER_ENCODING, "binary"); return new SaajAttachment(attachmentPart); }
@Override public Attachment addAttachment(String contentId, DataHandler dataHandler) { Assert.hasLength(contentId, "contentId must not be empty"); Assert.notNull(dataHandler, "dataHandler must not be null"); SOAPMessage message = getSaajMessage(); AttachmentPart attachmentPart = message.createAttachmentPart(dataHandler); message.addAttachmentPart(attachmentPart); attachmentPart.setContentId(contentId); attachmentPart.setMimeHeader(TransportConstants.HEADER_CONTENT_TRANSFER_ENCODING, "binary"); return new SaajAttachment(attachmentPart); }
byte[] encoded = Files.readAllBytes(Paths.get("C:\\Users\\timofb\\Documents\\test.txt")); String soapXml = new String(encoded, StandardCharsets.UTF_8); SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); java.net.URL endpoint = new URL("http://" + ip + "/cs-repository/services/xds-iti41"); SOAPConnection connection = soapConnectionFactory.createConnection(); MessageFactory factory = MessageFactory.newInstance(); SOAPMessage message = factory.createMessage(new MimeHeaders(), new ByteArrayInputStream(encoded)); AttachmentPart attachment = message.createAttachmentPart(); attachment.setContent("sm_content", "text/plain"); attachment.setContentId("1.9f910338bf0cac0e783bfdec7e53be9237684caa8f8f4e6d@apache.org"); message.addAttachmentPart(attachment); SOAPMessage response = connection.call(message, endpoint); ByteArrayOutputStream out = new ByteArrayOutputStream(); response.writeTo(out); String strMsg = new String(out.toByteArray()); return strMsg;
@Override public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(asDataHandler()); part.setContentId(contentId); saaj.addAttachmentPart(part); }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(asDataHandler()); part.setContentId(contentId); saaj.addAttachmentPart(part); }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setRawContentBytes(data,0,len,getContentType()); part.setContentId(contentId); saaj.addAttachmentPart(part); } }
@Override public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(asDataHandler()); part.setContentId(contentId); saaj.addAttachmentPart(part); }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(asDataHandler()); part.setContentId(contentId); saaj.addAttachmentPart(part); }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(asDataHandler()); part.setContentId(contentId); saaj.addAttachmentPart(part); }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setRawContentBytes(data,0,len,getContentType()); part.setContentId(contentId); saaj.addAttachmentPart(part); } }
public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setRawContentBytes(data,0,len,getContentType()); part.setContentId(contentId); saaj.addAttachmentPart(part); } }
@Override public void writeTo(SOAPMessage saaj) throws SOAPException { AttachmentPart part = saaj.createAttachmentPart(); part.setDataHandler(asDataHandler()); part.setContentId(contentId); saaj.addAttachmentPart(part); }