2015-06-03 37 views
1

我试图编辑WSO2 ESB中的api资源,以便在查询参数中以终点URL结尾。在端点API WSO2处动态添加查询参数ESB

此时,资源是这样的:

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

但是,我这样做:

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

这是正确的吗?

回答

0

这是正确的。当您想更改基本路径时,只有一个端点会受到影响,但在第一种情况下,您必须更新所有动态端点。