我需要动态地传递soap安全用户名和密码给外绑定网关。为此,我试图将json请求中接收到的用户名设置为入站http标头,然后将其设置为头--将其作为soap操作,并将其用于定制的Wss4jSecurityInterceptor拦截器中。当我试图设置为http头时,我得到了异常,如下所示:
嵌套的例外是:
org.springframework.expression.spel.SpelEvaluationException: EL1008E:在'org.springframework.util.LinkedMultiValueMap‘类型的对象上找不到属性或字段“abc.secUserName”--可能不是公共的?]使用根原因org.springframework.expression.spel.SpelEvaluationException: EL1008E:属性或字段'abc.secUserName‘无法在'org.springframework.util.LinkedMultiValueMap’类型的对象上找到--可能不是公共的?在org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:224) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94)
我的spring配置如下:
<int-http:inbound-gateway request-channel="requestChannel" reply-channel="replyChannel"
supported-methods="POST" message-converters="converters" request-payload-type="XXX"
path="XXX" error-channel="errorChannel">
<int-http:request-mapping consumes="application/json" produces="application/json" />
<int-http:header name="secUserName" expression="#requestParams.abc.secUserName" />
</int-http:inbound-gateway>
<int:chain input-channel="xxxChannel" output-channel="responseChannel">
<int-ws:header-enricher >
<int-ws:soap-action expression="headers.secUserName"/>
</int-ws:header-enricher>
<int-ws:outbound-gateway uri="Xxx"
message-sender="messageSender" interceptor="xxx" marshaller="xxx">
<int-ws:request-handler-advice-chain>
<ref bean="outboundInterceptor" />
</int-ws:request-handler-advice-chain>
</int-ws:outbound-gateway>
</int:chain>JSON请求:
{
"abc":{
"secUserName" :"mmmm",
"xyz": "xyz"
}
}请让我知道我做错了什么。此外,请让我知道是否有任何替代办法。
发布于 2017-08-10 12:16:22
我认为您的abc是一个传入的请求体,而不是您试图在表达式中解析的查询解析器。
试试这个表达式:body.abc.secUserName,因为HttpEntity正是计算上下文的根对象。
https://stackoverflow.com/questions/45610532
复制相似问题