Search code examples
wso2esbwso2-esb

how to rewrite the url in wso2esb


I am using wso2ESB to obtain a login ticket from alfresco using the alfresco username and password. After I call the service

http://xx.xx.xxx.xx:8282/services/AlfrescoLogin

I have to append

http://xx.xx.xxx.xx:8282/services/AlfrescoLogin?u=xxx&pw=xxx

I have defined the following service:

<proxy name="AlfrescoLogin" transports="https http" startOnLoad="true" trace="disable">
        <target>
            <endpoint>
                <address uri="http://XX.XX.XXX.XX:8080/alfresco/s/api/login"/>
            </endpoint>
            <inSequence>
                <rewrite>
                    <rewriterule>
                        <action value="u=xxxxx" type="set" fragment="query"/>
                        <action value="pw=xxxxx" type="set" fragment="query"/>
                    </rewriterule>
                </rewrite>
            </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </target>
    </proxy>

But the following configuration has no effect. I've tried to set the type attribute of the action tag to append as well. And I still have to add by hand the parameters to the url.


Solution

  • The following URL rewrite configuration would do the required transformation to your URL.

    <rewrite>
        <rewriterule>
            <action value="u=xxx&amp;pw=xxx" type="set" fragment="query"/>
        </rewriterule>
    </rewrite>