Re: Webobjects WebServices - howto stream large Binary Objects
Marc Respass <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
WebObjects uses Apache Axis for WebServices. It looks like SOAP with
attachments is the way to g . Here's an article that may help (http://
www.devx.com/ibm/Article/20254). It looks like some work will need to
be done on the client side to retrieve the attachment. From the
article "Note that Listing 3 makes it clear that the attachment is
outside of the XML message! This is necessary for efficiency." This
looks interesting. Good luck. If you get it working and you want to,
post some sample code back :)
Marc
On Mar 28, 2006, at 9:10 AM, Kristof Cossement wrote:
> I want to use webobjects for creating webservices to send large
> binary files (eg a zipfile of 200Mb)
>
> This works for small data objects (like a jpg of 50kB)
> The problem is the data is not getting streamed, but the entire
> file is being read in memory, which causes stack overflows.
>
> Could someone give me a hint on how I can communicate through
> webservices with large binary data objects?
>
> This is an extract of the code I use:
>
> WebService Consumer (Project 1)
> ============================
>
> FileInputStream is = new FileInputStream("/path/to/file");
>
> NSData d = new NSData(is,1024); // CRASHES HERE !!!
>
> Object [] params = new Object[1];
> params[0] = d;
>
> WOWebServiceClient client = new WOWebServiceClient();
> // extra initialisation here
>
> Object result = client.invoke("FileUpload", "upload", params);
>
>
>
>
> This is the WebService (Project 2)
> ================================
> // I create a routine with an "NSData" parameter and register it as
> a webservice
>
> WOWebServiceRegistrar.registerWebService(FileUpload.class, true);
>
>
> import java.io.*;
> import com.webobjects.foundation.*;
>
> public class FileUpload {
> public static boolean upload(NSData d) {
>
> //OutputStream stream
> try {
> FileOutputStream fileOutputStream = new FileOutputStream("/tmp/
> file");
> d.writeToStream(fileOutputStream);
> fileOutputStream.close();
> }
> catch (IOException exception) {
> // Do something with the exception
> }
>
> return true;
> }
> }
>
>
>
>
>
>
>
> This e-mail, and any attachments thereto, is intended only for use
> by the addressee(s) named herein and may contain legally privileged
> and/or confidential information and/or information protected by
> intellectual property rights.
> If you are not the intended recipient, please note that any review,
> dissemination, disclosure, alteration, printing, copying or
> transmission of this e-mail and/or any file transmitted with it, is
> strictly prohibited and may be unlawful.
> If you have received this e-mail by mistake, please immediately
> notify the sender and permanently delete the original as well as
> any copy of any e-mail and any printout thereof.
> We may monitor e-mail to and from our network.
>
> NSS nv Tieltstraat 167 8740 Pittem Belgium
>
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev