排解 XSL 轉換政策部署錯誤

查看 Apigee Edge 說明文件。
前往 Apigee X說明文件
資訊

XSLEmptyResourceUrl

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 失敗,錯誤訊息:

Error Saving Revision revision_number
Error occurred while validation of bean policy_name.xml. Reason:- Non null
value expected for element ResourceURL in XSL

錯誤訊息示例

在以下範例錯誤訊息中,指稱的 XSL 轉換政策名稱 錯誤為 xslt

Error Saving Revision 1
Error occurred while validation of bean xslt.xml. Reason: - Non null value
expected for element ResourceURL in XSL

螢幕截圖範例

在 Edge UI 中,您會看到類似下方的彈出式視窗錯誤:

原因

如果 XSL 轉換政策中的 <ResourceURL> 元素為空白,則 API Proxy 部署作業失敗。

診斷

檢查錯誤中命名的 XSL 轉換政策中的 <ResourceURL> 元素 撰寫新的電子郵件訊息如果 <ResourceURL> 元素中未指定資源網址, 那麼這是錯誤的原因例如,下列的 XSL 轉換 政策含有空白的 <ResourceURL> 元素:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="xslt">
    <DisplayName>xslt</DisplayName>
    <Properties/>
    <ResourceURL></ResourceURL>
    <Parameters ignoreUnresolvedVariables="true"/>
    <OutputVariable/>
</XSL>

由於 <ResourceURL> 元素沒有任何內容,因此 API Proxy 部署失敗。

解析度

確認 XSL 轉換政策中的 <ResourceURL> 元素具備有效的 指向 XSLT 檔案的網址。

例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="xslt">
    <DisplayName>xslt</DisplayName>
    <Properties/>
    <ResourceURL>xsl://my_transform.xsl</ResourceURL>
    <Parameters ignoreUnresolvedVariables="true"/>
    <OutputVariable/>
</XSL>

XSLInvalidResourceType

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 失敗,錯誤訊息:

Error Deploying Revision revision_number to env_name
XSL policy_name: Resource type must be xsl. Context Revision:revision_number;
APIProxy:api_proxy_name;Organization:org_name;Environment:env_name.

錯誤訊息示例

以下範例錯誤訊息中的 XSL 轉換政策名稱 導致錯誤為 xslt

Error Deploying Revision 1 to test
XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
Organization:jdoe-test;Environment:test.

螢幕截圖範例

在 Edge UI 中,您會看到類似下方的彈出式視窗錯誤:

原因

如果 XSL 轉換的 <ResourceURL> 元素中指定的資源類型 政策並非 xsl 類型,如此 API Proxy 的部署作業就會失敗。

正確的指定格式如下所示:

<ResourceURL>xsl://<file_name>.xsl</ResourceURL>

舉例來說,如果在 <ResourceURL> 中指定資源類型為 jsc XSL Transform 政策的元素 (如下所示),然後部署 API Proxy 故障:

<ResourceURL>jsc://my_transform.xsl</ResourceURL>

診斷

  1. 找出發生錯誤的 XSL 轉換政策名稱。你可以在錯誤訊息中找到這項資訊。例如在下列錯誤中,政策名稱為 xslt

    XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
    Organization:jdoe-test;Environment:test.
    
  2. 在失敗的 XSL 轉換政策 XML 中,確認 <ResourceURL> 元素中指定的資源類型是否為 xsl 類型。如果非 xsl 類型,就會造成錯誤。

    舉例來說,下列政策在 <ResourceURL> 元素中指定非 xsl 類型:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XSL async="false" continueOnError="false" enabled="true" name="xslt">
        <DisplayName>xslt</DisplayName>
        <Properties/>
        <ResourceURL>jsc://my_transform.xsl</ResourceURL>
        <Parameters ignoreUnresolvedVariables="true"/>
        <OutputVariable/>
    </XSL>
    

    由於資源網址指定為 jsc://my_transform.xsl (非 xsl 類型),因此 API Proxy 部署作業會失敗並傳回以下錯誤:

    XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
    Organization:jdoe-test;Environment:test.
    

解析度

確認 XSL 的 <ResourceURL> 元素中指定的資源類型 轉換政策一律為 xsl 類型。例如:

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <XSL async="false" continueOnError="false" enabled="true" name="xslt">
      <DisplayName>xslt</DisplayName>
      <Properties/>
      <ResourceURL>xsl://my_transform.xsl</ResourceURL>
      <Parameters ignoreUnresolvedVariables="true"/>
      <OutputVariable/>
  </XSL>