-
Type: New Feature
-
Status: Closed
-
Priority: Minor
-
Resolution: Won't Fix
-
Affects Version/s: 5.2 M1
-
Fix Version/s: 5.2 M4
-
Component/s: None
-
Environment:JAXWS2.1.2-20070917, MTOM 1.0
The MTOM technology allows to send over SOAP the binary data as inline attachments. This improves the performance with around 33%. But the data are sent as one packet, no matter how big they are.
I tried to send a 700MB file. Couldn't: after minutes when memory consumption grew with 500MB, it started to bounce up and down with 200MB. I killed process, it is clear it is not the way. In order to overpass this I see 3 solutions:
1. Implement a kind of streaming in Stateful Web Service. Because it is stateful, the Stream can be kept as internal member and feed the client upon request with chunks of data (extended API required).
2. Save the file on HDD and make it available through an URL to the customer (I believe this is worse than previous: extra HDD required, bug prone because extra storage used, etc)
3. I saw that people are recommending StAX for streaming over XML. I heard people saying it can be solution for MTOM streaming. StAX might help in streaming over the net, but the API si far too complicated to allow a clean solution / stable solution.
Regarding solution 1, a possible API could be like:
Snippet only on the upload content
/**
- Opens a blob property content as a InputStream. The property is named by the fieldName.
- @param repo
- @param docRef has to be not null
- @param fieldName has to be not null
- @return if the stream was open
- @throws ClientAuthenticationException
- @throws ItemNotFoundException
- @throws ServerProcessingException
*/
public abstract boolean openFile(String repo, String docRef, String fieldName)
throws ClientAuthenticationException,
ItemNotFoundException, ServerProcessingException;
/**
- Gets a chunk from a blob property content (previously open as InputStream).
- @param chunk OUT parameter filled with the bytes read from stream
- @return the number of bytes filled
- @throws ClientAuthenticationException
- @throws ItemNotFoundException
- @throws ServerProcessingException
*/
public abstract int getChunk(Holder<byte[]> chunk)
throws ClientAuthenticationException,
ItemNotFoundException, ServerProcessingException;
This method reads from the open InputStream at most the length of supplied byte array. Returns the number of read bytes. If the stream wasn't previously successfully open, an exception is thrown. Only one stream can be open at one time.
- depends on
-
NXP-1720 Implement LiveEdit Web Service on top of JAXWS
- Resolved