Note that there are some explanatory texts on larger screens.

plurals
  1. POmule's http-proxy cannot be used in flow?
    primarykey
    data
    text
    <p>I would like to do a proxy for backend rest service, but before I forward the request to backend, I need to do some checks. I checked the docments, there is a http-proxy can be used to do the proxy, but when I put into the flow, there are exceptions. If I use the http:outbound-endpoint the method cannot be a dynamic MEL expression(rest method could be POST, GET, PUT, DELTE etc).</p> <p>Could you give me a suggestion? An example will be better, Thanks a lot. My Configuration:</p> <pre><code>&lt;flow name="demo.routerFlow1" doc:name="demo.routerFlow1"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" doc:name="HTTP" /&gt; &lt;logger message="Method: #[message.inboundProperties['http.method']], URI: #[message.inboundProperties['http.request.path']], Params: #[message.inboundProperties['http.query.params']]" level="INFO" doc:name="Logger" /&gt; &lt;http:body-to-parameter-map-transformer doc:name="Body to Parameter Map" /&gt; &lt;choice doc:name="Choice"&gt; &lt;when expression="(payload['timestamp'] == null || payload['nonce'] == null)"&gt; &lt;expression-component doc:name="Check Required Params"&gt;&lt;![CDATA[payload="{\"code\":\"PA001\", \"message\":\"missing required parameter timestamp and nonce\"}"]]&gt; &lt;/expression-component&gt; &lt;/when&gt; &lt;otherwise&gt; &lt;choice doc:name="Choice"&gt; &lt;when expression="!replayAttackCheck.validate(payload)" evaluator="groovy"&gt; &lt;expression-component doc:name="Check Required Params"&gt;&lt;![CDATA[payload="{\"code\":\"PA002\", \"message\":\"timestamp or nonce is illegal\"}"]]&gt; &lt;/expression-component&gt; &lt;/when&gt; &lt;otherwise&gt; &lt;processor-chain doc:name="Processor Chain"&gt; &lt;pattern:http-proxy name="http-proxy-sample"&gt; &lt;!--line 38--&gt; &lt;http:inbound-endpoint address="http://localhost:8080/"&gt;&lt;/http:inbound-endpoint&gt; &lt;http:outbound-endpoint address="http://localhost:8081/"&gt;&lt;/http:outbound-endpoint&gt; &lt;/pattern:http-proxy&gt; &lt;/processor-chain&gt; &lt;/otherwise&gt; &lt;/choice&gt; &lt;/otherwise&gt; &lt;/choice&gt; &lt;/flow&gt; </code></pre> <p>Error:</p> <pre><code>Caused by: org.xml.sax.SAXParseException; lineNumber: 38; columnNumber: 31; cvc-complex-type.2.4.b: The content of element 'processor-chain' is not complete. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-outbound-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor}' is expected. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload