1

我使用 Mule Server 3.3.0 CE,生成以下代码:

 <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd
    http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.3/mule-pattern.xsd
    http://www.mulesoft.org/schema/mule/spring-security
    http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd
    http://www.springframework.org/schema/security 
    http://www.springframework.org/schema/security/spring-security-3.1.xsd">

<mule-ss:security-manager>
    <mule-ss:delegate-security-provider
        name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>

<spring:beans>
    <ss:authentication-manager alias="authenticationManager">
        <ss:authentication-provider>
            <ss:user-service id="userService">
                <ss:user name="sepideh" password="16978413" authorities="ROLE_ADMIN" />
            </ss:user-service>
        </ss:authentication-provider>
    </ss:authentication-manager>
</spring:beans>


<pattern:web-service-proxy name="myService"
    wsdlLocation="http://ws.acme.com:6090/wsdl/weather-forecast">
    <http:inbound-endpoint address="http://localhost:8090/service">
        <mule-ss:http-security-filter realm="mule-realm" />
    </http:inbound-endpoint>
    <http:outbound-endpoint address="http://ws.acme.com:6090/weather-forecast" />
</pattern:web-service-proxy>

我运行这个项目,我有以下异常:

ERROR 2012-11-27 14:31:25,456 [[web_service].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8090/service. Message payload is of type: String
Code                  : MULE_ERROR-54999
--------------------------------------------------------------------------------
Exception stack is:
1. Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8090/service. Message payload is of type: String (org.mule.api.security.UnauthorisedException)
org.mule.transport.http.filters.HttpBasicAuthenticationFilter:160 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/security/UnauthorisedException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.security.UnauthorisedException: Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8090/sevice. Message payload is of type: String
    at org.mule.transport.http.filters.HttpBasicAuthenticationFilter.authenticateInbound(HttpBasicAuthenticationFilter.java:160)
    at org.mule.security.AbstractEndpointSecurityFilter.authenticate(AbstractEndpointSecurityFilter.java:58)
    at org.mule.security.AbstractAuthenticationFilter.doFilter(AbstractAuthenticationFilter.java:56)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

新的 wsdl 地址显示给我,但我不能使用这个地址来创建 Web 服务。此页面的所有解决方案链接,但我不知道如何将 SoapUI 更改为真实值。我应该在我的配置中更改什么?

4

2 回答 2

3

发布此内容可能会对某些人有所帮助。将 HTTP 连接器从 Mule 较低版本迁移到 3.6+ 或 3.7 的人(因为,我在升级时遇到了这个错误)。请按照链接 https://docs.mulesoft.com/mule-user-guide/v/3.6/configuring-the-spring-security-manager(我们不能mule-realm像在版本 3.3 中那样配置 HTTP 侦听器)。当您尝试从 SOAP UI 中点击它时,您会发现上述错误Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session。这不是 Mule 配置文件的问题。需要更改 SOAPUI 设置

解决此错误的 2 种方法:

转到 SOAPUI->File->Preference->HTTP settings-> enable 选项Authenticate Preemptively

在 SOAPUI
Authorization->Basic -> Pre-emptive auth -> enable中设置基本身份验证时Authenticate Pre-emptively。默认情况下,它将是“使用全局首选项”,需要更改为Authenticate Pre-emptively

谢谢。

于 2016-05-09T04:47:37.840 回答
0

似乎相关,你得到的错误是一个红鲱鱼。即使正在记录,您是否会收到成功响应? http://www.mulesoft.org/jira/browse/MULE-5607

于 2013-03-27T13:11:31.820 回答