public ContentType getContentType(ClientOptions options, ContentType contentType) throws Exception { if (contentType.getBaseType().equals(XMLMessage.Type.SWA.getContentType().getBaseType())) { OMOutputFormat outputFormat = new OMOutputFormat(); outputFormat.setMimeBoundary(options.getMimeBoundary()); outputFormat.setRootContentId(options.getRootContentId()); return new ContentType(outputFormat.getContentTypeForSwA(SOAP12Constants.SOAP_12_CONTENT_TYPE)); } else { return ContentTypeUtil.addCharset(contentType, options.getCharset()); } }
public byte[] encode(ClientOptions options, XMLMessage message) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat outputFormat = new OMOutputFormat(); outputFormat.setCharSetEncoding(options.getCharset()); outputFormat.setIgnoreXMLDeclaration(true); if (message.getType() == XMLMessage.Type.SWA) { outputFormat.setMimeBoundary(options.getMimeBoundary()); outputFormat.setRootContentId(options.getRootContentId()); StringWriter writer = new StringWriter(); message.getMessageElement().serializeAndConsume(writer); MIMEOutputUtils.writeSOAPWithAttachmentsMessage(writer, baos, message.getAttachments(), outputFormat); } else { message.getMessageElement().serializeAndConsume(baos, outputFormat); } return baos.toByteArray(); } };
public ContentType getContentType(ClientOptions options, ContentType contentType) throws Exception { if (contentType.getBaseType().equals(XMLMessage.Type.SWA.getContentType().getBaseType())) { OMOutputFormat outputFormat = new OMOutputFormat(); outputFormat.setMimeBoundary(options.getMimeBoundary()); outputFormat.setRootContentId(options.getRootContentId()); return new ContentType(outputFormat.getContentTypeForSwA(SOAP12Constants.SOAP_12_CONTENT_TYPE)); } else { return ContentTypeUtil.addCharset(contentType, options.getCharset()); } }
innerFormat.setMimeBoundary(innerBoundary); innerOutputStream = mpw.writePart("multipart/related; boundary=\"" + innerBoundary + "\"", partCID); attachmentsWriter = new OMMultipartWriter(innerOutputStream, innerFormat);
public byte[] encode(ClientOptions options, XMLMessage message) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat outputFormat = new OMOutputFormat(); outputFormat.setCharSetEncoding(options.getCharset()); outputFormat.setIgnoreXMLDeclaration(true); if (message.getType() == XMLMessage.Type.SWA) { outputFormat.setMimeBoundary(options.getMimeBoundary()); outputFormat.setRootContentId(options.getRootContentId()); OMMultipartWriter mpw = new OMMultipartWriter(baos, outputFormat); OutputStream out = mpw.writeRootPart(); message.getMessageElement().serializeAndConsume(out); out.close(); Attachments attachments = message.getAttachments(); for (String id : attachments.getAllContentIDs()) { mpw.writePart(attachments.getDataHandler(id), id); } mpw.complete(); } else { message.getMessageElement().serializeAndConsume(baos, outputFormat); } return baos.toByteArray(); } };
innerFormat.setMimeBoundary(innerBoundary); innerOutputStream = mpw.writePart("multipart/related; boundary=\"" + innerBoundary + "\"", partCID); attachmentsWriter = new OMMultipartWriter(innerOutputStream, innerFormat);
public byte[] encode(ClientOptions options, XMLMessage message) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat outputFormat = new OMOutputFormat(); outputFormat.setCharSetEncoding(options.getCharset()); outputFormat.setIgnoreXMLDeclaration(true); if (message.getType() == XMLMessage.Type.SWA) { outputFormat.setMimeBoundary(options.getMimeBoundary()); outputFormat.setRootContentId(options.getRootContentId()); OMMultipartWriter mpw = new OMMultipartWriter(baos, outputFormat); OutputStream out = mpw.writeRootPart(); message.getMessageElement().serializeAndConsume(out); out.close(); Attachments attachments = message.getAttachments(); for (String id : attachments.getAllContentIDs()) { mpw.writePart(attachments.getDataHandler(id), id); } mpw.complete(); } else { message.getMessageElement().serializeAndConsume(baos, outputFormat); } return baos.toByteArray(); } };
public ContentType getContentType(ClientOptions options, ContentType contentType) throws Exception { if (contentType.getMediaType().equals(XMLMessage.Type.SWA.getContentType())) { OMOutputFormat outputFormat = new OMOutputFormat(); outputFormat.setMimeBoundary(options.getMimeBoundary()); outputFormat.setRootContentId(options.getRootContentId()); return new ContentType(outputFormat.getContentTypeForSwA(SOAP12Constants.SOAP_12_CONTENT_TYPE)); } else { return contentType.toBuilder().setParameter("charset", options.getCharset()).build(); } }
contentType.setParameter("boundary", boundary); format.setMimeBoundary(boundary);
contentType.setParameter("boundary", boundary); format.setMimeBoundary(boundary);
.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty);
/** * Get the OMOutput format for the given message * @param msgContext the axis message context * @return the OMOutput format to be used */ public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) { OMOutputFormat format = new OMOutputFormat(); msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext)); msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext)); format.setSOAP11(msgContext.isSOAP11()); format.setDoOptimize(msgContext.isDoingMTOM()); format.setDoingSWA(msgContext.isDoingSwA()); format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext)); Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty); } return format; }
.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty);
/** * Retirn the OMOutputFormat to be used for the message context passed in * @param msgContext the message context * @return the OMOutputFormat to be used */ public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) { OMOutputFormat format = new OMOutputFormat(); msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext)); msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext)); format.setSOAP11(msgContext.isSOAP11()); format.setDoOptimize(msgContext.isDoingMTOM()); format.setDoingSWA(msgContext.isDoingSwA()); format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext)); Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty); } return format; }
/** * Get the OMOutput format for the given message * @param msgContext the axis message context * @return the OMOutput format to be used */ public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) { OMOutputFormat format = new OMOutputFormat(); msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext)); msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext)); msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext)); format.setSOAP11(msgContext.isSOAP11()); format.setDoOptimize(msgContext.isDoingMTOM()); format.setDoingSWA(msgContext.isDoingSwA()); format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext)); Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty); } return format; }
Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY); if (mimeBoundaryProperty != null) { format.setMimeBoundary((String) mimeBoundaryProperty);