I wanna consume a REST service exposed by Salesforce, right now I'm using a Sandbox instance and using Anypoint Studio to create my flow, I would like to know what's the best practice to implement it. Now I'm not sure about the salesforce connector allows me to consume the service, so, I'm using this components:
This is whole flow.
<mule xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:oauth2="http://www.mulesoft.org/schema/mule/oauth2" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/sfdc http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd">
<http:request-config name="HTTP_Request_Configuration" host="https://test.salesforce.com" port="80" doc:name="HTTP Request Configuration" protocol="HTTPS">
<oauth2:client-credentials-grant-type clientId="3xQYwWqsvZUYbwMRLHiXQy9A23XXXtxg1OMxdXh5p4eoev53q26CmN0Yx0EyLf_HTLW9X" clientSecret="710XXX1723685311">
<oauth2:token-request tokenUrl="https://test.salesforce.com/services/oauth2/token"/>
</oauth2:client-credentials-grant-type>
</http:request-config>
<file:connector name="File" writeToDirectory="/Users/emoran/Desktop" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<flow name="outbrain_3wintegrationFlow1">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="10" timeUnit="SECONDS"/>
<http:request config-ref="HTTP_Request_Configuration" path="services/apexrest/outbrain_integration_messages/" method="GET" requestStreamingMode="ALWAYS" sendBodyMode="ALWAYS" doc:name="Consume SFDC LOG Service" doc:description="prueba" parseResponse="false" source="#[message.payload]" target="#[message.payload]">
<http:request-builder>
</http:request-builder>
<http:success-status-code-validator values="0..599"/>
</http:request>
</poll>
<logger message=">>>> RESPONSE FROM SERVER: #[message.payload]" level="DEBUG" doc:name="Logger"/>
<echo-component doc:name="Echo"/>
<file:outbound-endpoint path="/" outputPattern="refacciones.json" connector-ref="File" responseTimeout="10000" doc:name="File"/>
</flow>
</mule>
What would be the best approach to solve this?
Thanks