Hi I'm trying to write a simple service which accepts 2 MTOM attachments. I'm using the cxf installer which ships with JBOSS SOA 5.2.0.
I'm trying this with SAXSource & facing problem when I send 2 attachments. If I sedn one then it works fine. here is how the provider looks like - ------------------------------------------------------------------------------------ @WebServiceProvider(portName = "SubmitDocumentPort", serviceName = "SubmitDocumentService", targetNamespace = "http://attach.poc.dsh.cms.hhs.gov", wsdlLocation = "classpath:SubmitDocumentService.wsdl") @BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http") @ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD) @MTOM(enabled=true) public class SubmitDocumentWithSource implements Provider<SAXSource> { @Resource WebServiceContext wsContext; ------------------------------------------------------------------------------------------ This is how I try to retrieve the mtom attachments - ---------------------------------------------------------- @Override public SAXSource invoke(SAXSource source) { MessageContext context = wsContext.getMessageContext(); Map attachmentMap = (Map) context.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS) ; Iterator itKeys = attachmentMap.keySet().iterator(); while (itKeys.hasNext()) { String contentId = (String)itKeys.next(); DataHandler dataHand = (DataHandler)attachmentMap.get(contentId); DataSource ds = dataHand.getDataSource(); ........... ......... ---------------------------------------------------------------------------------- I've two element which accepts attachment. If I attach one (for either one), it works fine. When I attach 2 attachments and associate one to each field, I face the following issue while retrieving the attachments - 1. The attachment map size is still 1. I expected it to be 2, one for each field 2. The key in the map is the content id of the first field but the content retrieved from the stream is the merged raw http data (from both attachments) - ====================content below====================== ------=_Part_67_27088282.1346295011808 Content-ID: <1059426595022> Content-Disposition: attachment; name="file1.txt"; filename="file1.txt" This line is the content from 1st attachemt. ------=_Part_67_27088282.1346295011808 Content-ID: <130140384171> Content-Disposition: attachment; name="file2.txt"; filename="file2.txt" This line is the content from 2nd attachemt. ------=_Part_67_27088282.1346295011808-- ================================================= This is weired & I'm not sure why it is happening when I send 2 attachments. Any help or pointer is highly appreciated. Thanks for looking. Regards Niraj Nath -- View this message in context: http://cxf.547215.n5.nabble.com/Issue-with-multiple-MTOM-attachments-tp5713345.html Sent from the cxf-user mailing list archive at Nabble.com.
