Skip to main content

(WSIT)Holder as Return Parameter? How to transfer files?

7 replies [Last post]
daniel_manzke
Offline
Joined: 2007-06-26
Points: 0

Hi there,

I've read a lot of examples how to "Upload files", but I can't find an example how to download large files.
I thought about to use something like:

public Holder download() or
public Holder download() but it didn't work.

Maybe I should use:
public void download(Holder out).

I've also read a lot of the problem with huge data so it would be the best for me if I can use Streams. And all this unser WSIT ;)

But what is the right way?

Please help!

Greets,
Daniel

Message was edited by: daniel_manzke

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
daniel_manzke
Offline
Joined: 2007-06-26
Points: 0

I build the example you suggested, but have one question. The port at the client side has as a parameter Holder. When I built it I have Holder because he always map DataHandler to byte[]. And I can't see any other annotations or something like that.

Greets,
Daniel

jitu
Offline
Joined: 2003-06-14
Points: 0

See the WSDL in the mtom-large. It contains

So "data" is mapped as DataHandler. If you have byte[] in the signature, you will be limited by JVM's heap.

daniel_manzke
Offline
Joined: 2007-06-26
Points: 0

Is there a chance to set this per annotation? Because I don't start with wsdl first and want to set this property in the code.

But thanks for your help so far. ;)

Ok I changed the xsd for my webservice and now it works.
One more question please.

I can't find this class.
com.sun.xml.ws.developer.StreamingDataHandler
What's version I need for it? Is there a chance to become WSIT with a 2.1.3 nightly build?

Message was edited by: daniel_manzke

philion
Offline
Joined: 2003-06-10
Points: 0

I am looking for the same thing: Streaming large attachments, both upload and download, using annotations.

I've noticed the StreamingDataHandler as well, which looks new.

What's the release schedule for 2.1.3?

daniel_manzke
Offline
Joined: 2007-06-26
Points: 0

Hi jitu,

I can't find this class.
com.sun.xml.ws.developer.StreamingDataHandler

Is it new in 2.1.3?

Another Question. In the example the Holder class is used. Is it right that I only need it, when I want to have a pseudo "Pass-By-Reference"?(INOUT/OUT)

In my scenario the application takes for uploading only a InputStream[]
and when I will download something I have to send a InputStream.

For downloading I thought that I could send a source. Like:

return new StreamSource(myInputStream).

I know that Source is for XML but could I use it for byte64?

The other Idea is like in your example to use the DataHandler.
So I could do it like that:

final InputStream result = userConnection.readDocument(documentID, currentRevision, elementNumber);
//return new StreamSource(result);
return new DataHandler(new DataSource() {
public String getContentType() {
return "application/*";
}
public InputStream getInputStream() throws IOException {
return result;
}
public String getName() {
return "";
}
public OutputStream getOutputStream() throws IOException {
throw new IOException("Unsupported");
}
});

Or my last Idea ;):

Is it better if I have a method like that:

public void download(Holder content)

When the client now wants to call the method, he will create a Holder and pass it to my webservice. Then I could call DataHandler.setInputStream(downloadStream). Then my method ends and the client could call the getInputStream Method to save the data.

I'm a little bit confused. ;)

Greets,
Daniel

jitu
Offline
Joined: 2003-06-14
Points: 0

See "mtom-large" sample in 2.1.3 nightly distributions.

daniel_manzke
Offline
Joined: 2007-06-26
Points: 0

FORGET this post ;) but I didn't find the delete button :D

Hi Jitu,

thanks for your reply. I downloaded the JAX-WS 2.1.x nighlty build. There was a example but not the one you and I expected.

Under the mtom-large path there was the one with only one class at the client and one class at the server-side.

I got my 2.1.x from here:
https://jax-ws.dev.java.net/servlets/ProjectDocumentList?folderID=6020&e...

Greets,
Daniel

Message was edited by: daniel_manzke