views:

47

answers:

2

We are developing a Java web service(SOAP based) that has to return certain data along with an Image.

The web services are developed using MULE ESB. The consumer of the web service is a FLEX client.

The text data is returned as XML. But I'm not sure how the web service should return Image to the FLEX client.

As of now I can think of the following options:

Option 1: Store the image in a Tomcat server and give the URL to the client?!

Option 2: Convert the image as String and then let the client convert back?!

Or is there any other better option.

Kindly suggest.

thank you :)

+3  A: 

I would go for option 1, effectively pass by reference.

If you pass the image in the body of the web service message you will need to encode it as characters and the client will then need to decode the image. The character encoded image will nearly twice the binary size so this will slow down both the creation and the transmision of the message.

Most clients will not process a web service reply untll the entire message is received so this will further reduce the reponsiveness of the client.

Apart from anything else passing a URL will be simpler to code and debug.

James Anderson
A: 

If you use option 1 and your are generating the image dynamically, it will be difficult keep track of all the recently generated image and keeping the state... If you go for option 2 then you are nullifying the REST constraint (self-descriptive messages) of web services. So, Is it possible to use Internet media type with FLEX client?

yadab