iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Tags
j2me, java, mobile, svg

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-07-2009, 04:22 AM
sparshpolly's Avatar
WebProWorld Pro
 
Join Date: Jan 2004
Location: Singapore
Posts: 156
sparshpolly RepRank 0
Lightbulb Java Web Services Returning SVG Image

Hi

I am creating a J2ME application which needs to generate dynamic charts for the user.

The data for generating the charts is stored on a web server. In order to have minimal computations on the mobile device, I want to generate the charts on the web server itself.

I have written a code which generates svg (svg tiny) charts dynamically on a web server based on sql queries on a database . Now I want a J2ME client app to be able to retrieve this data through a web service.

Can someone guide me as to how to return svg files from a java web service.

Any help would be greatly appreciated.

Regards
Sparsh
__________________
[url=http://sparshpolly.blogspot.com]My blog [\url]
Reply With Quote
  #2 (permalink)  
Old 06-08-2009, 09:05 PM
emps's Avatar
WebProWorld Member
 
Join Date: Jul 2008
Location: Brisbane,Qld.Australia
Posts: 44
emps RepRank 1
Default Re: Java Web Services Returning SVG Image

mm..not sure about this, you want the java server to serve your svg files in xml format?
__________________
I climb high mountains,dive deep seas. I ride wild horses and fight enemies. When not doing all those things i sit quietly with a nice cup of tea.
Reply With Quote
  #3 (permalink)  
Old 06-08-2009, 11:24 PM
sparshpolly's Avatar
WebProWorld Pro
 
Join Date: Jan 2004
Location: Singapore
Posts: 156
sparshpolly RepRank 0
Default Re: Java Web Services Returning SVG Image

yes, that would be one way to look at the problem.

Or if there is another way to return svg's from the web service would also work for me.
__________________
[url=http://sparshpolly.blogspot.com]My blog [\url]
Reply With Quote
  #4 (permalink)  
Old 06-09-2009, 10:31 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,629
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Java Web Services Returning SVG Image

I can see a few different solutions to this situation, but I am not quite clear on the implementation you have in mind. Is the image being generated and then stored somewhere on the server, waiting for the user to request it, or is the image to be generated dynamically at the time the user requests it?

In either case, honestly I think the actual image would exist outside the web service as a distinct entity on the server, either as a static file or an image generation program. The web service would simply give the client a link to request the image. The server would then deliver the static image or generate and deliver a live image.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #5 (permalink)  
Old 06-09-2009, 03:03 PM
sparshpolly's Avatar
WebProWorld Pro
 
Join Date: Jan 2004
Location: Singapore
Posts: 156
sparshpolly RepRank 0
Default Re: Java Web Services Returning SVG Image

Quote:
I can see a few different solutions to this situation, but I am not quite clear on the implementation you have in mind. Is the image being generated and then stored somewhere on the server, waiting for the user to request it, or is the image to be generated dynamically at the time the user requests it?

In either case, honestly I think the actual image would exist outside the web service as a distinct entity on the server, either as a static file or an image generation program. The web service would simply give the client a link to request the image. The server would then deliver the static image or generate and deliver a live image.
Hi

Thanks a lot for your reply. Here is one solution that I managed to implement :

I generated the image within my java code when the web service method was called (there are some parameters that I need to customize the image with - hence the dynamic generation.) I saved the image xml in a string and returned the string. Then on the mobile client using the image I converted the string to a byteInputStream and displayed it.

I think if I just create a file on my server and send it across, it should by default go as a stream of bytes - but am not too sure how to do that. And as of now, I don't see any effeciency gain in creating a file over a simple string object.

Quote:
The web service would simply give the client a link to request the image. The server would then deliver the static image or generate and deliver a live image.
Can you please elaborate on returning a link to request the image ? What I am doing is directly returning the image as a stream of bytes from the web service.

Moreover, I need to generate dynamic graphs for my web service. Do you have any suggestions on how this could be done effeciently without having to create the whole image every single request ? Like does svg support something like parameters to modify charts ?

Thank you for your help

Sparsh
__________________
[url=http://sparshpolly.blogspot.com]My blog [\url]
Reply With Quote
  #6 (permalink)  
Old 06-09-2009, 03:53 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,629
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Java Web Services Returning SVG Image

Yeah, that does sound like the best solution if you are talking to your own client.
Quote:
Can you please elaborate on returning a link to request the image ? What I am doing is directly returning the image as a stream of bytes from the web service.
I was actually thinking of this more as something that could also be accessed by a web browser - I take it from this description, it would only be communicating with your Java client. In that case you can pass more information in the data stream. With a web browser client, you would have to respond to each request seperately - one for the page, and another for the image.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #7 (permalink)  
Old 06-09-2009, 03:58 PM
sparshpolly's Avatar
WebProWorld Pro
 
Join Date: Jan 2004
Location: Singapore
Posts: 156
sparshpolly RepRank 0
Default Re: Java Web Services Returning SVG Image

would you happen to know a way by which i could modify an existing SVG Chart (Line Chart / Bar Chart) without having to replot the points through my code ? Does SVG Support parameter driven charting ??
__________________
[url=http://sparshpolly.blogspot.com]My blog [\url]
Reply With Quote
  #8 (permalink)  
Old 06-09-2009, 05:31 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,629
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Java Web Services Returning SVG Image

That unfortunately I don't know.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java code for scrolling image banner griffygirl74 Web Programming Discussion Forum 1 03-24-2007 12:56 PM
google returning 200 ok header on 404 page pagetta Web Programming Discussion Forum 9 03-01-2007 05:22 AM
Percentage Returning Visitors Gert Leroy Google Discussion Forum 12 09-20-2006 05:12 AM
Using SEO to Keep Customers Returning WPW_Feedbot Search Engine Optimization Forum 0 05-04-2005 03:30 PM


All times are GMT -4. The time now is 12:33 PM.



Search Engine Optimization by vBSEO 3.3.0