feda alshahwan wrote:I think that using REST for consuming and producing web services by mobiles is better. But since I know nothing about mobile applications and REST. So How can I start doing it please?
I would like to create a web service that takes numbers from client that corresponds to jpg files and returns html page that contains the chosen jpg's . What is the best way to depelop it ?thankyou
The scenario is changed as follows: client send numbers from 1-5 it can be one number or 2 or three choices server send the pictures corresponding to the chosen numbers
Ulf had pointed out in the
other topic that an HTML page doesn't contain the images but only links to it. A web browser will open a separate connection for each image and download it separately - nice and simple.
So you have to ask yourself - is the benefit of downloading multiple images with a single request worth the overhead and complexity of dealing with
SOAP and MTOM on the mobile consumer end? Wouldn't it make sense to give each image its own URL and simply download them separately - as images? Those requirements can be filled with a simple
servlet implementation. You could even use
Jersey if you really wanted to. Here is a quick and dirty proof of concept that I slapped together two months ago.
Tomcat 6.0.18 at
C:\opt\tomcat
Jersey at
C:\opt\tomcat\jersey\lib (
asm-3.1.jar,
jersey-core-1.0.1.jar,
jersey-server-1.0.1.jar,
jsr311-api-1.0.jar).
Modified
C:\opt\tomcat\conf\catalina.properties line to
shared.loader=C:/opt/tomcat/jersey/lib/*.jar
C:\opt\tomcat\webapps\helloimages\WEB-INF\ImageStore.java
You'll have to supply your own dontcare.png, happy.png, grumpy.png, thrilled.png images.
C:\opt\tomcat\webapps\helloimages\WEB-INF\ImageOutStreamer.java
C:\opt\tomcat\webapps\helloimages\WEB-INF\web.xml
C:\opt\tomcat\webapps\helloimages\WEB-INF\c.bat
Open a console window and change directory to
C:\opt\tomcat\webapps\helloimages\WEB-INF and compile by running
c.bat. Start up Tomcat and point your browser to
http://localhost:8080/helloimages/12345678/image
http://localhost:8080/helloimages/87654321/image
http://localhost:8080/helloimages/12348765/image
http://localhost:8080/helloimages/87651234/image
to see the different images.
The next step would be to support the HTTP PUT method to overwrite the existing images with new ones ...