I had been tasked with adding an endpoint to my Mule service for verifying other service endpoints. One of the requirements was that the endpoint be HTTP so that a browser could be used to retrieve the verification report.
Originally, when hitting the endpoint in my browser, the resulting HTML was displayed as plain text.
I resolved this by adding the HtmlResponseTransformer below:<http:endpoint name="VerificationEndpoint"It is worth noting the HTTP Transport Documentation states that HTTP endpoints are synchronous by default, but it did appear to be the case in my experience.
host="localhost"
port="28080"
path="services/verify"
method="GET"
synchronous="true"
responseTransformer-refs="HtmlResponseTransformer"/>
<message-properties-transformer name="HtmlResponseTransformer">
<add-message-property key="Content-Type" value="text/html"/>
</message-properties-transformer>
<model name="setup">
...
<service name="verify">
<inbound>
<http:inbound-endpoint ref="VerificationEndpoint"/>
</inbound>
<component>
<spring-object bean="endpointVerifier"/>
</component>
</service>
...
</model>
No comments:
Post a Comment