Consuming Salesforce Restful webservice in Mule

181 Views Asked by At

I am trying to consume a restful webservice hosted in Salesforce. below is my flow:

<sfdc:config-with-oauth consumerKey="3MVG9Y6d_Btp4xp6mZswjXp6v6Ic5Acdwb72JxgcoOeaRfn.QnVT_ebtzyyd9k0lfuMA2KxbGuTHRv5P3g" consumerSecret="908013318579650535" doc:name="Salesforce (OAuth)" name="Salesforce__OAuth_">
    <sfdc:oauth-callback-config domain="localhost" localPort="8081" path="oauth2callback"/>
</sfdc:config-with-oauth>
<http:listener-config doc:name="HTTP Listener Configuration" host="0.0.0.0" name="HTTP_Listener_Configuration" port="8082"/>
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="https://ap1.salesforce.com" port="443" basePath="services/apexrest/FieldCase" doc:name="HTTP Request Configuration"/>


<flow name="salesforce-oauthFlow1">
    <http:listener config-ref="HTTP_Listener_Configuration" doc:name="HTTP" path="/"/>

    <sfdc:authorize accessTokenUrl="https://na1.salesforce.com/services/oauth2/token" authorizationUrl="https://na1.salesforce.com/services/oauth2/authorize" config-ref="Salesforce__OAuth_" display="PAGE" doc:name="Authorize at Salesforce"/>
    <response>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    </response>
    <http:request config-ref="HTTP_Request_Configuration" path="/" method="GET" doc:name="HTTP"/>
</flow>

But i get an error message
Message : Error sending HTTP request. Message payload is of type NullPayload Code : MULE_ERROR--2

1

There are 1 best solutions below

0
On

Since you are using a GET I find this issue a bit confusing. It could however be dependent on a payload, and you seem to be setting the payload with the to the return of the logger, which I guess is null. Why do you have the at all?

Either remove that, and just log. Or set the payload to an empty string with something like