1
votes

I'm trying to edit an api resource in WSO2 ESB to put query params dinamically in the end of endpoint URL.

At this moment, the resource is like this:

<resource methods="GET" uri-template="/searchEngine/sortAndFilterBeneficiaries*">
  <inSequence>
     <log level="custom">
        <property name="Access token value" expression="$trp:Authorization"/>
     </log>
     <oauthService remoteServiceUrl="https://server:port/services/" username="[email protected]" password="admin"/>
     <header name="Authorization" scope="transport" action="remove"/>
     <send>
        <endpoint>
           <http method="get"
                uri-template="http://server:port/project-web-services/services/project-rs/searchEngine/sortAndFilterBeneficiaries?criterioOrdenacion={query.param.criterioOrdenacion}&amp;registrosPorPagina={query.param.registrosPorPagina}&amp;numPagina={query.param.numPagina}&amp;userId={query.param.userId}&amp;serviciosSeleccionados={query.param.serviciosSeleccionados}&amp;fechaRequerida={query.param.fechaRequerida}&amp;limiteInfDias={query.param.limiteInfDias}&amp;limiteSupDias={query.param.limiteSupDias}&amp;ubicacion={query.param.ubicacion}&amp;limiteDistancia={query.param.limiteDistancia}&amp;valoraciones={query.param.valoraciones}&amp;competencias={query.param.competencias}"/>
        </endpoint>
     </send>
  </inSequence>

But, I'm doing this:

<resource methods="GET" url-mapping="/searchEngine/sortAndFilterBeneficiaries*">
  <inSequence>
  <filter source="$ctx:query.param.criterioOrdenacion" regex="PRODUCTION">
<then>
                <property name="REST_URL_POSTFIX" expression="fn:concat(get-property('axis2','REST_URL_POSTFIX'), '&amp;criterioOrdenacion={query.param.type}')" scope="axis2" type="STRING"/>
</then>
  </filter>
     <log level="custom">
        <property name="Access token value" expression="$trp:Authorization"/>
     </log>
     <oauthService remoteServiceUrl="https://server:port/services/" username="[email protected]" password="admin"/>
     <header name="Authorization" scope="transport" action="remove"/>
     <send>
        <endpoint>
           <http method="get"
                uri-template="http://server:port/project-web-services/services/project-rs"/>
        </endpoint>
     </send>
  </inSequence>

Is this correct?

1

1 Answers

0
votes

This is correct. When you want to change base path only one endpoint will be affected, but in first case you must update all dynamic endpoint.