10.1

Table Of Contents
// QXP doc render request
QuarkXPressRenderRequest qxpreq = new QuarkXPressRenderRequest();
// Save as request that saves the file
SaveAsRequest saveAsRequest= new SaveAsRequest();
saveAsRequest.setNewName("NewDoc.qxp");
qxpreq.setRequest(saveAsRequest);
qRequestContext.setRequest(qxpreq);
// Get reference to RequestService
RequestService service = new RequestServiceStub(
"http://[server]:[port]/qxpsm/services/RequestService");
//Process the request
service.processRequest(qRequestContext);
If made from QuarkXPress Server, this request would look like this:
http://[server]:[port]/saveas/qxpdoc/Project.qxp?newname="NewDoc.qxp"
Java sample: AddFile request
This code snippet shows how to upload a file using a QuarkXPess Server Manager
servlet request that uses the Apache HTTPClient 3.1 library.
File file = new File("C:/FileToUpload.qxp");
// Create a post method to add file through QXPSM servlet request
PostMethod method = new PostMethod(
"http://[server]:[port]/qxpsm/request/addfile/+ file.getName());
try {
// File stream passed as 'uploadFile' parameter to QXPSM
FilePart part = new FilePart("uploadFile", file);
part.setContentType("multipart/form-data");
Part[] parts = { part };
method.setRequestEntity(new MultipartRequestEntity(parts,
method.getParams()));
HttpClient client = new HttpClient();
int status = client.executeMethod(method);
if (status == HttpStatus.SC_OK) {
System.err.println("Upload complete..");
} else {
System.err.println("Upload failed, response=" +
HttpStatus.getStatusText(status));
}
} catch (Exception ex) {
System.err.println("Error: " + ex.getMessage());
} finally {
method.releaseConnection();
}
Writing a .NET QXPSM client
To write a QuarkXPress Server Manager client in .NET:
1
Add a reference to the QuarkXPress Server Mananger .NET Web service stubs. The
"QXPSMWebServiceStubs.dll" file can be found at the following location:
[QXPSM_Home]/XDK/WebServiceStubs/dotnet/QXPSMWebServiceStubs.dll
2
Add a reference to Microsoft's System.Web.Services library.
A GUIDE TO QUARKXPRESS SERVER 10.1 | 165
USING QUARKXPRESS SERVER