I am new to Anypoint Studio and I am trying to create a flow that will have an HTTP connector and an endpoint and when a user invokes the http endpoint then the application will load the contents of an XML file, will convert then to JSON and will return the JSON back in the HTTP Response.
My flow configuration looks like this
<flow name="test-flow">
<http:listener config-ref="HttpListenerConfiguration" path="/read" allowedMethods="POST" doc:name="HTTP">
<http:response-builder statusCode="200">
<http:header headerName="Content-Type" value="application/json"/>
</http:response-builder>
</http:listener>
<file:inbound-endpoint path="xml/test.xml" responseTimeout="10000" doc:name="File"/>
<mulexml:xml-to-object-transformer returnClass="org.mule.examples.Catalog" doc:name="XML to Object"/>
<json:object-to-json-transformer sourceClass="org.mule.examples.Catalog" doc:name="Object to JSON"/>
</flow>
Of course it doesn't work. I get a
SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'file:inbound-endpoint'. One of '{"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, "http://www.mulesoft.org/schema/mule/core":response}' is expected.
which I assume is coming from the fact that <file:inbound-endpoint...>
needs to be as a source in the flow.
Any suggestions on how can I read a file after an HTTP endpoint is invoked?
Thanks