首页 > 解决方案 > 如何在 Mule 4 中使用安全的 SOAP Web 服务

问题描述

您好我有一个安全的 SOAP 网络服务。我可以使用凭据成功地从 Soap UI 中点击。当我尝试在任何点工作室中配置 Web 服务时,我收到一条警告说无法获取元数据。但是,如果运行应用程序,我在尝试连接到 Web 服务时会出错。

Message : Error trying to acquire a new connection:null

我认为我为服务设置凭据的方式不正确。在 Soap UI 中,我将其设置为屏幕截图所示。如何在 Studio 中设置?我在工作室尝试了安全选项卡,但没有运气。

在此处输入图像描述

标签: mule4

解决方案


我假设您正在使用 Web 服务使用者连接器来使用外部 SOAP Web 服务。屏幕截图显示 SOAP UI 正在使用 HTTP 基本身份验证。要重现这一点,您需要将 Web 服务使用者配置为指向配置 HTTP 身份验证的 HTTP 请求者配置,如官方文档中所述:https ://docs.mulesoft.com/web-service-consumer-connector/ 1.5/web-service-consumer-configure#setting-a-custom-http-transport-configuration

例子:

<http:request-config name="basic-auth">
    <http:request-connection host="www.someplace.com" port="8182" protocol="HTTP">
        <http:authentication>
            <http:basic-authentication username="alejandro.garcia" password="nariz"/>
        </http:authentication>
    </http:request-connection>
</http:request-config>

<wsc:config name="with-custom-transport">
    <wsc:connection wsdlLocation="http://www.host.com?WSDL" service="Service" port="Port">
        <wsc:custom-transport-configuration>
            <wsc:http-transport-configuration requesterConfig="basic-auth"/>
        </wsc:custom-transport-configuration>
    </wsc:connection>
</wsc:config>

推荐阅读