It worked with ByteArrayDataSource!, Thanks Andreas!! --Srinath On Tue, Jun 16, 2009 at 1:10 PM, Andreas Veithen<andreas.veit...@gmail.com> wrote: > InputStreamDataSource violates the DataSource contract and should > never have been included in the Axis2 codebase (see discussion in > [1]). You should not use it. It is planned to clean this stuff up for > Axis2 1.6. > > What you can do is to read the stream into a byte array and then use > ByteArrayDataSource, at least if that is compatible with your > requirements in terms of performance and/or memory consumption. > > Andreas > > [1] http://markmail.org/message/yqcw2gtejceu4lnk > > On Tue, Jun 16, 2009 at 09:31, Srinath Perera<hemap...@gmail.com> wrote: >> Hi Andreas; >> It is Axis2 class, org.apache.axis2.builder.unknowncontent.* .. Is >> there any other DataSource impl I can use? >> --Srinath >> >> On Tue, Jun 16, 2009 at 12:57 PM, Andreas >> Veithen<andreas.veit...@gmail.com> wrote: >>> Where does the InputStreamDataSource class come from? >>> >>> Andreas >>> >>> On Tue, Jun 16, 2009 at 08:55, Srinath Perera<hemap...@gmail.com> wrote: >>>> Hi All; >>>> >>>> If we create a OM Element that do have a OMText which includes binary >>>> content represented as a "DataHandler", that binary content disappear >>>> after someone do a toString() on the OM Element. Following code >>>> recreate the problem. Could someone help me figuring out the problem? >>>> >>>> Thanks very much >>>> Srinath >>>> >>>> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory(); >>>> OMNamespace ns = >>>> factory.createOMNamespace(ExpandingMessageFormatter.BINARY_CONTENT_QNAME.getNamespaceURI(), >>>> "ns"); >>>> OMElement omEle = >>>> factory.createOMElement(ExpandingMessageFormatter.BINARY_CONTENT_QNAME.getLocalPart(), >>>> ns); >>>> >>>> InputStreamDataSource ds = new InputStreamDataSource(in); >>>> DataHandler dataHandler = new DataHandler(ds); >>>> >>>> //create an OMText node with the above DataHandler and set optimized to >>>> true >>>> OMText textData = factory.createOMText(dataHandler, true); >>>> textData.setBinary(true); >>>> omEle.addChild(textData); >>>> >>>> System.out.println(omEle.toString()); >>>> System.out.println(omEle); >>>> >>>> -- >>>> ============================ >>>> Srinath Perera: >>>> WSO2 Inc. http://wso2.com >>>> Blog: http://srinathsview.blogspot.com/ >>>> >>> >> >> >> >> -- >> ============================ >> Srinath Perera: >> WSO2 Inc. http://wso2.com >> Blog: http://srinathsview.blogspot.com/ >> >
-- ============================ Srinath Perera: WSO2 Inc. http://wso2.com Blog: http://srinathsview.blogspot.com/