Bạn đang xem tài liệu về Apigee Edge.
Chuyển đến
Tài liệu về Apigee X. thông tin
InvalidRegularExpression
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Deploying Revision revision_number to environment RegularExpressionProtection policy_name: Invalid Regular Expression com.apigee.steps.regexprotection.RegularExpressionProtectionBean$RegexPattern@f4ecb23, Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.
Ví dụ về thông báo lỗi
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Invalid Regular Expression com.apigee.steps.regexprotection.RegularExpressionProtectionBean$RegexPattern@f4ecb23, Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu biểu thức chính quy trong phần tử <Pattern>
của RegularExpressionProtection không hợp lệ, thì việc triển khai Proxy API sẽ không thành công.
Chẩn đoán
Xác định tên của RegularExpressionProtection trong thông báo lỗi. Ví dụ: trong lỗi sau, tên của RegularExpressionProtection là
Regular-Expression-Protection-1:
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Invalid Regular Expression com.apigee.steps.regexprotection.RegularExpressionProtectionBean$RegexPattern@f4ecb23, Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Kiểm tra tất cả các phần tử
<Pattern>
trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi. Kiểm tra xem có phần tử<Pattern>
nào chứa biểu thức chính quy không hợp lệ hay không. Nếu bất kỳ phần tử nào<Pattern>
có biểu thức chính quy không hợp lệ, thì đó là nguyên nhân gây ra lỗi.Ví dụ: chính sách sau đây chỉ định giá trị của
Pattern>
củafoo){2}
, được coi là Biểu thức chính quy không hợp lệ:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <URIPath> <Pattern>foo){2}</Pattern> </URIPath> <Source>request</Source> </RegularExpressionProtection>
Trong ví dụ trên, biểu thức chính quy được chỉ định trong
<Pattern>
bị thiếu dấu ngoặc đơn mở. Do đó, nó được coi là một biểu thức chính quy không hợp lệ. Do đó, việc triển khai Proxy API không thành công.
Độ phân giải
Đảm bảo rằng mỗi phần tử <Pattern>
trong chính sách RegularExpressionProtection đều chứa một biểu thức chính quy hợp lệ. Bạn có thể tìm kiếm các công cụ biểu thức chính quy trực tuyến hoặc ngoại tuyến để gỡ lỗi biểu thức chính quy.
Để sửa chính sách Bảo vệ biểu thức chính quy mẫu được trình bày ở trên, hãy thêm dấu ngoặc đơn bị thiếu:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <URIPath> <Pattern>(foo){2}</Pattern> </URIPath> <Source>request</Source> </RegularExpressionProtection>
XPathCompilationFailed
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Deploying Revision revision_number to environment RegularExpressionProtection policy_name: Failed to compile xpath xpath_expression. Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.
Ví dụ về thông báo lỗi
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile xpath /notapigee:foo/notapigee:bar. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu tiền tố hoặc giá trị dùng trong phần tử <XPath>
không thuộc bất kỳ không gian tên đã khai báo nào trong regularExpressionProtection, thì việc triển khai proxy API sẽ không thành công.
Bạn có thể tìm thêm thông tin về không gian tên, Wi-Fi và tiền tố trong bài viết Không gian tên XML và cách chúng ảnh hưởng đến giám sát và chẩn đoán diễn ra chẩn đoán.
Chẩn đoán
Xác định tên của RegularExpressionProtection nơi xảy ra lỗi và Biểu thức Wi-Fi được sử dụng. Bạn có thể tìm thấy cả hai mục này trong thông báo lỗi.
Ví dụ: trong lỗi sau, tên chính sách là
Regular-Expression-Protection-1
và Biểu thức NETWORK là/notapigee:foo/notapigee:bar:
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile xpath /notapigee:foo/notapigee:bar. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác minh rằng Wi-Fi được đặt trong phần tử
Expression
khớp với diễn ra trong thông báo lỗi (bước #1 ở trên).Ví dụ: chính sách sau đây chỉ định NETWORK là
/notapigee:foo/notapigee:bar
khớp với nội dung trong thông báo lỗi:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/notapigee:foo/notapigee:bar</Expression> <Type>nodeset</Type> <Pattern>pattern</Pattern> <Pattern>pattern2</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
- Kiểm tra các phần tử
<Namespaces>
và<Expression>
trong RegularExpressionProtection. Nếu<Expression>
cụ thể được biểu thị trong thông báo lỗi sử dụng tiền tố hoặc giá trị không thuộc vùng chứa tên được khai báo trong Chính sách thường xuyênExpressionProtection, thì đó là nguyên nhân gây ra lỗi.Xin lưu ý rằng
<XPath>
cụ thể sẽ sử dụng tiền tốnotapigee
trong ví dụ về RegularExpressionProtection:<Expression>/notapigee:foo/notapigee:bar</Expression>
Tuy nhiên, tiền tố
notapigee
không được xác định trong bất kỳ phần tử<Namespace>
nào; do đó, việc biên dịch<XPath>
không thành công dẫn đến lỗi triển khai.
Độ phân giải
Đảm bảo bạn khai báo tất cả các không gian tên đang dùng trong các phần tử <Expression>
trong các phần tử <XPath>
trong chính sách RegularExpressionProtection. Để khắc phục ví dụ trên, bạn có thể thay thế tiền tố notapigee
thành apigee
, được khai báo trong không gian tên:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:foo/apigee:bar</Expression> <Type>nodeset</Type> <Pattern>pattern</Pattern> <Pattern>pattern2</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
CannotBeConvertedToNodeset
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Deploying Revision revision_number to environment RegularExpressionProtection policy_name: Result of xpath xpath_expression cannot be converted to nodeset. Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.
Ví dụ về thông báo lỗi
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Result of xpath count(//apigee:foo) cannot be converted to nodeset. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu Chính sách biểu thức chính quy có biểu thức <XPath>
, trong đó phần tử <Type>
được xác định là nodeset, nhưng không thể chuyển đổi biểu thức đó thành tập hợp nút, thì việc triển khai proxy API sẽ không thành công.
Chẩn đoán
Xác định chính sách RegularExpressionProtection nơi xảy ra lỗi và Biểu thức vai trò không thể chuyển đổi thành bộ nút. Bạn có thể tìm thấy cả hai mục này trong thông báo lỗi.
Ví dụ: trong lỗi sau, tên chính sách là
Regular-Expression-Protection-1
và Biểu thức NETWORK làcount(//apigee:foo):
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Result of xpath count(//apigee:foo) cannot be converted to nodeset. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Trong XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác minh rằng diễn ra trong phần tử
<Expression>
của phần tử<XPath>
khớp với diễn ra trong thông báo lỗi (bước #1 ở trên).Ví dụ: chính sách sau đây chỉ định là
count(//apigee:foo)
, khớp với nội dung trong thông báo lỗi:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>count(//apigee:foo)</Expression> <Type>nodeset</Type> <Pattern>pattern</Pattern> <Pattern>pattern2</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
Kiểm tra giá trị được đặt trong phần tử
<Type>
bên dưới phần tử<XPath>
. Nếu phần tử<Type>
lànodeset
, thì đó là nguyên nhân gây ra lỗi.Trong ví dụ này, biểu thức NETWORK là count() không trả về một hoặc nhiều nút. Do đó, việc triển khai Proxy API không thành công.
Độ phân giải
Nếu phần tử <Type>
được đặt thànhnodeset, hãy đảm bảo rằng kết quả của phần tử <Expression>
được đặt trong <XPath>
là một hoặc nhiều nút. Ngoài ra, hãy thay đổi phần tử <Type>
thành một giá trị phù hợp hơn tuỳ theo trường hợp sử dụng của bạn.
Để khắc phục ví dụ trên, bạn có thể thay đổi phần tử <Expression>
thành một giá trị khác có thể trả về các nút:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:foo/apigee:bar</Expression> <Type>nodeset</Type> <Pattern>pattern</Pattern> <Pattern>pattern2</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
JSONPathCompilationFailed
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Deploying Revision revision_number to environment RegularExpressionProtection policy_name: Failed to compile jsonpath jsonpath_expression Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.
Ví dụ về thông báo lỗi
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile jsonpath $.store.book[*.author. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu bạn đặt phần tử <Expression>
trong phần tử <JSONPath>
của chính sách Bảo vệ biểu thức chính quy thành một biểu thức JSONPath không hợp lệ, thì việc triển khai proxy API sẽ không thành công.
Chẩn đoán
Xác định tên của chính sách RegularExpressionProtection nơi xảy ra lỗi và biểu thức JSONPath không hợp lệ được sử dụng. Bạn có thể tìm thấy cả hai mục này trong thông báo lỗi.
Ví dụ: trong lỗi sau, tên chính sách là
Regular-Expression-Protection-1
và Biểu thức JSONPath là$.store.book[*.author:
Error Deploying Revision 1 to test RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile jsonpath $.store.book[*.author. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
Trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác minh rằng JSONPath được đặt trong phần tử
Expression
khớp với JSONPath được xác định trong thông báo lỗi (bước #1 ở trên).Ví dụ: chính sách sau đây chỉ định phần tử
Expression
trong phần tử<JSONPath>
thành$.store.book[*.author
. Phần tử này khớp với nội dung trong thông báo lỗi:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <JSONPayload> <JSONPath> <Expression>$.store.book[*.author</Expression> <Pattern>REGEX PATTERN</Pattern> <Pattern>REGEX PATTERN</Pattern> </JSONPath> </JSONPayload> </RegularExpressionProtection>
Hãy kiểm tra phần tử
<Expression>
thuộc phần tử<JSONPath>
của chính sách. Nếu tệp này không khớp với cú pháp JSONPath, thì đây là nguyên nhân gây ra lỗi. Trong ví dụ trên, dấu ngoặc vuông đóng bị thiếu khiến biểu thức không hợp lệ.Vì Biểu thức đường dẫn JSON không hợp lệ nên không triển khai Proxy API được.
Độ phân giải
Đảm bảo rằng giá trị cho phần tử <Expression>
bên trong phần tử <JSONPath>
trong chính sách Bảo vệ biểu thức chính quy là một biểu thức JSONPath hợp lệ.
Để sửa ví dụ ở trên, bạn có thể thêm dấu ngoặc vuông đóng còn thiếu vào giá trị phần tử <Expression>
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <JSONPayload> <JSONPath> <Expression>$.store.book[*].author</Expression> <Pattern>REGEX PATTERN</Pattern> <Pattern>REGEX PATTERN</Pattern> </JSONPath> </JSONPayload> </RegularExpressionProtection>
NothingToEnforce
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Saving Revision revision_number RegularExpressionProtection policy_name: at least one of URIPath, QueryParam, Header, FormParam, XMLPayload, JSONPayload is mandatory.
Ví dụ về thông báo lỗi
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: at least one of URIPath, QueryParam, Header, FormParam, XMLPayload, JSONPayload is mandatory.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu chính sách RegularExpressionProtection không có bất kỳ phần tử nào <URIPath>
, <QueryParam>
, <Header>
, <FormParam>
, <XMLPayload>
hoặc <JSONPayload>
, thì việc triển khai Proxy API sẽ không thành công.
Như đã nêu trong thông báo lỗi, chính sáchRegularExpressionProtection phải có ít nhất một trong các phần tử sau đây thuộc chính sách này: <URIPath>
, <QueryParam>
, <Header>
, <FormParam>
, <XMLPayload>
hoặc <JSONPayload>
.
Chẩn đoán
Xác định tên của chính sáchRegularExpressionProtection nơi xảy ra lỗi. Bạn có thể tìm thấy mã này trong thông báo lỗi. Ví dụ: trong lỗi sau, tên chính sách sẽ là
Regular-Expression-Protection-1:
RegularExpressionProtection Regular-Expression-Protection-1: at least one of URIPath, QueryParam, Header, FormParam, XMLPayload, JSONPayload is mandatory.
Kiểm tra Chính sách bảo vệ biểu thức chính quy bị lỗi (được xác định ở bước 1 ở trên). Nếu chính sách này không có cả một trong các phần tử sau:
<URIPath>
,<QueryParam>
,<Header>
,<FormParam>
,<XMLPayload>
hoặc<JSONPayload>
, thì đó là nguyên nhân gây ra lỗi.Ví dụ: Chính sách Bảo vệ biểu thức chính quy sau đây không có bất kỳ thành phần nào nêu trên:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> </RegularExpressionProtection>
Vì không có phần tử bắt buộc nào trong chính sách Trích xuất biến, nên bạn không thể triển khai proxy API.
Độ phân giải
Đảm bảo rằng Chính sáchRegularExpressionProtection có ít nhất một trong các phần tử bắt buộc sau: <URIPath>
, <QueryParam>
, <Header>
, <FormParam>
, <XMLPayload>
hoặc <JSONPayload>
. Ví dụ:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <JSONPayload> <JSONPath> <Expression>$.store.book[*].author</Expression> <Pattern>REGEX PATTERN</Pattern> <Pattern>REGEX PATTERN</Pattern> </JSONPath> </JSONPayload> </RegularExpressionProtection>
NoPatternsToEnforce
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Saving Revision revision_number RegularExpressionProtection policy_name: No patterns to enforce in payload_name.
Ví dụ về thông báo lỗi
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: No patterns to enforce in XPath.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu bất kỳ phần tử cấp cao nhất nào (<URIPath>
, <QueryParam>
, <Header>
, <FormParam>
, <XMLPayload>
hoặc <JSONPayload>
) không có phần tử <Pattern>
được xác định trong chính sách thường xuyênExpressionProtection, thì việc triển khai proxy API sẽ không thành công.
Chẩn đoán
Xác định tên của chính sách RegularExpressionProtection nơi xảy ra lỗi và phần tử con không có phần tử
<Pattern>
. Bạn có thể tìm thấy cả hai mục này trong thông báo lỗi.Ví dụ: trong lỗi sau, tên chính sách là
Regular-Expression-Protection-1
và phần tử con làXPath:
RegularExpressionProtection Regular-Expression-Protection-1: No patterns to enforce in XPath.
- Kiểm tra chính sách Bảo vệ biểu thức chính quy không thành công và xác minh xem phần tử con được xác định ở bước 1 có phần tử
<Pattern>
hay không. Nếu phần tử<Pattern>
không tồn tại trong đó, thì đó là nguyên nhân gây ra lỗi.Ví dụ: chính sách sau đây không có phần tử
<Pattern>
bên trong<XPath>
:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> </XPath> </XMLPayload> </RegularExpressionProtection>
Vì phần tử
<XPath>
không có phần tử<Pattern>
nên không triển khai Proxy API được.
Độ phân giải
Đảm bảo rằng mọi phần tử <URIPath>
, <QueryParam>
, <Header>
, <FormParam>
, <XMLPayload>
hoặc <JSONPayload>
đều có ít nhất một <Pattern>
được chỉ định. Xem Chính sách RegularExpressionProtection để biết thông tin về cách chỉ định chính xác phần tử.
Để khắc phục ví dụ ở trên, chúng ta chỉ cần thêm phần tử <Pattern>
vào phần tử <XPath>
bên dưới <XMLPayload>
:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
NONEmptyPrefixMappedToEmptyURI
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Saving Revision revision_number RegularExpressionProtection policy_name: Non-empty prefix prefix_name cannot be mapped to empty uri.
Ví dụ về thông báo lỗi
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: Non-empty prefix apigee cannot be mapped to empty uri.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Lỗi này xảy ra nếu RegularExpressionProtection có một tiền tố được xác định trong phần tử <Namespace>
thuộc phần tử <XMLPayload>
, nhưng không có URI nào được xác định.
Chẩn đoán
Xác định chính sách RegularExpressionProtection nơi xảy ra lỗi và tên của tiền tố chưa được liên kết với URI. Bạn có thể tìm thấy cả hai mục này trong thông báo lỗi.
Ví dụ: trong lỗi sau, tên chính sách là Bảo vệ biểu thức chính quy-1 và tiền tố là apigee:
RegularExpressionProtection Regular-Expression-Protection-1: Non-empty prefix apigee cannot be mapped to empty uri.
Trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác minh rằng tên của tiền tố được đặt trong phần tử
<Namespace>
trong phần tử<XMLPayload>
khớp với tên tiền tố được xác định trong thông báo lỗi (bước #1 ở trên).Ví dụ: chính sách sau đây chỉ định một tiền tố có tên là apigee trong phần tử
<Namespace>
, khớp với nội dung trong thông báo lỗi:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee"/> <Namespace prefix="gmail">http://mail.google.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
Xác thực xem phần tử
<Namespace>
có tiền tố cụ thể được xác định ở bước 2 có URI hợp lệ hay không. Nếu thiếu URI, thì đó là nguyên nhân gây ra lỗi.Trong ví dụ về Chính sách bảo vệ biểu thức chính quy trình bày ở trên, hãy lưu ý rằng không có URI nào tương ứng với phần tử
<Namespace>
có tiền tố apigee; do đó, bạn sẽ gặp lỗi:Non-empty prefix apigee cannot be mapped to empty uri.
Độ phân giải
Đảm bảo rằng tất cả phần tử <Namespace>
được xác định bằng một tiền tố đều có URI tương ứng trong chính sách Biến trích xuất. Ví dụ:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> <Namespace prefix="gmail">http://mail.google.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
DuplicatePrefix
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Saving Revision revision_number RegularExpressionProtection policy_name: Duplicate prefix prefix_name.
Ví dụ về thông báo lỗi
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: Duplicate prefix apigee.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Lỗi này xảy ra nếu RegularExpressionProtection có cùng một tiền tố được xác định nhiều lần trong phần tử <Namespace>
thuộc phần tử <XMLPayload>
.
Ví dụ: lỗi này xảy ra vì apigee tiền tố được xác định hai lần như sau:
<Namespace prefix="apigee">http://www.apigee.com</Namespace> <Namespace prefix="apigee">http://www.apigee.com</Namespace>
Chẩn đoán
Xác định chính sách RegularExpressionProtection nơi xảy ra lỗi và tên của tiền tố. Bạn có thể tìm thấy cả hai mục này trong thông báo lỗi.
Ví dụ: trong lỗi sau, tên chính sách là Bảo vệ biểu thức chính quy-1 và tiền tố là apigee:
RegularExpressionProtection Regular-Expression-Protection-1: Duplicate prefix apigee.
Trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác minh rằng tên của tiền tố được đặt trong phần tử
<Namespace>
trong phần tử<XMLPayload>
khớp với tên tiền tố được xác định trong thông báo lỗi (bước #1 ở trên).Ví dụ: chính sách sau đây chỉ định một tiền tố có tên là apigee trong phần tử
<Namespace>
, khớp với nội dung trong thông báo lỗi:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
Xác định xem phần tử
<Namespace>
có tiền tố cụ thể (được xác định ở bước 2) đã được xác định nhiều lần hay chưa. Nếu lỗi được xác định nhiều lần, thì đó là nguyên nhân gây ra lỗi.Trong ví dụ về chính sách Bảo vệ biểu thức chính quy trình bày ở trên, hãy lưu ý rằng phần tử
<Namespace>
có tiền tố apigee đã được xác định hai lần; do đó, bạn sẽ gặp lỗi:Duplicate prefix apigee.
Độ phân giải
Đảm bảo rằng chỉ có một định nghĩa cho mỗi tiền tố trong các phần tử <Namespace>
trong RegularExpressionProtection. Ví dụ:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
EmptyXPathExpression
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Saving Revision revision_number RegularExpressionProtection policy_name: Empty XPath expression.
Ví dụ về thông báo lỗi
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: Empty XPath expression.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu RegularExpressionProtection không có phần tử <Expression>
nào được đặt trong phần tử <XPath>
, thì việc triển khai proxy API sẽ không thành công.
Chẩn đoán
Xác định chính sách Bảo vệ biểu thức chính quy bị lỗi trong thông báo lỗi. Ví dụ: trong lỗi sau, tên chính sách là Regular-Expression-Protection-1:
RegularExpressionProtection Regular-Expression-Protection-1: Empty XPath expression.
Trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác định xem có phần tử
<XMLPayload>
chứa phần tử con<XPath>
không có phần tử<Expression>
nào được xác định trong đó hay phần tử<Expression>
không được đặt thành bất kỳ giá trị nào. Nếu có thì đó là nguyên nhân gây ra lỗi.Ví dụ: sau đây là chính sách Bảo vệ biểu thức chính quy có phần tử
<XMLPayload>
:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression></Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
Vì có phần tử
<Expression>
trống trong phần tử<XPath>
nên việc triển khai Proxy API không thành công.
Độ phân giải
Đảm bảo rằng RegularExpressionProtection có phần tử <Expression>
không trống và hợp lệ được xác định trong phần tử <XPath>
. Ví dụ:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <XMLPayload> <Namespaces> <Namespace prefix="apigee">http://www.apigee.com</Namespace> </Namespaces> <XPath> <Expression>/apigee:Greeting/apigee:User</Expression> <Type>string</Type> <Pattern>REGEX PATTERN</Pattern> </XPath> </XMLPayload> </RegularExpressionProtection>
EmptyJSONPathExpression
Thông báo Lỗi
Thông báo lỗi sau không triển khai được proxy API thông qua giao diện người dùng Edge hoặc API quản lý Edge:
Error Saving Revision revision_number RegularExpressionProtection policy_name: Empty JSONPath expression.
Ví dụ về thông báo lỗi
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: Empty JSONPath expression.
Ví dụ về ảnh chụp màn hình báo lỗi
Nguyên nhân
Nếu RegularExpressionProtection không có phần tử <Expression>
nào được đặt trong phần tử <JSONPath>
, thì việc triển khai proxy API sẽ không thành công.
Chẩn đoán
Xác định chính sách Bảo vệ biểu thức chính quy bị lỗi trong thông báo lỗi. Ví dụ: trong lỗi sau, tên chính sách là Regular-Expression-Protection-1:
Error Saving Revision 1 RegularExpressionProtection Regular-Expression-Protection-1: Empty JSONPath expression.
Trong tệp XML của chính sách Bảo vệ biểu thức chính quy bị lỗi, hãy xác định xem có phần tử
<JSONPayload>
nào chứa phần tử con<JSONPath>
chưa xác định phần tử<Expression>
trong đó hay phần tử<Expression>
không được đặt thành bất kỳ giá trị nào. Nếu có thì đó là nguyên nhân gây ra lỗi.Ví dụ: sau đây là chính sách Bảo vệ biểu thức chính quy có phần tử
<JSONPayload>
:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <JSONPayload> <JSONPath> <Expression></Expression> <Pattern>REGEX PATTERN</Pattern> <Pattern>REGEX PATTERN</Pattern> </JSONPath> </JSONPayload> </RegularExpressionProtection>
Vì có phần tử
<Expression>
trống trong phần tử<JSONPath>
nên việc triển khai Proxy API không thành công.
Độ phân giải
Đảm bảo rằng RegularExpressionProtection có phần tử <Expression>
không trống và hợp lệ được xác định trong phần tử <JSONPath>
. Ví dụ:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1"> <DisplayName>Regular Expression Protection-1</DisplayName> <Properties/> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Source>request</Source> <JSONPayload> <JSONPath> <Expression>$.store.book[*].author</Expression> <Pattern>REGEX PATTERN</Pattern> <Pattern>REGEX PATTERN</Pattern> </JSONPath> </JSONPayload> </RegularExpressionProtection>