WorkItem->错误:无法准备应用程序包

时间:2019-07-17 08:30:57

标签: autodesk-designautomation

我正在尝试使用AutoDesk的API修改DWG文件。

我用Visual Basic创建了一个简单的命令,此命令在AutoCAD中效果很好。命令名称为“ Rota”。

然后我创建了一个XML文件:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage
  SchemaVersion="1.0"
  Version="1.0"
  AutodeskProduct="AutoCAD"
  AppVersion="0.1.0"
  Name="PluginPrueba"
  Description="Paquete de Prueba"
  Author="Yomisma" >

  <Components>
    <RuntimeRequirements 
      OS="Win64" 
      Platform="AutoCAD" 
      SeriesMin="R23.0" 
      SeriesMax="R23.0"/>
  <ComponentEntry
    AppName="Comandos"
    ModuleName="./Contents/PluginPrueba.dll"
    AppType=".Net"
    AppDescription="Rotate 45 degrees"
    LoadOnCommandInvocation="True"
    LoadOnAutoCADStartup="True">
    <Commands GroupName="ComandosVB">
      <Command Global="Rota" Local="Rota" />
      </Commands>
    </ComponentEntry>
  </Components>
</ApplicationPackage>

我将XML放入文件夹PluginPrueba.bundle中,并创建了Contests文件夹(在此文件夹中,我放置了DLL文件)。然后我制作了ZIP文件。

然后在我的代码中,执行以下步骤:

1.- oAuth。

2。-创建一个存储桶。我放入Bucket de DWG文件中进行修改。

3.-发布捆绑包

4。-CreateBundleAlias

5.- UploadToForge ZIP文件。

6.-创建活动

{
    "id": "ActivityPrueba",
    "commandLine": "$(engine.path)\\accoreconsole.exe /i $(args[inputFile].path) /al $(appbundles[{{ AppBundleName  }}].path) /s $(settings[script].path)",
    "parameters": {
        "inputFile": {
            "zip": false,
            "ondemand": false,
            "verb": "get",
            "description": "Rota DWG",
            "localName": "$(inputFile)"
        },
        "outputFile": {
            "zip": false,
            "ondemand": false,
            "verb": "put",
            "description": "output file",
            "localName": "outputFile.dwg",
            "required": "true"
        }
    },
    "engine": "Autodesk.AutoCAD+23",
    "appbundles": [
        "{{ client_id  }}.{{ AppBundleName  }}+prod"
    ],
    "settings": {
        "script": "Rota\n"
    },
    "description": "AutoCAD Prueba Comando."
}

7.-创建活动别名

8.-创建工作项

执行时,这是报告:

[07/17/2019 08:10:23] Starting work item { id }
[07/17/2019 08:10:23] Start download phase.
[07/17/2019 08:10:23] Start preparing AppPackage appBundlePrueba.
[07/17/2019 08:10:23] Start downloading file https://developer.api.autodesk.com/oss/v2/buckets/newtoken/objects/square.dwg.
[07/17/2019 08:10:23] Download bits and install app to local cache.
[07/17/2019 08:10:23] Error: Failed to prepare app package(s).
[07/17/2019 08:10:23] End downloading file https://developer.api.autodesk.com/oss/v2/buckets/newtoken/objects/square.dwg. 32049 bytes have been written to T:\Aces\Jobs\b64f9613734b497db06459cdcd6e6fb1\square.dwg.
[07/17/2019 08:10:23] End download phase.
[07/17/2019 08:10:23] Error: An unexpected error happened during phase Downloading of job.
[07/17/2019 08:10:23] Job finished with result FailedEnvironmentSetup
[07/17/2019 08:10:23] Job Status:
{
  "status": "failedDownload",
  ..........................
}

怎么了?

2 个答案:

答案 0 :(得分:0)

错误消息表明我们的服务无法从存储桶中下载输入文件...最有可能是由于标头中缺少身份验证信息。

请记住,我们的存储桶受OAuth2保护,因此您需要在工作项中提供访问令牌(有关详细信息,请参见here),或生成签名的URL以临时下载/上传对象而无需进行身份验证(请参见详细信息here

"headers": {
              "Authorization": "", //header goes here
              "Content-type": "application/octet-stream"
            },

或者,您可以将输入/输出文件存储到您选择的任何远程存储中-AWS / GCD / Azure等。

答案 1 :(得分:0)

谢谢布莱恩!

我解决了Activity中的错误更改:

"settings": {
    "script": "Rota\n"

收件人:

"settings": {
    "script": "(command \"Rota\")\n"

现在我还有另一个错误:

[07/18/2019 09:24:00] Error: Non-optional output [outputFile.dwg] is missing .

[07/18/2019 09:24:00] Error: An unexpected error happened during phase Publishing of job.

在“活动”中,我具有以下代码:

    "outputFile": {
        "zip": false,
        "ondemand": false,
        "verb": "put",
        "description": "output file",
        "localName": "outputFile.dwg",
        "required": "true"
    }

在WorkItem中:

    "outputFile": {
        "url": "https://developer.api.autodesk.com/oss/v2/buckets/{{ TokenKey}}/objects/square.dwg",
        "headers": {
            "Authorization": "Bearer {{ oAuthToken  }}",
            "Content-type": "application/octet-stream"
        },
        "verb": "put"
    },

可能会有什么变化?

谢谢!