我需要在 Salesforce 中调用自定义休息 api。有人可以提供任何细节如何从骡子调用它。请找到我的 mule 配置并建议我是否做错了什么。
Salesforce 自定义休息类
@RestResource(urlMapping='/customOrder')
global with sharing class CustomOrder {
@HttpPost
global static Account createOrder() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
Map<String, Object> params = (Map<String, Object>) JSON.deserializeUntyped(req.requestBody.toString());
----
---
Account resultAcc;
---
return resultAcc
}
}
请求有效载荷
{
"Obj1": [
{
"key": "data for key",
"value": "some value"
},
{
"key": "leadSource",
"value": "Web"
},
"obj2": [
{
"key": "data for key",
"value": true
}
],
"key1": false
}
销售人员的骡子配置
<sfdc:config-oauth-user-pass name="Salesforce" consumerKey="XXXX" consumerSecret="XXX" username="XXX" password="XXX" tokenEndpoint="xxxxx" disableSessionInvalidation="true" doc:name="Salesforce: OAuth 2.0 Username-Password" fetchAllApexRestMetadata="true" >
<sfdc:apex-class-names>
<sfdc:apex-class-name>CustomOrder</sfdc:apex-class-name>
</sfdc:apex-class-names>
</sfdc:config-oauth-user-pass>
<sfdc:invoke-apex-rest-method config-ref="Salesforce" restMethodName="CustomOrder||createOrder\^customOrder\^HttpPost\^Account\^" doc:name="Salesforce"/>
如何从 mulesoft 调用此 api 的最佳方式