Can Service Desk Web Services work with MIME for the attachment methods: createAttachment() and createAttmnt()?

book

Article ID: 49693

calendar_today

Updated On:

Products

CA IT Asset Manager CA Software Asset Manager (CA SAM) ASSET PORTFOLIO MGMT- SERVER SUPPORT AUTOMATION- SERVER CA Service Desk Manager - Unified Self Service KNOWLEDGE TOOLS CA Service Management - Asset Portfolio Management CA Service Management - Service Desk Manager

Issue/Introduction

Description:

This document describes where to find a sample Java Application that uses DIME and how to change it to use MIME to illustrate how to upload attachments over Web Services methods: createAttachment() and createAttmnt() .

Solution:

There is a sample set of java code that illustrates how to make calls to createAttachment() and createAttmnt() under the Service Desk Installation directory:

NX_ROOT\samples\sdk\websvc\java\test3_attachments\ 

Please refer to NX_ROOT\samples\sdk\websvc\TableOfContents.doc and NX_ROOT\samples\sdk\websvc\java\run_java_test_bat.txt for the documentation.

The code under NX_ROOT\samples\sdk\websvc\java\test3_attachments uses DIME which has limitations with file size being greater than 1 MB.

One solution would be to use MIME, which is supported by CA Service Desk Manager.

To use MIME, change the following code:

CHANGE:

// Setup the client soap request  
FileDataSource fds = new FileDataSource(filename);  
DataHandler dhandler = new DataHandler(fds);  
 
((org.apache.axis.client.Stub)usd)._setProperty( Call.ATTACHMENT_ENCAPSULATION_FORMAT,  
Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME );  
((org.apache.axis.client.Stub)usd).addAttachment(dhandler);  
  
// createAttachment()  
String attmntHandle = usd.createAttachment(sid,  
ServiceDeskDocumentRepository,  
newRequestHandle.value,  
"createAttachment test file",  
filename ); 

TO:

// Setup the client soap request  
FileDataSource fds = new FileDataSource(filename);  
DataHandler dhandler = new DataHandler(fds);  
 
((org.apache.axis.client.Stub)usd)._setProperty( Call.ATTACHMENT_ENCAPSULATION_FORMAT,  
Call.ATTACHMENT_ENCAPSULATION_FORMAT_MIME );  
((org.apache.axis.client.Stub)usd).addAttachment(dhandler);  
  
// createAttachment()  
String attmntHandle = usd.createAttachment(sid,  
ServiceDeskDocumentRepository,  
newRequestHandle.value,  
"createAttachment test file",  
filename ); 

Environment

Release: UAPMAC990JPP-12.6-Asset Portfolio Management-Asset Configuration
Component: