我正在为mulesoft runtime 4.1.0开发一个自定义验证器策略,当策略不满足时,我需要修改响应。为此,我在mulesoft docs:https://docs.mulesoft.com/api-manager/v/2.x/http-policy-transform上找到了这个页面,但是当我尝试使用xml名称空间http-transform时,我总是得到错误信息。
加载
时出错: /opt/mule/mule-4.1.2/policies/jwtvalidatorpolicy-315114/policy.xml,无法解析http://www.mulesoft.org/schema/mule/http-transform/current/mule-http-transform.xsd,可能缺少依赖项或插件
有人能提供正确的位置/名称空间吗?
谢谢!
发布于 2018-06-07 05:13:20
下面是使用上述扩展的完整示例
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http-policy="http://www.mulesoft.org/schema/mule/http-policy"
xmlns:http-transform="http://www.mulesoft.org/schema/mule/http-policy-transform"
xmlns="http://www.mulesoft.org/schema/mule/core"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http-policy-transform http://www.mulesoft.org/schema/mule/http-policy-transform/current/mule-http-policy-transform.xsd
http://www.mulesoft.org/schema/mule/http-policy http://www.mulesoft.org/schema/mule/http-policy/current/mule-http-policy.xsd">
<http-policy:proxy name="policy-deployment">
<http-policy:source>
<try>
<http-policy:execute-next/>
<http-transform:add-headers outputType="response">
<http-transform:headers>#[{'policyHeader': 'policyHeaderValue'}]</http-transform:headers>
</http-transform:add-headers>
</try>
</http-policy:source>
</http-policy:proxy>
</mule>
您还需要将以下依赖项添加到自定义策略项目
<dependency>
<groupId>com.mulesoft.anypoint</groupId>
<artifactId>mule-http-policy-transform-extension</artifactId>
<version>1.1.0</version>
<classifier>mule-plugin</classifier>
</dependency>
发布于 2018-10-23 14:11:41
对于那些同样遇到缺少依赖的问题的人:
这是一个企业专用插件。这意味着您需要配置maven设置文件,以便在mulesoft企业存储库中也进行搜索。有关如何做到这一点的文档,请参阅https://docs.mulesoft.com/mule-runtime/3.9/configuring-maven-to-work-with-mule-esb。如果您还没有此存储库的用户名/密码,请使用链接到您的企业订阅的帐户创建支持票证,他们将为您提供正确的凭据。
https://stackoverflow.com/questions/50626500
复制相似问题