Informatica ActiveVOS
- Informatica ActiveVOS 9.2.4.6
- All Products
// // 1) Using getAttachmentInfos wsht API call. // var taskId = "urn:b4p:1235"; // task id var getAttachmentInfosReq = { "getAttachmentInfos" : { "xmlns" : "http://www.example.org/WS-HT/api/xsd", "identifier" : { "$t" : taskId } } }; AE_AJAX_SERVICE_UTIL.postJSON( // task-client service url "http://localhost:8080/active-bpel/services/JSON/AeB4PTaskClient-taskOperations", // req. getAttachmentInfosReq, // success callback of JSON data function(aJsonResponse) { // handle getAttachmentInfosResponse var attachmentInfoList = AE_JSON_NODE_UTIL.getElements(aJsonResponse.getAttachmentInfosResponse.info); var i; for (i = 0; i < attachmentInfoList; i++) { var info = attachmentInfoList[i]; var attachmentId = AE_JSON_NODE_UTIL.getText(info.attachmentId); var attachmentName = AE_JSON_NODE_UTIL.getText(info.name); // file name var contentType = AE_JSON_NODE_UTIL.getText(info.contentType); // mime type. var attachUrl = AE_TASK_UTIL.getAttachmentUrl(taskId, attachmentName, attachmentId); // do something with this info such as displaying on page. // (the attachUrl can be used for href attribute in <a> tags and src in <img> tags) } }, // fault callback of JSON data function(aJsonFault) { alert("Fault!"); }, // http error callback function(aStatusCode, aStatusMessage) { alert("Transport error: " + aStatusCode + " " + aStatusMessage); } ); // // 2) Alternate method of getting attachment info via AeTask object. // var taskApi = new AeTaskApi(); taskApi.getInstance( "urn:b4p:1235", // task ID function(aTask) { // handle success response var attachmentInfoList = aTask.getAttachments(); var i; for (i = 0; i < attachmentInfoList; i++) { var info = attachmentInfoList[i].attachmentInfo; var attachmentId = AE_JSON_NODE_UTIL.getText(info.attachmentId); var attachmentName = AE_JSON_NODE_UTIL.getText(info.name); // file name var contentType = AE_JSON_NODE_UTIL.getText(info.contentType); // mime type. var attachUrl = AE_TASK_UTIL.getAttachmentUrl(aTask.getId(), attachmentName, attachmentId); // do something with this info such as displaying on page. // (the attachUrl can be used for href attribute in <a> tags and src in <img> tags } }, function(aJsonFault) { alert( "Fault!"); }, function(aStatusCode, aStatusMessage) { alert( "Transport error: " + aStatusCode + " " + aStatusMessage); } );