Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Salesforce .net API integration

I'm a little confused. We downloaded the WSDL file from Salesforce and created a web reference to it using a file path as suggested. It created what I understood to be the proxy classes, but not the SforceService class.

Someone else suggested that you have to use the WSDL.exe to generate the class file which I did and it now works.

What I don't understand is why?

Didn't the process of created a web reference configure the proxies as needed? Why the extra step?

Any advice?

like image 257
Jacques Avatar asked Apr 20 '11 15:04

Jacques


People also ask

Which API is used in Salesforce?

SOAP API provides a powerful, convenient, and simple SOAP-based web services interface for interacting with Salesforce. You can use SOAP API to create, retrieve, update, or delete records. You can also use SOAP API to perform searches and much more. Use SOAP API in any language that supports web services.

Can Salesforce Call REST API?

You can make REST API calls to your Trailhead playground using the resources in the Postman app Salesforce Collection REST folder just like you would from any other HTTP interface.


3 Answers

The SforceService class is only generated if you do add web reference (from the advanced button on add service reference dialog) if you do add service reference, you get a different set of objects, and a different programming model.

All the .NET samples on the salesforce site use the add web reference style proxies, but if you'd rather use the WCF (aka service reference) style stuff instead, that's fine too.

like image 140
superfell Avatar answered Sep 17 '22 16:09

superfell


Ok, now I rememmbered why its difficult to use service reference instead of web reference. WCF does not support WSDL defined SOAP headers which salesforce API uses for carrying session identifier. For every application you have to integrate special processing like described here, having to itterate over all operations and modify their endpoint behavior. Ugly at best. Web reference on the other hand supports soap headers directly.

like image 35
mmix Avatar answered Sep 17 '22 16:09

mmix


First of all, you should use "Add Service Reference" instead of "Add Web Reference" unless you have no choice.

Second, "Add Web Reference" generally produces the same code as wsdl.exe. In your case, the only reason that I would run wsdl.exe would be to better see any error messages.

I suggest that you use Object Browser to look at the types in your service reference - maybe SforceService is simply in a namespace you don't expect.

like image 29
John Saunders Avatar answered Sep 18 '22 16:09

John Saunders