排解 XMLThreatProtection 政策執行階段錯誤

您正在查看 ApigeeApigee Hybrid 說明文件。
查看 Apigee Edge 說明文件。

ExecutionFailed

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition policy_name:
        Execution failed. Reason: error_description at line line_num
        (possibly around char char_num)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: Premature end of document while parsing at line 5(possibly  around char 0)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤類型和可能的原因

XMLThreatProtection 政策可能會擲回多種不同類型的 ExecutionFailed 錯誤。下表列出各種錯誤類型及其可能的原因:

錯誤 原因
ElementNameExceeded XML 標記的字串長度超過上限。
ChildCountExceeded XML 酬載中子元素的數量超過上限。
NodeDepthExceeded XML 酬載中 XML 元素的深度超過允許上限。
AttributeCountExceeded 單一元素中的屬性數量已超過上限。
AttributeNameExceeded 屬性名稱的長度超過上限。
AttributeValueExceeded 屬性值超過允許的長度上限。
TextExceeded 文字長度超過上限。
CommentExceeded 留言長度超過上限。
PIDataExceeded 處理指令資料長度超過允許上限。
PITargetExceeded 程序指示名稱長度超出限制。
NSURIExceeded 命名空間網址長度超出上限。
NSPrefixExceeded 命名空間前置字串長度超出限制。
NSCountExceeded 單一元素中使用的命名空間數量超出上限。
無效的 XML 酬載 輸入的 XML 酬載無效。

ElementNameExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

執行階段流量會傳回 500 回應碼,並顯示以下錯誤:

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition policy_name:
        Execution failed. reason: XMLThreatProtection stepDefinition policy_name:
        Element name length exceeded num at line line_num(possibly
        around char char_num)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Element name length exceeded 5 at line 1(possibly around char 9)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果政策的 <Source> 元素指定的輸入酬載含有 XML 元素,且該元素的長度超過 <NameLimits> 元素下方 <Element> 元素中指定的最大長度,就會發生這項錯誤。

舉例來說,如果 XMLThreatProtection 政策中將 <Element> 元素指定為 5,但輸入酬載含有超過 5 個字元的元素,就會擲回此錯誤。

診斷

  1. 請檢查錯誤訊息,找出 XMLThreatProtection 政策名稱、行號,以及輸入酬載中可能的字元數,以便找出元素長度超出上限的部分。

    舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,,酬載中的行號為 1,可能的字元數為 9.

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Element name
    length exceeded 5 at line 1(possibly around char 9)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <Element> 元素中指定的值。

    舉例來說,在下列 XMLThreatProtection 政策中,<Element> 會設為 5

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>5</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>5</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認該行元素的長度是否大於 <Element> 元素 (在步驟 2 中指出) 的指定值。如果元素長度超過這個值,就會導致錯誤。

    以下是輸入酬載的範例:

    <company>
      <name>Example</name>
      <country>USA</country>
    </company>
    

    上方顯示的 XML 酬載在第 1 行有一個名為 company 的根元素,長度為 7 個半形字元。由於元素長度大於 5 (為 <Element> 元素指定的值),因此您會收到以下錯誤:

    XML-Threat-Protection-1: Execution failed. reason: XMLThreatProtection stepDefinition
    XML-Threat-Protection-1: Element name length exceeded 5 at line 1(possibly around char 9)
    

解決方法

如果 XMLThreadProtection 政策旨在防範酬載的元素名稱超過定義值,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您判斷在酬載中指定較長的元素不會造成任何影響,請根據需求將 <Element> 修改為適當的值。

舉例來說,如果您認為可以允許長度為 10 的元素,請修改 XMLThreatProtection 政策,如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>5</NodeDepth>
        <AttributeCountPerElement>2</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

ChildCountExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition policy_name:
        Execution failed. reason: XMLThreatProtection stepDefinition policy_name:
        Children count exceeded num at line  num(possibly
        around char num)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Children count exceeded 3 at line 5(possibly around char 89)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 <Source> 元素指定的輸入訊息酬載包含 XML 元素,且該 XML 元素包含的子元素多於政策 <ChildCount> 元素中指定的值,就會發生此錯誤。

舉例來說,如果 <ChildCount> 元素為 3,但輸入的 XML 酬載含有子元素超過 3 個的元素,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和項目數量超出上限的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 5

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Children
    count exceeded 3 at line 5(possibly around char 89)"
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <ChildCount> 元素中指定的值。

    在下列政策範例中,<ChildCount> 會設為 3(請注意,註解、包含元素和其他項目都會計入此限制):

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>5</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 請檢查輸入酬載的特定行號 (在步驟 1 中指出),確認酬載中的子項數量 (包括所有註解等) 是否大於為 <ChildCount> 元素指定的值 (在步驟 2 中指出)。如果子項元素數量超過子項數量,就會導致錯誤。

    以下是輸入酬載的範例:

    <movie>
      <title>Jurassic Park</title>
      <language>English</language>
      <country>USA</country>
      <director>Steven Spielberg</director>
    </movie>
    

    在上方顯示的 XML 酬載中,第 5 行包含根元素 <movie> 的第四個子元素 <director>。由於輸入 XML 酬載中的子元素數量大於 3 (為 <ChildCount> 元素指定的值),因此您會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Children
    count exceeded 3 at line 5(possibly around char 89)
    

解決方法

如果 XMLThreatProtection 政策旨在防範酬載的子元素數量超過特定門檻,則會顯示錯誤訊息。在這種情況下,您不需要採取任何額外行動。

不過,如果您判斷可以將更多子項 (包括註解等) 納入酬載,而不會造成任何影響,請根據需求將 <ChildCount> 修改為適當的值。

舉例來說,如果您認為最多可允許 10 個子元素,請修改 XMLThreatProtection 政策,如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>5</NodeDepth>
        <AttributeCountPerElement>2</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">10</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

NodeDepthExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Node depth exceeded [num] at line [num](possibly around
        char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Node depth exceeded 5 at line 6(possibly around char 110)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 <Source> 元素指定的輸入訊息酬載含有 XML 文件,且該文件的節點階層超過 XMLThreatProtection 政策 <NodeDepth> 元素中指定的數量,就會發生這個錯誤。

舉例來說,如果政策中指定 <NodeDepth> 元素為 4,但輸入酬載的節點深度超過 4,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和超過節點深度的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 6

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Node depth
    exceeded 5 at line 6(possibly around char 109)
    
  2. 檢查失敗的 XMLThreatProtection 政策 (在步驟 1 中指出),並記下 <NodeDepth> 元素中指定的值。

    在以下 XMLThreatProtection 政策範例中,<NodeDepth> 會設為 5

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>5</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認其中指定的節點深度是否比 <NodeDepth> 元素 (在步驟 2 中指出) 指定的數字高。如果 XML 子元素的層級超過計數,就會導致錯誤。

    以下是輸入酬載的範例:

    <hellos>
       <hello1>
           <wave1>
                <wave2>
                    <wave3>
                        <wave4>
                           <wave5>wave</wave5>
                        </wave4>
                    </wave3>
                </wave2>
           </wave1>
       </hello1>
       <hello2>world2</hello2>
       <hello3>world3</hello3>
       <hello4>world4</hello4>
       <hello5>world5</hello5>
       <hello6>world6</hello6>
    </hellos>
    

    上方第 6 行顯示的 XML 酬載節點深度為 6.由於節點深度大於 5 (<NodeDepth> 元素指定的值),因此您會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Node depth
    exceeded 5 at line 6(possibly around char 109)
    

解決方法

如果 XMLThreatProtection 政策旨在防範具有特定節點深度門檻的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許更大的節點深度,請根據需求將 <NodeDepth> 修改為適當的值。

舉例來說,如果您認為可允許的節點深度上限為 10,請修改政策如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>2</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

AttributeCountExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Attribute count exceeded [num] at line [num](possibly around
        char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Attribute count exceeded 2 at line 3(possibly around char 105)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載含有 XML 文件,且單一元素的屬性數量超過政策 <AttributeCountPerElement> 元素中指定的數量,就會發生此錯誤。

舉例來說,如果 <AttributeCountPerElement> 元素在 XMLThreatProtection 政策中指定為 2,但輸入酬載含有超過 2 個屬性的元素,就會擲回這個錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和屬性數量超出上限的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XMLThreat-Protection-1,而酬載中的行號為 3

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Attribute
    count exceeded 2 at line 3(possibly around char 105)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <AttributeCountPerElement> 元素中指定的值。

    在以下政策範例中,<AttributeCountPerElement> 會設為 2

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認指定的屬性數量是否超過 <AttributeCountPerElementh> 元素 (在步驟 2 中指出) 所指定的數量。如果屬性數量超過計數,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version="1.0" encoding="UTF-8"?>
    <bookstore>
      <book category="cooking" cuisine="Indian" lang="en">
        <title>Easy Indian Cooking</title>
        <author>Suneeta</author>
        <year>2004</year>
        <price>300.00</price>
      </book>
    </bookstore>
    

    上方第 3 行顯示的 XML 酬載含有一個具有三個屬性的元素。由於屬性計數大於 2 (為 <AttributeCountPerElement> 元素指定的值),因此會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Attribute
    count exceeded 2 at line 3(possibly around char 105)
    

解決方法

如果 XMLThreatProtection 政策旨在防止酬載超過特定屬性數量,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許更多屬性,請根據需求將 <AttributeCountPerElement> 修改為適當的值。

舉例來說,如果您認為每個元素最多可允許 5 個屬性,請修改政策如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

AttributeNameExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Attribute name length exceeded [num] at line [num](possibly around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Attribute name length exceeded 5 at line 3(possibly around char 105)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載包含 XML 文件,且屬性名稱超過政策 <NameLimits> 元素 <Attribute> 子項中指定的字元數,就會發生這個錯誤。

舉例來說,如果政策中指定 <Attribute> 元素為 5,但輸入酬載含有超過 5 個字元的屬性名稱,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和超過屬性名稱長度的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 3

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Attribute
    name length exceeded 5 at line 3(possibly around char 105)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <Attribute> 元素中指定的值

    在以下 XMLThreatProtection 政策範例中,<Attribute> 已設為 5

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認該處指定屬性的長度是否比 <Attribute> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數量超過屬性值,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version="1.0" encoding="UTF-8"?>
    <bookstore>
      <book category="cooking" cuisine="Indian" lang="en">
        <title>Easy Indian Cooking</title>
        <author>Suneeta</author>
        <year>2004</year>
        <price>300.00</price>
      </book>
    </bookstore>
    

    上方第 3 行所示的 XML 酬載含有兩個屬性 categorycuisine,其名稱長度分別為 8 和 7 個半形字元.。由於屬性名稱長度超過 5 (<Attribute> 元素指定的值),因此您會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Attribute
    name length exceeded 5 at line 3(possibly around char 105)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定屬性名稱長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許更長的屬性名稱,請根據需求將 <Attribute> 修改為適當的值。

舉例來說,如果認為屬性名稱最多可達 10 個字元,請修改政策如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

AttributeValueExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]: Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:  Attribute value length exceeded [num] at line [num](possibly around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Attribute value length exceeded 10 at line 3(possibly around char 111)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果政策的 <Source> 元素指定的輸入訊息酬載包含 XML 文件,且屬性值超過 <ValueLimits> 元素 <Attribute> 子元素中指定的字元數,就會發生這個錯誤。

舉例來說,如果 XMLThreatProtection 政策中指定 <Attribute> 元素為 10,但輸入酬載含有超過 10 個字元的屬性值,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和屬性數量超出限制的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 3

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Attribute
    value length exceeded 10 at line 3(possibly around char 111)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <ValueLimits> 元素 <Attribute> 子項中指定的值。

    在以下 XMLThreatProtection 政策範例中,<Attribute> 已設為 10:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認該行指定的屬性值長度是否比 <Attribute> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數量超過屬性值,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version="1.0" encoding="UTF-8"?>
    <bookstore>
      <book category="cooking" cuisine="South Indian" lang="en">
        <title>Easy Indian Cooking</title>
        <author>Suneeta</author>
        <year>2004</year>
        <price>300.00</price>
      </book>
    </bookstore>
    

    上方第 3 行顯示的 XML 酬載含有值長度為 12 個字元的屬性 (cuisine)。由於屬性值長度大於 10 (這是 <Attribute> 元素指定的值),因此會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Attribute
    value length exceeded 10 at line 3(possibly around char 111)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定屬性值長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許更長的屬性值,請根據需求將 <ValueLimits> 元素的 <Attribute> 子元素修改為適當的值。

舉例來說,如果您認為屬性值最多可達 15 個字元,請按照下列方式修改政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

TextExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]: Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:  Text length exceeded [num] at line [num](possibly around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Text length exceeded 15 at line 4(possibly around char 66)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載含有 XML 文件,且該元素的文字長度超過政策 <ValueLimits> 元素 <Text> 子元素中指定的字元數,就會發生這個錯誤。

舉例來說,如果政策中指定 <Text> 元素為 15,但輸入酬載包含超過 15 個半形字元的文字,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和屬性數量超出上限的行號。舉例來說,在下列錯誤訊息中,政策名稱為 XML-Threat-Protection-1,酬載中的行號為 4

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Text length
    exceeded 15 at line 4(possibly around char 66)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <ValueLimits> 元素 <Text> 子項中指定的值。

    在以下 XMLThreatProtection 政策範例中,<Text> 會設為 15

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認該行指定的屬性值長度是否比 <Text> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數量超過屬性值,就會導致錯誤。

    <food>
      <name>Veg Sandwich</name>
      <price>$5.95</price>
      <description>Vegetarian Sandwich with onions, tomatoes and lettuce</description>
      <calories>650</calories>
    </food>
    

    上方第 4 行顯示的 XML 酬載含有長度為 53 個半形字元的文字。由於屬性值長度超過 15 (這是 <Text> 元素指定的值),因此會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Text length
    exceeded 15 at line 4(possibly around char 66)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定文字長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許更長的文字長度,請根據需求將 <ValueLimits> 元素的 <Text> 子元素修改為適當的值。

舉例來說,假設屬性值長度上限為 60 個字元,請按照下列方式修改政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>60</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

CommentExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Comment length exceeded [num] at line [num](possibly around char
        [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Comment length exceeded 10 at line 2(possibly around char 48)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載含有 XML 文件,且該文件的註解長度超過政策 <ValueLimits> 元素 <Comment> 子元素中指定的字元數,就會發生這個錯誤。

舉例來說,如果政策中將 <Comment> 元素指定為 10,但輸入酬載含有超過 10 個字元的註解,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和超過註解長度限制的行號。舉例來說,在下列錯誤訊息中,政策名稱為 XML-Threat-Protection-1,酬載中的行號為 2

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Comment length exceeded 10 at line 2(possibly around char 48)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <ValueLimits> 元素 <Comment> 子項中指定的值。

    在以下 XMLThreatProtection 政策範例中,<Comment> 會設為 10

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認該行註解的長度是否超過 <Comment> 元素 (在步驟 2 中指出) 中指定的數字。如果字元數量超過屬性值,就會導致錯誤。

    以下是輸入酬載的範例:

    <food>
      <!--This is somewhat a long comment-->
      <name>Veg Sandwich</name>
      <price>$5.95</price>
      <description>Vegetarian Sandwich with onions, tomatoes and lettuce</description>
      <calories>650</calories>
    </food>
    

    上方第 2 行顯示的 XML 酬載含有長度為 31 個字元的註解. 由於註解長度超過 10 (<Comment> 元素指定的值),因此會發生以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Comment length
    exceeded 10 at line 2(possibly around char 48)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定註解長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許較長的留言,請根據需求將 <ValueLimits> 元素的 <Comment> 子元素修改為適當的值。

舉例來說,如果您認為屬性值最多可達 40 個字元,請按照下列方式修改政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>40</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

PIDataExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Processing Instruction data length exceeded [num] at line
        [num](possibly around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Processing Instruction data length exceeded 30 at line 2(possibly around char 109)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載包含 XML 文件,且處理資料指示超過政策 <ValueLimits> 元素 <ProcessingInstructionData> 子項中指定的字元數,就會發生此錯誤。

舉例來說,如果 XMLThreatProtection 政策中將 <ProcessingInstructionData> 元素指定為 10,但輸入酬載含有超過 10 個字元的處理指示,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和超過處理指令長度限制的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 2

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Processing
    Instruction data length exceeded 30 at line 2(possibly around char 109)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <ValueLimits> 元素 <ProcessingInstructionData> 子項中指定的值。

    在以下 XMLThreatProtection 政策範例中,<ProcessingInstructionData> 會設為 30

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>30</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 請檢查輸入酬載的特定行號 (在步驟 1 中指出),確認其中指定的處理指示資料長度是否比 <ProcessingInstructionData> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數量超過處理指令資料,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?xml-stylesheet type="text/xsl" href="mobilephones.xsl"?>
    <mobilephones>
      <mobilephone>
          <name>iPhone</name>
          <price>$600</price>
      </mobilephone>
      <mobilephone>
          <name>Samsung</name>
          <price>$500</price>
      </mobilephone>
    </mobilephones>
    

    上方第 1 行顯示的 XML 酬載含有處理指示資料元素 (type="text/xsl" href="mobilephones.xsl"?)長度為 40 個字元.)。由於這個長度大於 30 (<ProcessingInstructionData> 元素指定的值),因此會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Processing
    Instruction data length exceeded 30 at line 2(possibly around char 109)
    

解決方法

如果 XMLThreatProtection 政策旨在防止酬載超出特定處理指示資料長度,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許較長的處理指示資料元素,請根據需求將 <ValueLimits> 元素的 <ProcessingInstructionData> 子元素修改為適當的值。

舉例來說,如果您認為資料處理指示的長度可達 50 個字元,請修改政策如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>10</NamespaceURI>
        <Comment>40</Comment>
        <ProcessingInstructionData>50</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

PITargetExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Processing Instruction target length exceeded [num] at line [num](possibly around
        char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Processing Instruction target length exceeded 10 at line 2(possibly around char 114)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載含有 XML 文件,且其中的程序指示目標超過政策 <NameLimits> 元素 <ProcessingInstructionTarget> 子元素中指定的字元數,就會發生這個錯誤。

舉例來說,如果 XMLThreatProtection 政策中將 <ProcessingInstructionTarget> 元素指定為 10,但輸入酬載含有超過 10 個字元的程序指令目標,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和超過處理指令目標數量的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 1

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Processing
    Instruction target length exceeded 10 at line 2(possibly around char 114)
    
  2. 檢查失敗的 XMLThreatProtection 政策 (在步驟 1 中指出),並記下 <NameLimits> 元素 <ProcessingInstructionTarget> 子元素中指定的值。

    在以下 XMLThreatProtection 政策範例中,<ProcessingInstructionTarget> 會設為 10

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>10</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>5</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>20</Text>
            <Attribute>15</Attribute>
            <NamespaceURI>40</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>30</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認其中指定的處理指令目標長度是否比 <ProcessingInstructionTarget> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數超過目標大小限制,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?xml-stylesheet type="text/xsl" href="mobilephones.xsl"?>
    <mobilephones>
      <mobilephone>
          <name>iPhone</name>
          <price>$600</price>
      </mobilephone>
      <mobilephone>
          <name>Samsung</name>
          <price>$500</price>
      </mobilephone>
    </mobilephones>
    

    上方第 2 行顯示的 XML 酬載含有長度為 14 個半形字元的處理指示目標名稱「xml-stylesheet"」。由於處理指令目標名稱超過 10 個字元 (這是 <ProcessingInstructionTarget> 元素指定的值),因此您會收到以下錯誤訊息:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Processing
    Instruction target length exceeded 10 at line 2(possibly around char 114)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定處理程序指令目標長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您判斷程序指示目標可以更長,請根據需求將 <NameLimits> 元素的 <ProcessingInstructionTarget> 子元素修改為適當的值。

舉例來說,如果您認為程序指示目標最多可達 25 個字元,請按照下列方式修改政策:

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>15</NamespacePrefix>
    <ProcessingInstructionTarget>25</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>2</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>40</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
  </XMLThreatProtection>

NSURIExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]: Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:  Namespace uri length length exceeded [num] at line [num](possibly around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Namespace uri length exceeded 10 at line 2(possibly around char 97)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載含有 XML 文件,且該文件的 Namespace URI 超過政策 <ValueLimits> 元素 <NamespaceURI> 子元素中指定的字元數,就會發生這個錯誤。

舉例來說,如果政策中指定 <NamespaceURI> 元素為 10,但輸入酬載含有超過 10 個字元的命名空間 URI,就會擲回這個錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和命名空間 URI 長度超出限制的列號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 2

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace
    uri length exceeded 10 at line 2(possibly around char 97)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <ValueLimits> 元素 <NamespaceURI> 子元素中指定的值。

    在以下 XMLThreatProtection 政策範例中,<NamespaceURI> 會設為 10

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>5</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>2</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>15</Text>
            <Attribute>10</Attribute>
            <NamespaceURI>10</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>10</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認其中指定的命名空間 URI 長度是否比 <NamespaceURI> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數量超過命名空間 URI 長度,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version = "1.0" encoding = "UTF-8"?>
      <profile:user xmlns:profile = "www.example.com/profile">
      <profile:name>Rama Krishna</profile:name>
      <profile:company>Example</profile:company>
      <profile:phone>(91) 9876543210</profile:phone>
    </profile:user>
    

    上方第 2 行顯示的 XML 酬載含有 http://www.example/profile 命名空間 URI,長度為 22 個字元。由於命名空間 URI 長度超過 10 (這是 <NamespaceURI> 元素指定的值),因此您會收到以下錯誤訊息:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace
    uri length exceeded 10 at line 2(possibly around char 99)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定命名空間 URI 長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取其他行動。

不過,如果您認為可以允許較長的命名空間 URI,請根據需求將 <ValueLimits> 元素的 <NamespaceURI> 子元素修改為適當的值。

舉例來說,如果您認為命名空間 URI 長度可達 30 個半形字元,請依照下列方式修改政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>2</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>30</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

NSPrefixExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Namespace prefix length exceeded [num] at line [num](possibly
        around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Namespace prefix length exceeded 10 at line 2(possibly around char 105)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 <Source> 元素指定的輸入訊息酬載內容包含 XML 文件,且命名空間前置字串超過政策 <NameLimits> 元素 <NamespacePrefix> 子元素中指定的字元數,就會發生這個錯誤。

舉例來說,如果 XMLThreatProtection 政策中指定 <NamespacePrefix> 元素為 10,但輸入酬載含有超過 10 個字元的命名空間前置字元,就會擲回這個錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和命名空間 URI 前置字串長度超出限制的列號。舉例來說,在以下錯誤訊息中,政策名稱為 XML-Threat-Protection-1,而酬載中的行號為 2

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace
    prefix length exceeded 10 at line 2(possibly around char 105)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <NameLimits> 元素 <NamespacePrefix> 子元素中指定的值。

    在以下 XMLThreatProtection 政策範例中,<NamespacePrefix> 會設為 10

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>10</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>5</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>20</Text>
            <Attribute>15</Attribute>
            <NamespaceURI>40</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>30</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認其中指定的命名空間前置字串長度是否比 <NamespacePrefix> 元素 (在步驟 2 中指出) 指定的數字長。如果字元數量超過命名空間前置字元上限,則會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version = "1.0" encoding = "UTF-8"?>
    <userprofile:user xmlns:userprofile = "www.example/profile">
      <userprofile:name>Rama Krishna</userprofile:name>
      <userprofile:company>Example</userprofile:company>
      <userprofile:phone>(011) 123-4567</userprofile:phone>
    </userprofile:user>
    

    上方第 2 行顯示的 XML 酬載含有長度為 11 個半形字元的命名空間前置字串 userprofile。由於命名空間 URI 前置字串長度超過 10 (這是 <NamespacePrefix> 元素指定的值),因此您會收到以下錯誤訊息:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace
    prefix length exceeded 10 at line 2(possibly around char 105)
    

解決方法

如果 XMLThreatProtection 政策旨在防範超過特定命名空間 URI 前置字元長度的酬載,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許較長的命名空間 URI 前置字串,請根據需求將 <NameLimits> 元素的 <NamespacePrefix> 子元素修改為適當的值。

舉例來說,如果您認為命名空間 URI 前置字串長度可達 15 個字元,請依下列方式修改政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>5</Attribute>
        <NamespacePrefix>15</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>2</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>15</Text>
        <Attribute>10</Attribute>
        <NamespaceURI>40</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>10</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

NSCountExceeded

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. reason: XMLThreatProtection stepDefinition [policy_name]:
        Namespace count exceeded [num] at line [num](possibly around char [num])",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed. reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace count exceeded 3 at line 2(possibly around char 234)",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素指定的輸入訊息酬載內容包含 XML 文件,且單一元素中使用的命名空間數量超過政策 <StructureLimits> 元素 <NamespaceCountPerElement> 子元素中指定的數量,就會發生此錯誤。

舉例來說,如果政策中指定 <NamespaceCountPerElement> 元素為 3,但輸入酬載包含的元素有超過 3 個命名空間,就會擲回此錯誤。

診斷

  1. 請查看錯誤訊息,找出 XMLThreatProtection 政策名稱和命名空間數量超出限制的行號。舉例來說,在以下錯誤訊息中,政策名稱為 XMLThreat-Protection-1,而酬載中的行號為 2

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace count
    exceeded 3 at line 2(possibly around char 234)
    
  2. 檢查失敗的政策 (在步驟 1 中指出),並記下 <StructureLimits> 元素 <NamespaceCountPerElement> 子元素中指定的值。

    在以下 XMLThreatProtection 政策範例中,<NamespaceCountPerElement> 會設為 3

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>10</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>request</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>5</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>20</Text>
            <Attribute>15</Attribute>
            <NamespaceURI>40</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>30</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    
  3. 檢查輸入酬載的特定行號 (在步驟 1 中指出),確認其中為單一元素指定的命名空間數量是否高於 <NamespaceCountPerElement> 元素 (在步驟 2 中指出) 指定的數量。如果命名空間數量超過每個元素的命名空間數量上限,就會導致錯誤。

    以下是輸入酬載的範例:

    <?xml version = "1.0" encoding = "UTF-8"?>
    <hellos xmlns:h="https://www.w3schools.com/greeting1" xmlns:a="https://www.w3schools.com/greeting2" xmlns:b="https://www.w3schols.com/greeting3" xmlns:c="https://www.w3schools.com/greeting4">
        <a:hello1>world1</a:hello1>
        <b:hello2>world2</b:hello2>
        <c:hello2>world2</c:hello2>
        <h:hello2>world2</h:hello2>
    </hellos>
    

    上方第 2 行顯示的 XML 酬載含有超過 3 個命名空間。由於命名空間計數大於 3 (<NamespaceCountPerElement> 元素指定的值),因此您會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: XMLThreatProtection stepDefinition XML-Threat-Protection-1: Namespace
    count exceeded 3 at line 2(possibly around char 234)
    

解決方法

如果 XMLThreatProtection 政策旨在防止酬載超過單一元素中的特定命名空間數量,則會顯示錯誤訊息。在這種情況下,您不需要採取額外行動。

不過,如果您認為可以允許更多命名空間,請根據需求將 <StructureLimits> 元素的 <NamespaceCountPerElement> 子元素修改為適當的值。

舉例來說,如果您認為單一元素最多可包含 5 個命名空間,請按照下列方式修改政策:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>5</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>20</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>40</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>30</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

InvalidXMLPayload

錯誤代碼

steps.xmlthreatprotection.ExecutionFailed

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition [policy_name]:
        Execution failed. Reason: [error_description]",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Execution failed. reason: Syntax error while parsing XML prologue",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

原因

如果 XMLProtectionPolicy 政策的 <Source> 元素指定的輸入訊息酬載不是有效的 XML 文件,就會發生這個錯誤。

診斷

  1. 請查看錯誤訊息,找出發生錯誤的政策名稱。在以下範例中,政策名稱為 XML-Threat-Protection-1

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: Syntax error while parsing XML prologue
    
  2. 檢查輸入酬載,並確認在酬載中傳遞的 XML 文件是否確實為正確格式的 XML 文件。

    以下是輸入酬載的範例:

    <?xml version="1.0" encoding="UTF-8"?>
    <bookstore>
      <book category="cooking">
        <title lang="en">Easy Indian Cooking</title>
        <author>Suneeta</author>
        <year>2004</year>
        <price>300.00</price>
      </book>
    <bookstore>
    

    在上述 XML 酬載中,由於缺少 /,第 9 行無法正確關閉根元素。由於這不是正確格式的 XML,因此會收到以下錯誤訊息:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Execution failed.
    reason: Syntax error while parsing XML prologue
    

解決方法

確保有效的輸入 XML 酬載會傳送至任何包含 XMLThreatProtection 政策的 API 代理程式。

如要修正上述範例錯誤,請修改輸入 XML 酬載,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="cooking">
    <title lang="en">Easy Indian Cooking
    <author>Suneeta</author>
    <year>2004</year>
    <price>300.00</price>
  </book>
</bookstore>

SourceUnavailable

錯誤代碼

steps.xmlthreatprotection.SourceUnavailable

錯誤回應主體

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition[policy_name]: Source[var_name] is not available"
        "detail": {
            "errorcode": "steps.xmlthreatprotection.SourceUnavailable"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XML-Threat-Protection-1:
        Source requests is not available",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.SourceUnavailable"
        }
    }
}

原因

如果 XMLThreatProtection 政策的 <Source> 元素中指定的 message 變數為下列任一情況,就會發生這個錯誤:

  • 超出範圍 (無法在執行政策的特定流程中使用)
  • 不是有效值 requestresponsemessage

舉例來說,如果政策中的 <Source> 元素設為在執行政策的流程中不存在的變數,就會發生這項錯誤。

診斷

  1. 請從錯誤訊息中找出 XMLThreatProtection 政策名稱和 Source 變數名稱。舉例來說,在以下錯誤訊息中,XMLThreatProtection 政策名稱為 XML-Threat-Protection-1,而 Source 變數為 requests:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Source requests
    is not available
    
  2. 檢查失敗的 XMLThreatProtection 政策,並查看針對步驟 1 中指出的 <Source> 元素指定的值。

    在以下 XMLThreatProtection 政策範例中,<Source> 元素會設為 requests

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>10</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>requests</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>5</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>20</Text>
            <Attribute>15</Attribute>
            <NamespaceURI>40</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>30</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    

    <Source> 元素的有效值為 requestresponsemessage.。由於 requests 不是有效值,且在執行政策的流程中不存在,因此您會收到以下錯誤:

    XMLThreatProtection stepDefinition XML-Threat-Protection-1: Source requests
    is not available
    

解決方法

請確認失敗的 XMLThreatProtection 政策在 <Source> 元素中設定的變數已設為 requestresponsemessage,且在政策執行的流程中存在。

如要修正上述範例政策,您可以修改 <Source> 元素,以便使用 request 變數,因為該變數存在於要求流程中:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>request</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>20</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>40</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>30</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>

NonMessageVariable

錯誤代碼

steps.xmlthreatprotection.NonMessageVariable

錯誤回應主體

{
    "fault": {
        "faultstring": "Variable var_name does not resolve to a Message"
        "detail": {
            "errorcode": "steps.xmlthreatprotection.NonMessageVariable"
        }
    }
}

錯誤回應主體範例

{
    "fault": {
        "faultstring": "Variable message.content does not resolve to a Message",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.NonMessageVariable"
        }
    }
}

原因

如果 XMLThreatProtection 政策中的 <Source> 元素設為非 message 類型的變數,就會發生這個錯誤。

訊息類型變數代表整個 HTTP 要求和回應。內建的 Apigee 流程變數 requestresponsemessage 的類型為 Message。如要進一步瞭解訊息變數,請參閱流程變數參考資料

診斷

  1. 從錯誤訊息中找出會解析為 Message 類型變數的變數名稱。例如,在以下錯誤訊息中,變數名稱為 message.content

    Variable message.content does not resolve to a Message
    
  2. 檢查發生錯誤的 API 代理程式中所有 XMLThreadProtection 政策,並找出特定的 XMLThreadProtection 政策,其中 <Source> 元素會使用上述步驟 1 中指出的變數名稱進行指定。

    在以下 XMLThreatProtection 政策範例中,<Source> 會設為 message.content

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
        <DisplayName>XML Threat Protection-1</DisplayName>
        <Properties/>
        <NameLimits>
            <Element>10</Element>
            <Attribute>10</Attribute>
            <NamespacePrefix>10</NamespacePrefix>
            <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
        </NameLimits>
        <Source>message.content</Source>
        <StructureLimits>
            <NodeDepth>10</NodeDepth>
            <AttributeCountPerElement>5</AttributeCountPerElement>
            <NamespaceCountPerElement>3</NamespaceCountPerElement>
            <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
        </StructureLimits>
        <ValueLimits>
            <Text>20</Text>
            <Attribute>15</Attribute>
            <NamespaceURI>40</NamespaceURI>
            <Comment>10</Comment>
            <ProcessingInstructionData>30</ProcessingInstructionData>
        </ValueLimits>
    </XMLThreatProtection>
    

    由於變數 message.content 不是 Message 類型,因此您會收到以下錯誤訊息:

    Variable message.content does not resolve to a Message
    

解決方法

請確認失敗的 XMLThreatProtection 政策中的 <Source> 元素設為 message 流程變數,該變數必須存在於政策執行的流程中。

如要修正政策,您可以修改 <Source> 元素,指定 Message 類型的變數。舉例來說,在失敗的 XMLThreatProtection 中,您可以將 <Source> 元素指定為 message

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLThreatProtection async="false" continueOnError="false" enabled="true" name="XML-Threat-Protection-1">
    <DisplayName>XML Threat Protection-1</DisplayName>
    <Properties/>
    <NameLimits>
        <Element>10</Element>
        <Attribute>10</Attribute>
        <NamespacePrefix>10</NamespacePrefix>
        <ProcessingInstructionTarget>10</ProcessingInstructionTarget>
    </NameLimits>
    <Source>message</Source>
    <StructureLimits>
        <NodeDepth>10</NodeDepth>
        <AttributeCountPerElement>5</AttributeCountPerElement>
        <NamespaceCountPerElement>3</NamespaceCountPerElement>
        <ChildCount includeComment="true" includeElement="true" includeProcessingInstruction="true" includeText="true">3</ChildCount>
    </StructureLimits>
    <ValueLimits>
        <Text>20</Text>
        <Attribute>15</Attribute>
        <NamespaceURI>40</NamespaceURI>
        <Comment>10</Comment>
        <ProcessingInstructionData>30</ProcessingInstructionData>
    </ValueLimits>
</XMLThreatProtection>