Domanda

im trying to build an application changing the URL based on its value. the code i have so far is:

<flow name="CalculadoraHttpsSoap12Endpoint" doc:name="CalculadoraHttpsSoap12Endpoint">
    <http:inbound-endpoint exchange-pattern="request-response" address="${serverName}/Calculadora/services/Calculadora.CalculadoraHttpsSoap12Endpoint/" connector-ref="" doc:name="HTTP"/>
    <http:outbound-endpoint address="${targetServer4}/Calculadora/services/Calculadora.CalculadoraHttpsSoap12Endpoint/" exchange-pattern="request-response"/>
</flow>

This code only gets the message from ${serverName}/Calculadora/services/Calculadora.CalculadoraHttpsSoap12Endpoint and sends it to ${targetServer4}/Calculadora/services/Calculadora.CalculadoraHttpsSoap12Endpoint/

But what im trying to do is if some message is ${serverName}/Calculadora/services/Calculadora.CalculadoraHttpsSoap12Endpoint?att=1234 change it to ${serverName}/Calculadora/services/Calculadora.CalculadoraHttpsSoap12Endpoint?att1=4567

and send it to the outbound location, any clue on how to do it?

Mule version 3.4.0

È stato utile?

Soluzione

You can get the query string and define variables:

<set-variable variableName="myAtt" value="#[message.inboundProperties['http.query.string'] == 'att=1234' ? '?att1=4567' : '']"/>
<set-variable variableName="myUrl" value="#[message.inboundProperties['http.query.string'] == 'att=1234' ? 'localhost' : '${targetServer4}']" />

<http:outbound-endpoint address="http://#[myUrl]/somepath/#[myAtt]" exchange-pattern="request-response"/>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top