在这篇文章之后,我正在尝试创建一个从 Salesforce 到网络服务 (.Net) 的 Apex 标注 - 或者可以接收 POST 的东西。
作为新手,我不确定如何捕获POST
从 Salesforce 发送的 Http。那就是我在 Salesforce 中有一个 Apex 类,它在帐户插入时触发:
public class WebServiceCallout {
@future (callout=true)
public static void sendNotification(String name) {
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://localhost');
req.setMethod('POST');
req.setBody('name='+EncodingUtil.urlEncode(name, 'UTF-8'));
req.setCompressed(true); // otherwise we hit a limit of 32000
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.toString());
}
}
}
逻辑上req.setEndpoint('http://localhost');
应该替换为我的 IP 和可接受的端口。
如果我想了解这一点POST
,需要在 Visual Studio (.Net) 中构建什么项目?