How about

java.util.zip.ZipInputStream(actualDH.getInputStream());

Best regards,
Guenter


> -----Original Message-----
> From: Antony Grinyer [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 12, 2005 6:42 PM
> To: axis-user@ws.apache.org
> Subject: Newbie: Recreating Zip file in MTOM service class?
> 
> Hi,
> 
> Being an axis2 newbie, I've managed to create an MTOM client and
> service, passing a Zip file to the service, however I'm unsure what to
> do at the service end to recreate the zip? The example on the axis2
> website just shows what to do with an image. Here's snippets 
> of my code:
> 
> CLIENT:
> 
> << snip >>
> 
> OMElement zip = fac.createOMElement("zip", omNs);
>  
> File file = new File(filePath);
> 
> byte[] bytes = new byte[(int)file.length()];
> bytes = BDBXMLUtils.getBytesFromFile(file);
> ByteArrayDataSource dataSource = new ByteArrayDataSource(bytes);
> dataHandler = new DataHandler(dataSource);
> OMText textData = fac.createText(dataHandler, true);
> zip.addChild(textData);
> 
> << snip >>
> 
> The do all the client calls to the addDocumentsAsZip web 
> service method.
> 
> SERVICE:
> 
> public OMElement addDocumentsAsZip(OMElement element)
>     throws XMLStreamException
>   {
>     OMFactory fac = OMAbstractFactory.getOMFactory();
>     OMNamespace omNs =
> fac.createOMNamespace("http://some.namespace/anything";, "anything");
> 
>     OMElement zipEle = element.getFirstElement();
>     OMElement zipName = (OMElement) zipEle.getNextSibling();
>     OMText binaryNode = (OMText) zipEle.getFirstChild();
>     String fileName = zipName.getText();
> 
>     DataHandler actualDH = (DataHandler)binaryNode.getDataHandler(); 
> 
>     // Now, how do I get the data back into a zip?
> 
> << snip >>
> 
> I know there's the Java util.zip package but how do I recreate my zip
> from the DataHandler?
> 
> Any help gratefully appreciated.
> Thanks,
> Antony
> 
> 
> 

Reply via email to