• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Requesting the method in the WS hangs

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get a image from the server directory which is tomcat under webapps to the client but no result it just keeps hanged
the code is:
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Toolkit.createImage is not a good way to load an image on the server; use javax.imageio.ImageIO.read instead.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where to store image1.jpg file
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I compiled the code I got the following error



C:\Documents and Settings\fa00064\My Documents\NetBeansProjects\WebApplication1>
javac -d . src\java\services\ImageService.java
src\java\services\ImageService.java:21: package com.sun.xml.ws.developer does no
t exist
wsContext.getMessageContext().put(com.sun.xml.ws.developer.JAXWSPropertie
s.MTOM_THRESHOLOD_VALUE, 0);
^
1 error

Can You tell me how to solve it?

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Where to store image1.jpg file


Wherever you want to. Just give ImageIO.read an absolute path to it.

package com.sun.xml.ws.developer does not exist


You'll need to add whatever jar file contains this package to the classpath during compilation, and also when running the code.
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Execuseme from where I got the jar files and how?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you're using classes that are part of the JAX-WS API, that's where I would start investigating. Maybe one of its jar files contains them.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

feda alshahwan wrote:Execuseme from where I got the jar files and how?


You can try this site to find the jar: http://javacio.us/
And this is the search result:
http://javacio.us/subscribers/classes/com.sun.xml.ws.developer.JAXWSProperties
 
feda alshahwan
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Than you for the useful link but when I saved it where it should be and how to include it in the compilation classpath?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you familiar with the "-classpath" switch, which is used both for compiling and for running Java code? It can be used to point to all the jar files required for code to execute.

On the server, put the jar file in the WEB-INF/lib directory.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic