【发布时间】:2015-03-28 11:22:20
【问题描述】:
我们有本地运行的 CXF Web 服务,可通过 HTTPS TLS/SSL 访问。我们想使用 Mule 的
我们已经使用
这行得通:
<pattern:web-service-proxy name="unsecure_ws_proxy"
inboundAddress="http://localhost:80/services/service_common_name"
outboundAddress="http://localhost:8080/app_name/proxied_service_name"
/>
这不起作用(产生“所需的对象/属性“tls-key-store”为空“):
<pattern:web-service-proxy name="secure_ws_proxy"
inboundAddress="https://localhost:443/services/service_common_name"
outboundAddress="https://localhost:8443/app_name/proxied_service_name"
/>
我们已经定义了一个
这个假设是否正确,如果正确,我们如何告诉
编辑:
我们正在使用 Mule v.3.6.0。
为了完整起见,我们的 TLS_Context(我们还不知道如何将其与模式关联:web-service-proxy,如果这就是答案的话):
<tls:context name="TLS_Context" doc:name="TLS Context">
<tls:trust-store path="${ssl.truststore.path}" password="${ssl.truststore.password}"/>
<tls:key-store path="${ssl.keystore.path}" password="${ssl.keystore.password}" keyPassword="${ssl.keystore.password}"/>
</tls:context>
回答:
以下是完整的解决方案,基于 David 接受的回复。不需要 TLS_Context。谢谢大卫:
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:script="http://www.mulesoft.org/schema/mule/scripting"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:https="http://www.mulesoft.org/schema/mule/https"
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
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern
http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/scripting
http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/https
http://www.mulesoft.org/schema/mule/https/3.0/mule-https.xsd">
<https:connector name="httpsConnector">
<!-- Not currently needed
<https:tls-client
path="${ssl.client.keystore.path}"
storePassword="${ssl.client.keystore.password}"/>
-->
<https:tls-key-store
path="${ssl.server.keystore.path}"
keyPassword="${ssl.server.keystore.password}"
storePassword="${ssl.server.keystore.password}"/>
<https:tls-server
path="${ssl.server.truststore.path}"
storePassword="${ssl.server.truststore.password}"/>
</https:connector>
<!-- Pattern-based configuration was introduced in Mule v.3.2 to decrease "the amount of
noise in its configuration files". Configuration patterns are, by design, not as
powerful as Mule FLows or Services. They have instead been designed for ease of use.
(http://www.mulesoft.org/documentation-3.2/display/32X/Understanding+Configuration+Patterns+Using+Mule) -->
<!-- MULE PATTERN PROXIES -->
<!-- HTTP -->
<pattern:web-service-proxy name="http_ws_proxy"
inboundAddress="http://localhost:80/services/service_common_name"
outboundAddress="http://localhost:8080/app_name/proxied_service_name"
/>
<!-- HTTPS -->
<pattern:web-service-proxy name="https_ws_proxy"
inboundAddress="https://localhost:443/services/service_common_name"
outboundAddress="https://localhost:8443/app_name/proxied_service_name"
/>
</mule>
【问题讨论】:
-
请显示您的 HTTPS 连接器的完整配置。不要忘记屏蔽您的 JKS 密码。另请说明您使用的 Mule 版本。
-
感谢您的回复。我们没有使用显式 HTTP 连接器。我们假设 Mule web-service-proxy Pattern 在幕后创建它。 Mule 配置文件中唯一的条目是我们在上面发布的内容。如前所述,“unsecure_ws_proxy”工作正常(没有明确的连接器)。为了简单起见,我们选择了一种模式而不是流。
-
Mule 会在您未明确配置它们时创建默认连接器。对于 HTTPS,默认连接器没有任何 JKS 配置(显然),因此您必须明确并配置它。
-
啊哈!谢谢!我们会试一试。我假设连接器必须命名为“httpsConnector”,因为这就是 Mule 找到它的方式?
-
不,它按类型找到它。名字可以是任何东西。
标签: web-services ssl https proxy mule