如何在 Mule 4 中使用安全的 SOAP Web 服务

How to consume secured SOAP Webservice in Mule 4

您好,我有一个安全的 SOAP Web 服务。我能够使用凭证从 Soap UI 成功命中。 当我尝试在 any point studio 中配置 Web 服务时,我收到一条警告说无法获取元数据。但是如果 运行 应用程序在尝试连接到 web 服务时出现错误。

Message : Error trying to acquire a new connection:null

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

我假设您使用 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>