if (obj instanceof SOAPMessage) { SOAPMessage msg = (SOAPMessage)obj; if (msg.countAttachments() > 0) { client.getRequestContext().put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE);
public int countAttachments() { return soapMessage.countAttachments(); }
SOAPMessage soapMessage = (SOAPMessage)o; if (soapMessage.countAttachments() > 0) { message.put("write.attachments", Boolean.TRUE);
if (soapMessage.countAttachments() > 0) { message.put("write.attachments", Boolean.TRUE);
@Override public boolean handleMessage(SOAPMessageContext ctx) { boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); log.debug("##########handleMessage ForceMTOMHandler:"+outbound); SOAPMessage msg = ctx.getMessage(); if (outbound) { if (msg.countAttachments() == 0 && XdsDevice.getXdsRepository().isForceMTOM()) { try { @SuppressWarnings("unchecked") Map<String, List<String>> headers = (Map<String, List<String>>) ctx.get(SOAPMessageContext.HTTP_REQUEST_HEADERS); if (headers.get("content-type").get(0).indexOf("application/xop+xml") != -1) { log.info("FORCE MTOM/XOP Response Message!"); ByteArrayDataSource DUMMY_PLAIN_DATA_SOURCE = new ByteArrayDataSource("Force MTOM/XOP to make 'important vendor' happy.\nThanks for forcing me to add this completly needless stuff to a simple SOAP message!", "text/plain"); msg.addAttachmentPart(msg.createAttachmentPart(new DataHandler(DUMMY_PLAIN_DATA_SOURCE))); } } catch (IOException x) { log.error("FORCE MTOM/XOP failed!", x); } } } return true; }
if (secureMessage.countAttachments() > 0) { secureMessage.writeTo(out); } else {
int numOfAttachments = soapMessage.countAttachments(); Iterator<AttachmentPart> attachments = soapMessage.getAttachments();
if (request.countAttachments() > 0) { MessageFactory factory = MessageFactory.newInstance(); InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
if (obj instanceof SOAPMessage) { SOAPMessage msg = (SOAPMessage)obj; if (msg.countAttachments() > 0) { client.getRequestContext().put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE);
if (soapMessage.countAttachments() > 0) { if (message.getAttachments() == null) { message.setAttachments(new ArrayList<Attachment>(soapMessage .countAttachments()));
if (soapMessage.countAttachments() > 0) { if (message.getAttachments() == null) { message.setAttachments(new ArrayList<Attachment>(soapMessage .countAttachments()));
} else { envelope = SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()); if (request.countAttachments() != 0) { // SOAPMessage with attachments Attachments attachments = requestMsgCtx.getAttachmentMap(); for (Iterator it = request.getAttachments(); it.hasNext(); ) {
} else { envelope = SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement()); if (request.countAttachments() != 0) { // SOAPMessage with attachments Attachments attachments = requestMsgCtx.getAttachmentMap(); for (Iterator it = request.getAttachments(); it.hasNext(); ) {
assertEquals(5, msg.countAttachments());
SOAPMessage soapMessage = (SOAPMessage)o; if (soapMessage.countAttachments() > 0) { message.put("write.attachments", Boolean.TRUE);
@Test public void testSWA() throws Exception { SOAPFactory soapFac = SOAPFactory.newInstance(); MessageFactory msgFac = MessageFactory.newInstance(); SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance(); SOAPMessage msg = msgFac.createMessage(); QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHiWAttach"); msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi)); AttachmentPart ap1 = msg.createAttachmentPart(); ap1.setContent("Attachment content", "text/plain"); msg.addAttachmentPart(ap1); AttachmentPart ap2 = msg.createAttachmentPart(); ap2.setContent("Attachment content - Part 2", "text/plain"); msg.addAttachmentPart(ap2); msg.saveChanges(); SOAPConnection con = conFac.createConnection(); URL endpoint = new URL("http://localhost:" + PORT + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1"); SOAPMessage response = con.call(msg, endpoint); QName sayHiResp = new QName("http://apache.org/hello_world_rpclit", "sayHiResponse"); assertNotNull(response.getSOAPBody().getChildElements(sayHiResp)); assertEquals(2, response.countAttachments()); }
if (soapMessage.countAttachments() > 0) { message.put("write.attachments", Boolean.TRUE);