SalesForce:如何获取回发请求的结果
我正在编写应用程序(.NET 4.0),该应用程序应该向 SalesForce 提交数据后请求(对于 https-url,意味着应使用安全连接)。
我创建了一个小测试,确实请求一些参数(可能并未包含所有实际需要的参数)。我的请求似乎成功了,但我不确定。
我从服务器收到的是标头中有 4 个键的响应:
- Is-Processed: true;
- 内容长度:0;
- 日期:... {“当前日期/时间”};
- 服务器:“SFDC”。
问题 1:
我能否确定销售人员正确处理了我的请求?看起来请求或多或少都不错,但是查看实际的销售人员数据,我看不到请求的结果。
问题 2:
是否可以通过任何方式从 SalesForce 获得有关发送的请求的更多反馈?
多谢!欢迎任何想法!
PS 这是我用来提交请求的代码:
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strSubmitUrl);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = aBytesRequest.Length;
myRequest.AllowAutoRedirect = false;
string strResult;
try
{
Stream newStream = myRequest.GetRequestStream();
newStream.Write(aBytesRequest, 0, aBytesRequest.Length);
newStream.Close();
WebResponse response = myRequest.GetResponse();
Stream stream = response.GetResponseStream();
int iResponseLength = 0;
if ( response.Headers["DataLength"]!=null)
{
int.TryParse(response.Headers["DataLength"], out iResponseLength);
}
...
I am writing application (.NET 4.0) that should do post-request to SalesForce to submit data (to https-url, means secured connection should be used).
I've created small test that do request with some parameters (probably not all that are actually required are included). My request seems like successful, but I not sure.
What I receive from server is response that has 4 keys in header:
- Is-Processed: true;
- Content-Length: 0;
- Date: ... {"current date/time"};
- Sever: "SFDC".
Question 1:
Can I be sure that my request was correctly processed by sales force? Seems like request is more or less good, but looking into actual SalesForce data I don't see result of my request.
Question 2:
Is there any way to get more feedback from SalesForce about request sent?
Thanks a lot! Any thoughts are welcome!
P.S. Here is a code that I use to submit request:
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strSubmitUrl);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = aBytesRequest.Length;
myRequest.AllowAutoRedirect = false;
string strResult;
try
{
Stream newStream = myRequest.GetRequestStream();
newStream.Write(aBytesRequest, 0, aBytesRequest.Length);
newStream.Close();
WebResponse response = myRequest.GetResponse();
Stream stream = response.GetResponseStream();
int iResponseLength = 0;
if ( response.Headers["DataLength"]!=null)
{
int.TryParse(response.Headers["DataLength"], out iResponseLength);
}
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来我的代码中一切都很好。销售队伍方面可能需要进行一些配置才能显示提交的数据。
此外,SalesForce 不返回任何数据,仅返回标头,状态代码为 200,数据长度为 0。
It seems like everything is fine in my code. Probably some configuration was required on SalesForce side to display submitted data.
Also, SalesForce doesn't return any data, only header, with status code 200 and data length 0.