Technical Note Using HP Web Services for Output Server HP Web Services for Output Server is an application that enables HP Output Server job management, document transfer, and delivery pathway management remotely through SOAP over HTTP protocol.
Using HP Web Services for Output Server Limitations Limitations When the HP Web Services for Output Server installation process is interrupted, the installer does not remove the files and directories created during the installation. You can use some special characters that are passed to Web Services for Output Server in the form of XML.
Using HP Web Services for Output Server HP Web Services for Output Server configuration You must specify WSGRealm as the value for the LOGIN_MODULE in the wsg.properties file. The following example illustrates how to pass credentials and submit a job in a single session. URL endpoint = new URL("http://"++":"+ + "/HPOSGateway/HPOSGateway?wsdl"); QName qname = new QName("http://wsg.hpos.om.hp.
Using HP Web Services for Output Server Managing the JBoss server The JBoss installer uses param name=MaxBackupIndex parameter with a default value of 5. If the maximum number of files exceeds the default value, the oldest file gets removed. You can set the MaxBackupIndex parameter to 20 and the default file size to 10 MB. You can view the settings in the JBoss_HOME/server/default/conf/jboss-log4j.xml file as follows: PAGE 5Using HP Web Services for Output Server Job management functions For UNIX: installDir/share/jboss/bin/shutdown.sh For Windows: net stop HPSOD To enable HP Web Services for Output Server, you must restart the JBoss server. To restart the JBoss server, execute the following command: For UNIX: installDir/share/jboss/bin/startup.
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a deliverJob request: labld_file1 invoice.
Using HP Web Services for Output Server Multiple-document print failure pre-processing labld_ps1 - 0 success jqm:867208 pre-processing labld_file - 0 success
Using HP Web Services for Output Server Multiple-document print failure 1. XML createJob contract Response- createJobResponse object Table 1-2.
Using HP Web Services for Output Server Multiple-document print failure This API allows you to send multiple documents. For the last document, you must set the last-document tag value to true. When the value is set to true, the documents can be sent for delivery. Table 1-3.
Using HP Web Services for Output Server Multiple-document print failure Web Service Name: createJobs Web Service Parameters: Parameter 1 - XML createJobs contract Table 1-4. createJobs attributes Type Name Value Operation Destination HP Output Server logical destination Operation Job attributes All job attributes in HP Output Server such as job-owner, -job-name, and -copy-count For .NET clients, Input param- createJobs object createJobs will have only one argument. 1.
Using HP Web Services for Output Server Multiple-document print failure Parameter 1 - XML createDocuments contract Table 1-5. createDocuments attributes Type Name Value Operation wsg-job-handle Handle returned from createJobs API Operation last-document True or False Request document-filename Filename For .NET clients, Input param- createDocuments object createDocuments object will have only one argument. 1.
Using HP Web Services for Output Server Multiple-document print failure Parameter 2 - DocumentData Table 1-6. sendChunks attributes Type Name Value Operation wsg-doc-handle document handle returned from createDocument Operation last-chunk True or False Operation document-checksum MD5 hash created for the document Operation document-chunkoffset Positive integer API For .NET clients, Input param- sendChunks object sendChunks object will have two arguments. 1. XML sendChunks contract 2.
Using HP Web Services for Output Server Multiple-document print failure Parameter 1 - XML queryJobs contract For .NET clients, Input param- queryJobs object queryJobs will have only one argument. 1. XML queryJobs contract Response- queryJobsResponse object Users are authorized at the HP Output Server level to query jobs. This API achieves the same functionality as the pdq command on HP Output Server. Table 1-7.
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a queryJobs response: 0 success has-more-chunks false dlm:1:72 0 success 0
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a querySubJobs request: 100 jqm:2530598 job-owner The following is an example of a querySubJobs response: 0 success
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a querySubJobs response on a destination: 0 success has-more-chunks false retained labld_ps jqm:2530598
Using HP Web Services for Output Server Multiple-document print failure cancelJobswill have only one argument. 1. XML cancelJobs contract Response - cancelJobsResponse object Users are authorized at the HP Output Server level to cancel jobs. Canceling a job stops the delivery of the job including all subjobs. No request attribute is passed for the cancelJobs functionality. The operation attribute is a DLM job ID, and you can cancel multiple DLM jobs at the same time.
Using HP Web Services for Output Server Multiple-document print failure Canceling a subjob stops the delivery of the related job and all subjobs in it. Users are authorized at the HP Output Server level to cancel subjobs. No request attribute is passed for the cancelSubJobs functionality. The operation attribute is a JQM job ID, and can you cancel multiple JQM jobs at the same time. The response returns all the subjobs that are canceled.
Using HP Web Services for Output Server Multiple-document print failure Users are authorized at the HP Output Server level to modify jobs. The operation attributes set for modifyJobs store the job IDs. The job IDs are DLM job IDs and hold the attributes representing the destinations. Multiple DLM job IDs can be sent as part of the operation attributes. You can use new job attributes or modify the existing attributes to modify the jobs. Table 1-11.
Using HP Web Services for Output Server Multiple-document print failure Pausing jobs The pauseJobs API is used to pause HP Output Server jobs. The structure of the API is: Web Service Name: pauseJobs Web Service Parameters Parameter 1 - XML pauseJobs contract For .NET clients, Input param- pauseJobs object pauseJobs will have only one argument. 1.
Using HP Web Services for Output Server Multiple-document print failure Web Service Parameters Parameter 1 - XML pauseSubJobs contract For .NET clients, Input param- pauseSubJobs object pauseSubJobs will have only one argument. 1. XML pauseSubJobs contract Response- pauseSubJobsResponse object You can pause a subjob when it is in the pre-processing, document-transfer-pending, transferring, pending, or interrupted job state.
Using HP Web Services for Output Server Multiple-document print failure 1. XML resumeJobs contract Response- resumeJobsResponse object You can resume a job when the job state is paused. Resuming a job allows it to be processed to completion. Users are authorized at the HP Output Server level to resume jobs. This API achieves the same functionality as the pdresume command on HP Output Server. The operation attribute is a DLM job ID. Table 1-14.
Using HP Web Services for Output Server Multiple-document print failure You can resume subjobs when the job state is paused. Resuming a subjob allows it to be processed to completion. Users are authorized at the HP Output Server level to resume subjobs. The operation attribute is a JQM job ID. Table 1-15.
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a pauseObjects request: queue qmail The following is an example of a pauseObjects response: 0 success 0 success
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a resumeObjects response: 0 success 0 success Resubmiting jobs The resubmitJobs API is used to resubmit one or more jobs to the same or a different destination.
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a resubmitJobs request: dlm:0:103 lmail hpom The following is an example of a resubmitJobs response: 0 success
Using HP Web Services for Output Server Multiple-document print failure Querying objects The queryObject API is used to list subjob or object attributes. The structure of the API is: Web Service Name: queryObject Web Service Parameters Parameter 1 - XML queryObject contract This API achieves the same functionality as the pdls command on HP Output Server. Table 1-19.
Using HP Web Services for Output Server Multiple-document print failure The following is an example of a queryObjects response: 0 success has-more-chunks false labpd_ftp 0 success HP Web Service
Using HP Web Services for Output Server Delivery pathway management functions Delivery pathway management functions HP Web Services for Output Server supports creating, deleting, enabling, and disabling objects. Creating objects The createObjects API is used to create a delivery pathway object such as a queue or a destination. The structure of the API is: Web Service Name: createObjects Web Service Parameters Parameter 1 - XML createObjects contract Table 1-20.
Using HP Web Services for Output Server Delivery pathway management functions The following is an example of a createObjects response: 0 success 0 success Deleting objects The deleteObjects functionality is used to delete a Delivery Pathway Object such as a queue or a destination.
Using HP Web Services for Output Server Delivery pathway management functions Enabling objects The enableObjects API is used to enable a delivery pathway object such as a queue or a destination. The structure of the API is: Web Service Name: enableObjects Web Service Parameters Parameter 1 - XML enableObjects contract For .NET clients, Input param- enableObjects object enableObjects will have only one argument. 1. XML enableObjects contract Response- enableObjectsResponse object Table 1-22.
Using HP Web Services for Output Server Document transfer functions Parameter 1 - XML disableObjects contract Table 1-23. disableObjects attributes Type Name Value Operation class Queue printer Operation object-name Name of the object in the specified class For .NET clients, Input param- disableObjects object disableObjects will have only one argument. 1.
Using HP Web Services for Output Server SSL Document chunking is transferring a large file in smaller chunks. The client and the server must agree upon the chunk size of the document. For example, a document of 2 GB can be broken into chunks of 20 KB each. The server assembles the chunks, creates the original file, and persists it into a unique (named as session ID) user folder.
Using HP Web Services for Output Server SSL import java.security.cert.*; import javax.net.ssl.*; public class InstallCert { public static void main(String[] args) throws Exception { String host= ""; int port = ; char[] passphrase; String p="changeit"; passphrase = p.toCharArray(); File file = new File("jssecacerts"); System.out.println("file path="+file.getAbsolutePath()); if (file.isFile() == false) { char SEP = File.separatorChar; File dir = new File(System.getProperty("java.
Using HP Web Services for Output Server SSL System.out.println("Starting SSL handshake..."); socket.startHandshake(); socket.close(); System.out.println(); System.out.println("No errors, certificate is already trusted"); } catch (SSLException e) { e.printStackTrace(System.out); } X509Certificate[] chain = tm.chain; if (chain == null) { System.out.println("Could not obtain server certificate chain"); return; } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.
Using HP Web Services for Output Server SSL String alias = host + "-" + (k + 1); ks.setCertificateEntry(alias, cert); OutputStream out = new FileOutputStream("jssecacerts"); ks.store(out, passphrase); out.close(); System.out.println(cert); System.out.println("Added certificate to keystore 'jssecacerts' using alias '"+ alias + "'"); } private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray(); private static String toHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.
Using HP Web Services for Output Server Sample clients } } You must change the host and the specified port in the code to import the certificate, and you must specify the file on the client to which you want the Public key information to be written. Therefore, use the file in Web Service client program to invoke the Web Services for Output Server through SSL.
Using HP Web Services for Output Server Sample clients using WSGClient.HPOMWS;//Web reference An example of a portion of the client API on C Sharp for is as follows: class ClientProgram { // create a Web service proxy stub static HPOSGatewayService service = new HPOSGatewayService(); static void Main(string[] args) { //create an instance of class querySubJobs querySubjobs subjob = new querySubjobs(); //specify the argument as the contract job.
Using HP Web Services for Output Server Sample clients */ package wsgclientexample; import import import import import import import import import import import import import import import import import java.net.URL; java.util.Map; javax.xml.namespace.QName; javax.xml.ws.BindingProvider; javax.xml.ws.soap.SOAPBinding; com.hp.om.hpos.wsg.client.pxoxy.HPOSfor Output Server; com.hp.om.hpos.wsg.client.pxoxy.HPOSGatewayService; com.hp.om.hpos.wsg.client.pxoxy.DocumentData; java.io.File; java.io.
Using HP Web Services for Output Server Sample clients vice"); /* Get HP Web Services for Output Server Proxy */ port = new HPOSGatewayService(endpoint_new, qname).getHPOSGatewayPort(); bp=(BindingProvider)port; SOAPBinding binding = (SOAPBinding)bp.getBinding(); /* enable MTOM */ binding.setMTOMEnabled(true); map = bp.getRequestContext(); /* Pass the User Credentials like this (sets in HTTP Headers)*/ map.put(BindingProvider.USERNAME_PROPERTY,user); map.put(BindingProvider.
Using HP Web Services for Output Server Sample clients client.deleteObject(); } /** * Delivers a single document with job attributes and document attributes * in a single Web Service request
* The deliverJob(String contract) service of HP Web Services for Output Server is *called.
Using HP Web Services for Output Server Sample clients } /** Delivers Single(or Multiple) Documents across sessions
* Steps
* 1)Create jobContract with all job attributes
* 2)Use createJob(String jobContract) service and it return's Job Handle
* Use this Job Handle to send Multiple Documents
* 3)Create DocumentContract(set job handle in tag)
* 4) Use sendDocument(String documentContract) service (Single or )multiple times
*/ public void sendMultipleDocuments()throws
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.
Using HP Web Services for Output Server Sample clients // send Doc1 complete /* Send Doc2*/ // create sendDocument Contract sendDocumentContract= "" + /* In operation-attributes *Add wsg-job-handle,last-document and document-checksum tags */ "" + //Added job Handle(Mandatory) ""+jobHandle+"" + // add last-document=false(Not Mandatory) "false"+ //Add MD5 checksum(Not Mandatory) // Get MD5 Hash Value "
Using HP Web Services for Output Server Sample clients /* In operation-attributes *Add wsg-job-handle,last-document and document-checksum tags */ "" + //Added job Handle(Mandatory) ""+jobHandle+"" + // add last-document=true since it is the last document(Mandatory) // if last-document=true all the documents delivers to the destinations and job completes "true"+ //Add MD5 checksum(Not Mandatory) // Get MD5 Hash Value "
Using HP Web Services for Output Server Sample clients *4)Call createDocument(String documentContract) API and get DocumentHandle
*Use this DocumentHandle to send document in chunks
*5)Create ChunkContract with chunk related attributes
*6)Call mutiple times sendChunk(String chunkContract DocumentData chunkData) API to send documents in chunk
*/ public void sendDocumentWithChunks()throws Exception{ //Here we are sending single document with chunks String doc="c:\\invoice.
Using HP Web Services for Output Server Sample clients "" + //Mandatory ""+jobHandle+"" + //Mandatory only for last document "true" + ""+ /*request-attributes *Document Attributes are added to request-attribute tag */ "" + //Mandatory "invoice.
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
Using HP Web Services for Output Server Sample clients if(checkSum){ chunkContract+=""+getMD5Hex(chunkFilePath)+"" ; } chunkContract+=""; DocumentData chunkData = new DocumentData(); DataHandler dh = new DataHandler(new FileDataSource(chunkFilePath)); chunkData.setDocument(dh); String chunkResponse=port.sendChunk(chunkContract,chunkData); System.out.
Using HP Web Services for Output Server Sample clients "WSG1"+ "WSG2"+ "" + // Add attributes to modify ""+ "2"+ ""+ ""; /* call HPOS Web Service Proxy and get Response*/ String resubmitResponse=port.resubmitJobs(resubmitContract); //print Request and Response System.out.println("resubmitContract : "+resubmitContract); System.out.
Using HP Web Services for Output Server Sample clients System.out.
Using HP Web Services for Output Server Sample clients ignored //indicates how many response chunks to get "3"+ /* add zero or more job-client-ids */ //if no job-client-id specied gets all jobs for that user "jqm:454545"+ "jqm:12465432"+ // "jqm:6564254"+ //add filter attributes "user"+ "" + // Add requested-attributes(display attributes)
Using HP Web Services for Output Server Sample clients //print Request and Response System.out.println("pauseJobContract : "+pauseContract); System.out.
Using HP Web Services for Output Server Sample clients public void resumeJobs(){ //Resume contract String resumeContract="" + "" + //Add one or more job-client-id's to Resume "dlm:8:39" + //"dlm:8:40" + //"dlm:8:41" + "" + //NOTE: Here Request-attributes not needed.
Using HP Web Services for Output Server Sample clients "qod" + //"qod2" + //"qod3" + "" + //NOTE: Here Request-attributes not needed. ""; /* call HPOS Web Service Proxy and get Response*/ String resumeResponse=port.resumeObjects(resumeContract); //print Request and Response System.out.println("resumeObjectContract : "+resumeContract); System.out.
Using HP Web Services for Output Server Sample clients //print Request and Response System.out.println("cancelSubJobContract : "+cancelContract); System.out.
Using HP Web Services for Output Server Sample clients System.out.println("dpaResponse : "+dpaResponse); } public void disableObject(){ String dpaContract="" + "" + // Add class type "destination"+ //Add object to disable "testLogical"+ "" + //NOTE: Here Request-attributes not needed. ""; /* call HPOS Web Service Proxy and get Response*/ String dpaResponse=port.
Using HP Web Services for Output Server JBoss clustering with Apache load balancer private byte[] getMD5(String filepath)throws Exception{ FileInputStream fis = new FileInputStream(filepath); MessageDigest md1 = MessageDigest.getInstance("SHA"); DigestInputStream dis = new DigestInputStream(fis, md1); dis.on(true); int bytRead=0; int buffer=1000; byte[] b=new byte[buffer]; while((bytRead=dis.read(b))>0){} byte bt[]=md1.
Using HP Web Services for Output Server JBoss clustering with Apache load balancer # Include mod_jk configuration file Include conf/mod-jk.conf 4. Under APACHE_HOME/conf, create the mod-jk.conf file and populate it as follows: # Load mod_jk module # Specify the filename of the mod_jk lib LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile conf/workers.properties # Where to put jk logs JkLogFile logs/mod_jk.
Using HP Web Services for Output Server JBoss clustering with Apache load balancer Deny from all Allow from 127.0.0.1 5. In the APACHE_HOME/conf directory, create workers.properties and populate it as follows: # Define list of workers that will be used # for mapping requests # The configuration directives are valid # for the mod_jk version 1.2.18 and later # worker.list=loadbalancer,status # Define Node1 # modify the host as your host IP or DNS name. worker.node1.port=8009 worker.node1.
Using HP Web Services for Output Server Non-HP Output Management Attributes . The jvmRoute attribute must match the name specified in the workers.properties file. • In the server.xml file, ensure that the AJP 1.3 Connector is uncommented, as follows: PAGE 62Using HP Web Services for Output Server Automated steps to build WSG client proxies using Integrated Development Environment (IDE) Automated steps to build WSG client proxies using Integrated Development Environment (IDE) You can build Web Services for Output Server client using NetBeans 5.5 Integrated Development Environment as follows: 1. To create a Java project you need to perform the following steps: i. Go to File > New Project and New Project window is displayed. ii.