Thanx for your response Vy. Looking at the example you sent me, it
seems like it uses RPC style messaging (am I correct?). My project is
using document-style messaging, so some help with that would be great.
I tried following the attachments sample that comes with axis but it
only works for text attachments.
Also, another question I had is how do I disable axis from writing what
it recieves to the console/screen on the server side (this might be the
problem as you pointed out that the beeps are from binary being written
to screen).
Again....thank you very much for taking the time to help me out
-----Original Message-----
From: Vy Ho [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 30, 2004 2:47 PM
To: [EMAIL PROTECTED]
Subject: Re: desperate newbie-- trouble with image attachment
This should not be too hard.
Let's take 5 to 10 minutes to get it to work.
1) start with an interface:
public interface ImageService{
public void sendImage(DataHandler data);
}
save that to a file named ImageService.java
Also, add proper package for the class and import statements for
DataHandler.
2) Use Java2Wsdl to generate the Wsdl file. You can open and see if it
work or not.
3) Use Wsdl2Java to generate all the stubs and whatnots.
4) Implement your sever:
public void sendImage(DataHandler data){
try{
//data.getInputStream();
//the above is the binary data for your image, save it to
file, or do whatever it takes. Do
//not print it out to the screen, because you'll get alot
of beeps.
}catch(Exception e){
e.printStackTrace();
}
}
5) Deploy the server by compiling all your stuffs, copy to the server's
classes directory and also copy the content of deploy.wsdl to the axis
config file.
6) Write the client:
public void send myStuff(String imageFileName){
try{
DataHandler data = null;
FileDataSource fds = new FileDataSource(imageFileName);
//assume it's in a file for now, play with it if it's not
data = new DataHandler(fds);
ImageService service = null;
//Create a new service locator for ImageService , note that
this is generated by Wsdl2Java
//set the server's address:
//set whatever thing you need such as document or whatever, this
is optional, after getting this to work, do this later.
//call the service
service.sendImage(data);
}catch(Exception e){
}
}
Note that I haven't test this code, but it should work with minor twist.