IMHO I think you should go with the simplest protocal that meets the needs. Pure http request that returns the desired image.

It would be easy to implement give you some good controls.
XML-RCP would be a way to go if the client and app had to communitcate back and forth a few times to get the image created.

W/ http you can just document the parameters and send them out.
If the server reurns and image/jpeg then it worked, if it returned an text then there was an error. For additional server return info you can add some cookie to the response and read that from the response header.

Another thought is caching: If the same set of parameters always return the same image, then you can use http caching to improve your server performance.

You will also open up the possiblity of Javascript clients and give yourself a very easy means to test it.

-Aaron

Randy Heiland wrote:
Sure, it's simply a Python-wrapped visualization app that I want to interact
with remotely -- I send Python cmds to the app from a client, they get
executed, an image is generated and returned.  Because I want it to be
*interactive*, I'd don't want to write a jpeg file to disk, but simply keep it
in memory and return the binary stream.

I realize a big question is - what sort of protocol *should* be used.  The
answer is not a simple one, due in part to other groups/apps I'm trying to
interface with.  FWIW, I've used CORBA til now, but am dumping it, again, for
various reasons.

thanks for asking,
--Randy

On Jan 16, 11:34am, Aaron Held wrote:

Subject: Re: [Webware-discuss] Java xmlrpc client; binary data
Just out of curiosity can you describe that app again?
If all you want it to pull a jpeg it may be just easier to setup a
servelet that returns a jpeg based on HTTP request params.

In java its something like -( untested made up code):
import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {
	URL Webjpeg = new URL(
		"http://localhost/webKit/getImage?type=123&what=ever";);
	bis = new BufferedInputStream(
				new InputStreamReader(
				Webjpeg.openStream()));

	byte[] buff = new byte[2048];
	    int bytesRead;

        while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
        I forgot what to do here);
    }
}

Or in Python/Jthon a much more reasonable:

import urllib
Url="http://localhost/webKit/getImage?type=123&what=ever";
q = urllib.urlopen(Url)
retpage = q.read()

Or if its for a web page I'm sure it will be fewer lines of JavaScript

-Aaron

Randy Heiland wrote:

Any examples of sending/receiving binary data, e.g., a jpeg?

--Randy


-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by
implementing

SSL on your Apache Web Server. Click here to get our FREE Thawte Apache
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss
-- End of excerpt from Aaron Held




-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to