HPOSSOD 1.0 Technical Note
HP Web Services for Output Server 48
Using HP Web Services for Output Server
Sample clients
byte[] b=null;
long offset=0;
int i=0;
int av=0;
int bt=1;
while((av=is.available())>0){
chunkSize=(av<chunkSize)?av:chunkSize;
b=new byte[chunkSize];
File temp=File.createTempFile("temp","chunk");
OutputStream os=new FileOutputStream(temp);
is.read(b,0,chunkSize);
os.write(b,0,chunkSize);
os.close();
boolean lastChunks=false;
if(bt==chunks) lastChunks=true;
sendChunk(temp.getPath(),docHandle,offset,lastChunks,checkSum);
temp.delete();
offset+=b.length;
bt++;
i++;
}
System.out.println("total chunks="+i);
is.close();
}
/** sends chunk of Document
*@param chunkFilePath Chunk FilePath
*@param docHandle Document Handle
*@param chunkOffset offSet
*@lastChunk if it is true Its delivers Job to Destination(s) that are
specified in Job Contract
*@checkSum Perform checkum
*/
public String sendChunk(
String chunkFilePath,
String docHandle,
long chunkOffset,
boolean lastChunk,
boolean checkSum)
throws Exception{
String chunkContract=
"<wsg-request>" +
"<operation-attributes>" +
//Mandatory
"<wsg-doc-handle>"+docHandle+"</wsg-doc-handle>" +
//Mandatory
"<document-chunk-offset>"+chunkOffset+"</document-chunk-off-
set>"+
"<last-chunk>"+lastChunk+"</last-chunk>" ;