我一直在遵循Oracle document E15930_01 (Agile PLM Core Web Services用户手册)中包含的代码示例。示例是用Java语言编写的,但是我已经将我需要的代码翻译成了我正在处理的项目的.NET格式。
我可以搜索对象并返回其附件。除了我需要的fileDownloadUrl之外,我可以获得所有的附件属性。此字段始终为空。
示例代码如下。我认为通过将allFiles的属性设置为false,将downloadUrl的属性设置为true,我应该得到一个下载URL,但我没有。你觉得我做错了什么吗?
AttachmentService svc = new AttachmentService();
svc.Credentials = credentials;
AgileGetFileAttachmentRequest[] req2 = InitializeArray<AgileGetFileAttachmentRequest>(1);
AgileFileAttachmentRequestType[] attachments = InitializeArray<AgileFileAttachmentRequestType>(1);
req2[0].classIdentifier = "MyIdentifier";
req2[0].objectNumber = "1234567890";
req2[0].allFiles = false;
req2[0].downloadUrl = true;
req2[0].attachments = attachments;
attachments[0] = new AgileFileAttachmentRequestType();
int rowId = getRowId(tt);
attachments[0].rowId = rowId;
GetFileAttachmentRequestType get = new GetFileAttachmentRequestType();
get.requests = req2;
GetFileAttachmentResponseType resp2 = svc.getFileAttachment(get);
AgileFileAttachmentResponseType[] attchResp = InitializeArray<AgileFileAttachmentResponseType>(1);
attchResp = resp2.responses[0].attachment;发布于 2014-10-22 01:38:22
张贴这篇文章,以防其他人需要这样做,或者我以后需要这样做。
我找到了我需要的数据。下载URL是基于数据库中多个字段中的XML值生成的。它们是您正在查看的行中的文件夹名、文件名和FolderVersion。您需要解析XML并检索生成链接的值。
您可以通过get Shortcut按钮获取下载链接的模式。
https://stackoverflow.com/questions/26490526
复制相似问题