@Override @SuppressWarnings("unchecked") public Iterator<Attachment> getAttachments() throws AttachmentException { Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(); return new SaajAttachmentIterator(iterator); }
@Override @SuppressWarnings("unchecked") public Iterator<Attachment> getAttachments() throws AttachmentException { Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(); return new SaajAttachmentIterator(iterator); }
@Override @SuppressWarnings("unchecked") public Iterator<Attachment> getAttachments() throws AttachmentException { Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(); return new SaajAttachmentIterator(iterator); }
@Override @SuppressWarnings("unchecked") public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
@Override @SuppressWarnings("unchecked") public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
@Override @SuppressWarnings("unchecked") public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getImplementation().getAttachment(getSaajMessage(), mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
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); }
public void marshalWithSoapActionHeader(MyObject o) { webServiceTemplate.marshalSendAndReceive(o, new WebServiceMessageCallback() { public void doWithMessage(WebServiceMessage message) { SaajSoapMessage saajSoapMessage = (SaajSoapMessage) message; SOAPMessage soapMessage = saajSoapMessage.getSaajMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPHeader header = soapMessage.getSOAPHeader(); header.detachNode(); } }); }
@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); }
@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 Iterator<Attachment> getAttachments() throws AttachmentException { Iterator<AttachmentPart> iterator = getImplementation().getAttachments(getSaajMessage()); return new SaajAttachmentIterator(iterator); }
public void writeTo(OutputStream outputStream) throws IOException { MimeHeaders mimeHeaders = getImplementation().getMimeHeaders(getSaajMessage()); if (ObjectUtils.isEmpty(mimeHeaders.getHeader(TransportConstants.HEADER_ACCEPT))) { mimeHeaders.setHeader(TransportConstants.HEADER_ACCEPT, getVersion().getContentType()); } try { getImplementation().writeTo(getSaajMessage(), outputStream); outputStream.flush(); } catch (SOAPException ex) { throw new SaajSoapMessageException("Could not write message to OutputStream: " + ex.getMessage(), ex); } }
public SoapEnvelope getEnvelope() { if (envelope == null) { try { SOAPEnvelope saajEnvelope = getImplementation().getEnvelope(getSaajMessage()); envelope = new SaajSoapEnvelope(saajEnvelope, langAttributeOnSoap11FaultString); } catch (SOAPException ex) { throw new SaajSoapEnvelopeException(ex); } } return envelope; }
@Override public String getSoapAction() { MimeHeaders mimeHeaders = getSaajMessage().getMimeHeaders(); if (SoapVersion.SOAP_11 == getVersion()) { String[] actions = mimeHeaders.getHeader(TransportConstants.HEADER_SOAP_ACTION); return ObjectUtils.isEmpty(actions) ? TransportConstants.EMPTY_SOAP_ACTION : actions[0]; } else if (SoapVersion.SOAP_12 == getVersion()) { String[] contentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE); return !ObjectUtils.isEmpty(contentTypes) ? SoapUtils.extractActionFromContentType(contentTypes[0]) : TransportConstants.EMPTY_SOAP_ACTION; } else { throw new IllegalStateException("Unsupported SOAP version: " + getVersion()); } }
@Override public SoapEnvelope getEnvelope() { if (envelope == null) { try { SOAPEnvelope saajEnvelope = getSaajMessage().getSOAPPart().getEnvelope(); envelope = new SaajSoapEnvelope(saajEnvelope, langAttributeOnSoap11FaultString); } catch (SOAPException ex) { throw new SaajSoapEnvelopeException(ex); } } return envelope; }
@Override public String getSoapAction() { MimeHeaders mimeHeaders = getSaajMessage().getMimeHeaders(); if (SoapVersion.SOAP_11 == getVersion()) { String[] actions = mimeHeaders.getHeader(TransportConstants.HEADER_SOAP_ACTION); return ObjectUtils.isEmpty(actions) ? TransportConstants.EMPTY_SOAP_ACTION : actions[0]; } else if (SoapVersion.SOAP_12 == getVersion()) { String[] contentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE); return !ObjectUtils.isEmpty(contentTypes) ? SoapUtils.extractActionFromContentType(contentTypes[0]) : TransportConstants.EMPTY_SOAP_ACTION; } else { throw new IllegalStateException("Unsupported SOAP version: " + getVersion()); } }
@Override public SoapEnvelope getEnvelope() { if (envelope == null) { try { SOAPEnvelope saajEnvelope = getSaajMessage().getSOAPPart().getEnvelope(); envelope = new SaajSoapEnvelope(saajEnvelope, langAttributeOnSoap11FaultString); } catch (SOAPException ex) { throw new SaajSoapEnvelopeException(ex); } } return envelope; }
@Override public SoapEnvelope getEnvelope() { if (envelope == null) { try { SOAPEnvelope saajEnvelope = getSaajMessage().getSOAPPart().getEnvelope(); envelope = new SaajSoapEnvelope(saajEnvelope, langAttributeOnSoap11FaultString); } catch (SOAPException ex) { throw new SaajSoapEnvelopeException(ex); } } return envelope; }