9.5

Table Of Contents
3
Get a reference to the RequestService:
RequestService requestService = new RequestServiceStub(
"http://[server]:[port]/qxpsm/services/RequestService");
4
Get a reference to the AdminService:
AdminService adminService = new AdminServiceStub(
"http://[server]:[port]/qxpsm/services/AdminService");
5
Use these two services to make requests.
For sample code, see the following topics.
If QuarkXPress Server Manager is running over SSL,the client-side application must also
use SSL. Invoke NoValidationTrustProvider.install(), where install() is the
static method of the Java class NoValidationTrustProvider (provided with the Java
samples).
Java sample: Deconstructing a project
QRequestContext qRequestContext = new QRequestContext();
qRequestContext.setDocumentName("MyDoc.qxp");
// Create XML Request
XMLRequest xmlRequest = new XMLRequest();
qRequestContext.setRequest(xmlRequest);
// Get reference to RequestService
RequestService service = new RequestServiceStub(
"http://<server>:<port>/qxpsm/services/RequestService");
//Process Request using request service
QContentData data = service.processRequest(qRequestContext);
String deconstructXml = data.getTextData();
Java sample: Rendering a PDF
QRequestContext qRequestContext = new QRequestContext();
qRequestContext.setDocumentName("MyDoc.qxp");
// Setting responseAsURL to true generates the response as a URL
qRequestContext.setResponseAsURL(true);
// Create the PDFRenderRequest
PDFRenderRequest pdfRenderRequest = new PDFRenderRequest();
qRequestContext.setRequest(pdfRenderRequest);
// Get reference to RequestService
RequestService service = new RequestServiceStub(
"http://<server>:<port>/qxpsm/services/RequestService");
// Process request using RequestService
QContentData data = service.processRequest(qRequestContext);
// Get URL from which resulting PDF can be fetched
String pdfUrl = data.getResponseURL();
Java sample: Chained request
QRequestContext qRequestContext = new QRequestContext();
qRequestContext.setDocumentName("Project.qxp");
// QXP doc render request
QuarkXPressRenderRequest qxpreq = new QuarkXPressRenderRequest();
// Save as request that saves the file
SaveAsRequest saveAsRequest= new SaveAsRequest();
A GUIDE TO QUARKXPRESS SERVER 9.5 | 171
USING QUARKXPRESS SERVER