简体   繁体   中英

Mule - Communication between Web application and Mule ESB

My web application is on following address:

http://localhost:8080/MyProject/page-obj.html

I am calling Mule Project, from a Web Application(deployed on glassfish), having following URL in page:

`<form action="http://localhost:28146/CallObject" method="post" id="objform">`

Mule project is executing something on remote server and returning Success.

I want to redirect success to another page say

http://localhost:8080/MyProject/page-sucess.html

When redirect, i see http://localhost:28146/CallObject on address bar, instead of http://localhost:8080/MyProject/page-sucess.html . Secondly, i am unable to load CSS and JS properly. I think i am not handling this properly

Following is Mule Flow in use:

`

<http:endpoint exchange-pattern="request-response" address="http://localhost:8080/MyProject/page-sucess.html" name="page" method="POST"/>

    <flow name="Create_Work_Flow" doc:name="Create_Work_Flow">
         <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:28146/CallObject" contentType="text/html" doc:name="Request">
            <http:body-to-parameter-map-transformer doc:name="HTMLForm-Parameters-To-Mule"/>
        </http:inbound-endpoint>
        <logger level="INFO" doc:name="Form-Parameters"  message="#[payload]" />

        <http:outbound-endpoint exchange-pattern="request-response" method="POST" doc:name="HTTP" ref="Page">
            <custom-transformer class="com.ExecuteWorkflow" doc:name="Call-CreateWorkflow"/>
        </http:outbound-endpoint>

    </flow>`

Have your Mule flow set redirect headers in the success case and the browser should follow the redirect:

<flow name="Create_Work_Flow" doc:name="Create_Work_Flow">
     <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:28146/CallObject" contentType="text/html" doc:name="Request">
        <http:body-to-parameter-map-transformer doc:name="HTMLForm-Parameters-To-Mule"/>
    </http:inbound-endpoint>
    <logger level="INFO" doc:name="Form-Parameters"  message="#[payload]" />
    <http:outbound-endpoint exchange-pattern="request-response" method="POST" doc:name="HTTP" ref="Page">
        <custom-transformer class="com.ExecuteWorkflow" doc:name="Call-CreateWorkflow"/>
    </http:outbound-endpoint>
    <set-property propertyName="http.status" value="301"/>
    <set-property propertyName="Location" value="http://localhost:8080/MyProject/page-
</flow>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM