Service Desk Practitioners Forum

Problem with Attachments through WebAPI

Colleen Talbert
Super Contributor.

Problem with Attachments through WebAPI

We are using a Java application, using the WebAPI JAR file. This app needs to attach a file to the service call. Everything works fine, and the file attaches. You just can’t see it when you open up the service call in service desk. If you attach another unrelated file, you suddenly see BOTH files. Also, if there was already a file attached, and WebAPI attaches a 2nd file, everything works fine! Its as if WebAPI by itself can’t cause the service call to open the attachment area at the bottom. I am using the following code to do the attachment. Which basically came from one of the examples.

Any suggestions?

public void addAttachment(int serviceCallID, String filename)
IServicecallHome serviceCallHome = session.getServicecallHome();
IServicecall serviceCall = serviceCallHome.openServicecall(serviceCallID);

// Build a new attached item
IAttachedItemHome aHome = session.getAttachedItemHome();
IAttachedItem nItem = aHome.openNewAttachedItem();
File f = new File(filename);
// Make the new attached item aware of its parent entity type. This
// attribute is not automatically set when the new attached item is
// added to a parent.
IEntityInfoHome entInfHome = session.getEntityInfoHome();
IEntityInfo entInfo = entInfHome.openEntityInfo(serviceCall.getItemType());

// Add the new attached item, it is automatically saved


Vasily Kamenev
Acclaimed Contributor.

Re: Problem with Attachments through WebAPI

Use code locale on application server, then will working. This is a bag of web-api, I'm already wrote about in this forum