[ https://issues.apache.org/jira/browse/CXF-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13542888#comment-13542888 ]
chengy commented on CXF-4726: ----------------------------- Thank you,Daniel.You are right,the attachement can read or copy. The Content-Disposition header is writing in utf8,but read by InternetHeaders.getHeader("Content-Disposition", null) on client side,which cause the filename inconsistent.May be it is right. So,The correct header can get like this: byte[] bytes = header.getBytes("iso-8859-1"); System.out.println(new String(bytes,"UTF-8"); Thank you very much! > AttachmentDataSource stream bug and filename contains non-US-ASCII characters > receive incorrect > ----------------------------------------------------------------------------------------------- > > Key: CXF-4726 > URL: https://issues.apache.org/jira/browse/CXF-4726 > Project: CXF > Issue Type: Bug > Affects Versions: 2.6.4 > Reporter: chengy > > When test with the mtom example by SAAJ Dispath API,I find 2 bug: > 1,the AttachmentPart.getDataHandler().getInputStream() contains no > data,available method get 0; > 2,the filename contains non-US-ASCII characters received incorrect. > the client test code like below: > {code:java} > URL wsdlURL=new URL("http://localhost:9000/mime-test?wsdl"); > TestMtomService tms = new TestMtomService(wsdlURL, SERVICE_NAME); > TestMtomPortType port = (TestMtomPortType) tms.getPort(PORT_NAME, > TestMtomPortType.class); > Binding binding = ((BindingProvider)port).getBinding(); > ((SOAPBinding)binding).setMTOMEnabled(true); > DocumentBuilderFactory dbf= DocumentBuilderFactory.newInstance(); > dbf.setNamespaceAware(true); > String s="<testDataHandler > xmlns=\"http://cxf.apache.org/mime/types\"><name>Bob</name></testDataHandler>"; > Document doc= dbf.newDocumentBuilder().parse(new InputSource(new > StringBufferInputStream(s))); > SOAPMessage msg=MessageFactory.newInstance().createMessage(); > msg.getSOAPBody().addDocument(doc); > Dispatch<SOAPMessage> dispatch =tms.createDispatch(PORT_NAME, > SOAPMessage.class, Mode.MESSAGE); > SOAPMessage res= dispatch.invoke(msg); > AttachmentPart attachmentPart= > (AttachmentPart)res.getAttachments().next(); > > System.out.println(attachmentPart.getDataHandler().getName()+";"+attachmentPart.getDataHandler().getInputStream().available()); > {code} > the server test code like below: > {code:java} > public void testDataHandler(Holder<String> name, Holder<DataHandler> > attachinfo) { > try { > name.value = "Hello " + name.value; > attachinfo.value = new DataHandler(new FileDataSource(new > File("c:/奋斗1cc.jpg"))); > } catch (Exception e) { > e.printStackTrace(); > } > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira