0
votes

I need to pass soap security username and password dynamically to out bound gateway. For this I am trying to set the username received in json request to inbound http header and then set it in header-enricher as a soap action and utilize it in customized Wss4jSecurityInterceptor interceptor. When I am trying to set to http header I am getting exception as:

Nested exception is:

org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'abc.secUserName' cannot be found on object of type 'org.springframework.util.LinkedMultiValueMap' - maybe not public?] with root cause org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'abc.secUserName' cannot be found on object of type 'org.springframework.util.LinkedMultiValueMap' - maybe not public? at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:224) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94)

My spring configuration is as below:

<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 Request:

{
  "abc":{
    "secUserName" :"mmmm",
    "xyz": "xyz"
  }
}

Please let me know what I am doing wrong in it. And also please let me know if there is any alternative for it.

1

1 Answers

0
votes

I think your abc is an incoming request body, not a query param like you try to resolve in your expression .

Try this expression: body.abc.secUserName, since exactly HttpEntity is the root object of evaluation context there.