SForceAPI:无法找到 API 上列出的类? (帐户、联系方式等)
API 引用:http://www.salesforce.com/us/developer/文档/api/index.htm
小节:参考->标准对象
客户端详细信息:partner.wsdl,Axis2 1.5, 使用解压选项(-u)生成存根。
我希望找到一些基本对象,例如帐户、联系人等(在上面的网址中列出),以便我可以执行类似
-> SObject[] sObjArray = queryResult.getRecords();
for(SObject sObj : sObjArray){
Account acc = [Account] sObj;
}
[在另一个网络服务中成功使用上述方法 - 'Zuora'] 的操作,
但是,我找不到帐户类在生成的类中。我想我的方法是错误的,但至少我应该找到参考 API 中列出的类。
请帮忙。
API referred : http://www.salesforce.com/us/developer/docs/api/index.htm
subsection: reference->standard objects
Client side details : partner.wsdl, Axis2 1.5,
generated stubs using unpacked option (-u).
I was hoping to find some basic objects like Account, Contact, etc (which were listed on above url) so that I can do something like
-> SObject[] sObjArray = queryResult.getRecords();
for(SObject sObj : sObjArray){
Account acc = [Account] sObj;
}
[used above approach successfully in another webservice - 'Zuora']
However, I could not find Account class in the generated classes. I guess I am into wrong approach, but atleast I should be finding the classes listed in the reference API.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
合作伙伴 WSDL 有一个松散类型的数据模型,允许与任何组织的数据进行交互,而无需提前了解其模式 - 您只需获取 SObject。相比之下,企业 WSDL 是强类型的,并且具有您正在寻找的帐户、联系人等类型 - 请参阅 http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_partner.htm
另外,由于您生成了企业为您的组织按需提供 WSDL,它包括您的自定义类型(或 Salesforce 术语中的对象)。
[已更新以回答评论...]
我生成了存根,
我不是 Axis2 专家,但我将以下内容组合在一起,它似乎有效:
在我的开发组织中,这会产生以下形式的输出:
注意 - 原始 SOAP界面非常通用,并不是使用 Force.com API 的最简单方法。您可能需要查看 Force.com Web 服务连接器。还有一个 REST API,但它目前(2011 年 1 月)处于开发者预览版,不适用于生产部署。
The partner WSDL has a loosely-typed data model that allows interaction with any organization's data without its schema being known in advance - you just get SObjects. In contrast, the enterprise WSDL is strongly typed, and has the Account, Contact etc types you are looking for - see http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_partner.htm
Also, since you generate the enterprise WSDL on demand for your org, it includes your custom types (or objects, in Salesforce parlance).
[Updated to answer comment...]
I generated stubs with
I'm not an Axis2 expert, but I hacked the following together and it seems to work:
In my dev org, this produces output of the form:
NOTE - the raw SOAP interface is pretty generic, and not the easiest way to work with the Force.com API. You might want to take a look at the Force.com Web Services Connector. There is also a REST API, but it is currently (Jan 2011) in developer preview, and not for production deployment.
为了添加“metadaddy”发布的响应并帮助“Firefox”以及许多其他可能偶然发现此答案的人,我想分享一些个人经验的观察结果:
在谷歌上搜索一下就会发现很多人都同意我的评估。
更好的是,虽然我没有使用过它,但我建议您考虑使用 SFDC 的 REST API。
To add to the response posted by "metadaddy" and help out "Firefox" as well as the many others likely to stumble across this answer, I want to share some observations from personal experience:
A search on Google will show that many people agree with my assessment.
Better yet, though I've not used it, I'd recommend looking into using SFDC's REST API instead.
要回答您的第二个问题...请查看从此处开始的部分:http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_partner.htm|StartTopic=Content% 2Fsforce_api_partner.htm|SkinName=webhelp
To answer your second question... Take a look at the section starting here: http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_partner.htm|StartTopic=Content%2Fsforce_api_partner.htm|SkinName=webhelp