Ich poste einfach mal die ganze Datei. Vielleicht könnt ihr mir dann mehr sagen:
/*
* ScanApp.js
* Copyright (C) Xerox Corporation, 2007. All rights reserved.
*
* This file contains functions to start a scan job and to handle the response
* using the Scan Web Service Library
*/
/* startScan : puts sample template onto the device by calling the STM web service library, then calls
* scan web service libabry to initiate scanning
*/
function startScan( templateName, isRemote )
{
try{
document.getElementById('xrxSR3Text').innerHTML = "Scanning will begin. Please wait.";
// Load the sample template onto the device for the sample scan job
xrxTemplatePutTemplate("https://127.0.0.1", templateName, sampleTemplateContent, finishPutTemplate, callback_failure );
}
catch ( e ){ // for debug
alert(e);
}
}
/* finishScan */
function finishScan(callid, response){
// retrieve and display the job id by using the parsing function in the Scan web service library
jobID = xrxScanParseInitiateScan(response);
document.getElementById('contentarea').innerHTML = "Job successfully scanned. The local Job ID is" + jobID;
// delete the sample template from the device
deleteSampleTemplate();
}
/* call_failure */
function callback_failure(){
document.getElementById('xrxSR3Text').innerHTML = "WEB SERVICE CALL FAILED!";
}
/* putTemplate */
function putTemplate(){
document.getElementById('xrxSR3Text').innerHTML = "Loading Sample Template onto device.";
// call to web service library
xrxTemplatePutTemplate("https://127.0.0.1", "sampleTemplate.xst", sampleTemplateContent, finishPutTemplate, callback_failure );
}
/* finishPutTemplate : Handles the response from the web service request, and stores returned checksum */
function finishPutTemplate(callid, response)
{
// convert response to dom using web service library
var xmlDoc = xrxStringToDom(response);
// store checksum for deleting of template
tchecksum = xrxGetElementValue(xmlDoc, 'TemplateChecksum');
// call to web service library to initaite the scan job
xrxScanInitiateScan( "https://127.0.0.1", "sampleTemplate.xst", false, finishScan, callback_failure );
}
/* deleteSampleTemplate
* NOTE: The corresponding checksum must be provided to delete a teamplet off the device.
* For this sample the checksum was stored from the response for the PutTemplateRequest
*/
function deleteSampleTemplate()
{
// call to Template web service library to delete the sample template
xrxTemplateDeleteTemplate( "https://127.0.0.1", "sampleTemplate.xst", tchecksum, finishDeleteTemplate, callback_failure )
}
/* finishDeleteTemplate : Handles the response from DeleteTemplate web service request */
function finishDeleteTemplate(){
// Ready to scan another job
document.getElementById('xrxSR3Text').innerHTML = "Ready";
}