XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new
FileReader(inputFile)); OMXMLParserWrapper builder =
OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
parser); OMElement xmlDocElement = builder.getDocumentElement(); This assumes that “inputFile” is a java.io.File. This code can
be found at: http://ws.apache..org/axis2/0_95/OMTutorial.html -----Original Message----- Hi Ajith, thanks for your reply. My questions, actually, is: In the MTOM sample application, the client has this metho private OMElement createEnvelope(String fileName) throws Exception { DataHandler expectedDH; OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs =
fac.createOMNamespace("http://localhost/my", "my"); OMElement data = ""
omNs); OMElement image = fac.createOMElement("image", omNs); Image expectedImage; expectedImage = new ImageIO() .loadImage(new FileInputStream(inputFile)); ImageDataSource dataSource = new
ImageDataSource("test.jpg", expectedImage); expectedDH = new DataHandler(dataSource); OMText textData = fac.createOMText(expectedDH, true); image.addChild(textData); OMElement imageName = fac.createOMElement("fileName",
omNs); if (fileName != null) { imageName.setText(fileName); } //OMElement wrap = fac.createOMElement("wrap",omNs); // data.addChild(image); data.addChild(imageName); data.addChild(image); //data.addChild(wrap); return data; } If I need to send something different from an image, what function should I call instead of Image expectedImage; expectedImage = new ImageIO().loadImage(new
FileInputStream(inputFile)); FileOutputStream imageOutStream = new FileOutputStream(fileName); new ImageIO().saveImage("image/jpeg", actualObject,
imageOutStream); ? And on the server side, what function should I call instead of Image actualObject = new ImageIO().loadImage(actualDH.getDataSource() ..getInputStream()); ? Thanks, Michele Ajith Ranabahu wrote: > Hi, > As far as the content is concerned the zip file is a
"binary" file > just like the image file. All you have to do is read the file
through > a file input stream and then create a new DataSource using that > inputstream. > > Ajith > > > On 5/4/06, Michele Mazzucco <[EMAIL PROTECTED]>
wrote: >> Hi all, >> >> the tutorial show how to send images with MTOM, but how can I
send >> binary files with MTOM (say .zip files)? >> >> Thanks in advance, >> Michele >> > > > -- > Ajith Ranabahu
|
- [Axis2] MTOM & binary content Michele Mazzucco
- Re: [Axis2] MTOM & binary content Ajith Ranabahu
- Re: [Axis2] MTOM & binary content Michele Mazzucco
- Re: [Axis2] MTOM & binary content Ajith Ranabahu
- RE: [Axis2] MTOM & binary content Michael Robinson
- Re: [Axis2] MTOM & binary content Michele Mazzucco
- RE: [Axis2] MTOM & binary content Michael Robinson
- Re: [Axis2] MTOM & binary content Michele Mazzucco
- RE: [Axis2] MTOM & binary content Michael Robinson