Service Desk Practitioners Forum
cancel

Webapi AttachmentServer

Highlighted
Robert Sircelj
New Member.

Webapi AttachmentServer

Hi if I run the code below i get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/hp/ftpclient/FtpException
at com.hp.ifc.attachments.ftp.FTP.openAttachmentServer(Unknown Source)
at com.hp.ifc.attachments.AttachmentServer.openAttachmentServer(Unknown Source)
at com.hermes.si.SDWebApiExample.main(SDWebApiExample.java:77)

It seems to me that I'm missing com.hp.ftpclient package that webapi.jar depends on? If I am corret where can I get it?

Im running SD 4.5 with SP19 and adding attachments through SD client works fine.




Code:

IGeneralSettingsHome gsh = session.getGeneralSettingsHome();
final String attachmentServerName = (gsh.openGeneralSettings(new Long(AppGeneralSettingsEnum.stAttachmentServerName))).getValue();
final String attachmentServerUserName = (gsh.openGeneralSettings(new Long(AppGeneralSettingsEnum.stAttachmentServerUsername))).getValue();
final String attachmentServerPassword = (gsh.openGeneralSettings(new Long(AppGeneralSettingsEnum.stAttachmentServerPassword))).getValue();
final String attachmentServerTargetFolder = (gsh.openGeneralSettings(new Long(AppGeneralSettingsEnum.stAttachmentServerTargetFolder))).getValue();
final String usePassiveFTP = (gsh.openGeneralSettings(new Long(AppGeneralSettingsEnum.stAttachmentServerUsePassiveFTP))).getValue();

if ((attachmentServerName == null)
|| (attachmentServerName.length() == 0)
|| (attachmentServerUserName == null)
|| (attachmentServerUserName.length() == 0)
|| (attachmentServerPassword == null)
|| (attachmentServerPassword.length() == 0)
|| (attachmentServerTargetFolder == null)
|| (attachmentServerTargetFolder.length() == 0)) {
System.out.println("information isn't enough: ");
return;
}

final int server_type = AttachmentServer.ATS_FTP_SERVER;


final AttachmentServer attachmentServer = AttachmentServer.openAttachmentServer(
server_type, new String[]{attachmentServerName,
attachmentServerTargetFolder, attachmentServerUserName,
attachmentServerPassword,
usePassiveFTP});
1 REPLY
Jacek Pliszka_2
Respected Contributor.

Re: Webapi AttachmentServer

Hi!

Try libftp.jar from
C:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\client\lib