HPOSSOD 1.0 Technical Note
HP Web Services for Output Server 43
Using HP Web Services for Output Server
Sample clients
// Parse operational-attributes tag and get JobHandle
AttributeSet aset=parser.parseDocument("operation-attributes");
String jobHandle=aset.getValue("wsg-job-handle");
System.out.println("jobHandle : "+jobHandle);
/*WE can use this jobHandle to send multiple documents
*Here we are sending three documents
*/
/* Send Doc1*/
// create sendDocument Contract
String sendDocumentContract=
"<wsg-request>" +
/* In operation-attributes
*Add wsg-job-handle,last-document and document-checksum tags
*/
"<operation-attributes>" +
//Added job Handle(Mandatory)
"<wsg-job-handle>"+jobHandle+"</wsg-job-handle>" +
// add last-document=false(Not Mandatory)
"<last-document>false</last-document>"+
//Add MD5 checksum(Not Mandatory)
// Get MD5 Hash Value
"<document-checksum>"+getMD5Hex(doc1)+"</document-checksum>"+
"</operation-attributes>"+
/*request-attributes
*Document Attributes are added to request-attribute tag
*/
"<request-attributes>" +
//It is Mandatory
"<document-filename>file.txt</document-filename>" +// specify
only file name(here doc1=abc.txt)
"<copy-count>2</copy-count>"+
/* Add other document-attributes Here
*/
"</request-attributes>"+
"</wsg-request> ";
/* Create DocumentData Object and set file */
DocumentData doc1Data = new DocumentData();
DataHandler doc1_dh = new DataHandler(new FileDataSource(doc1));
doc1Data.setDocument(doc1_dh);
/* call HPOS Web Service Proxy and get Response*/
String sendDocumentResponse=port.sendDocument(sendDocumentCon-
tract,doc1Data);
//print sendDocument Request and response
System.out.println("sendDocumentContract 1 : "+sendDocumentContract);
System.out.println("sendDocumentResponse 1 : "+sendDocumentResponse);