[
https://issues.apache.org/jira/browse/CXF-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
chengy closed CXF-4726.
-----------------------
Resolution: Not A Problem
> 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