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?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With