aspose file tools*
The moose likes Web Services and the fly likes Sending and receiving a file through webservive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Sending and receiving a file through webservive" Watch "Sending and receiving a file through webservive" New topic
Author

Sending and receiving a file through webservive

ashok ballu
Ranch Hand

Joined: Sep 17, 2007
Posts: 30
Hi !
I am trying to send a file using webservice using JAX-RPC,
But at the client side, I am not able to read the file,

could you please give sample application..............


ASHOK BALLU SCJP1.5 SCWCD1.5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
How are you sending the file - as a SAAJ attachment? Encoded as ASCII as part of the message content? Some other way? TellTheDetails, possibly showing some relevant code excerpts.


Ping & DNS - my free Android networking tools app
ashok ballu
Ranch Hand

Joined: Sep 17, 2007
Posts: 30
Thank you for your reply..........

my code is :

@WebMethod(operationName = "getDocument")
public File getDocument() {
//TODO write your implementation code here:
File f= new File("/home/bashok/Desktop/chaitu_resume.doc");
return f;
}
Just Iam sending a document
[ July 24, 2008: Message edited by: ashok ballu ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
File is not a type that can be transferred over WS; it has meaning only on the machine where it is defined. You need to define a method that returns the actual file contents in a way that's compatible with SOAP, e.g. a base-64-encoded String of the byte[] of the file contents.
ashok ballu
Ranch Hand

Joined: Sep 17, 2007
Posts: 30
Thank you ,

could please try to give any sample example for sending file, because I am new to SOA
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
If the approach I outlined isn't what you're looking for, you might want to read the articles "Transferring files over a web service" and "Sending SOAP attachments with JAX-RPC" that are linked in the http://faq.javaranch.com/java/WebServicesFaq
pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65
If you are using Axis for web services. you can use DataSource.


Pradeep.Jaladi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
Originally posted by pradeep jaladi:
If you are using Axis for web services. you can use DataSource.

You need to be more specific. A DataSource class exists in both the javax.sql and javax.activation packages. While only the latter makes sense in this context, the connection to Axis still isn't clear - please provide mode details about the solution you're proposing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending and receiving a file through webservive