You need to sign in to do that
Don't have an account?

How do I get to SforceService?
I have searched the API docs and discussion boards and have not found any info about how to get to the SforceService or where it comes from, so I am starting a new post for this.
I am using VS2008, but target the .NET Compact Framework 2.0 for a CE 5.0 device. I generated a Partner WSDL (Which includes the SforceService endpoint def.). In VS2008, I added a Web Reference (not a WCF Service Reference!) and found the service description using the URL:
https://login.salesforce.com/?ec=302&startURL=%2Fservices%2Fwsdl%2Fclass%2FserviceName
(which looked successful).
I get the correct namespace added to my project with the proxy class for the service. When I try to set up the SOAP binding, I have no access to SforceService and cannot see it in the Object Browser. Is there something (i.e., an SDK) that I need to install to get this, or should it show up automatically from the service description while adding the Web Reference?
Please help! TIA, Dave
I have been using the local WSDL file method. To get the local WSDL, I had to open the WSDL link and then view source. I copied everything there and pasted it into a text file and changed the extension to wsdl. Then in VS I added a web service reference and pointed it at file://c:\folder\path\to\file\wsdlFile.wsdl. That imported the whole thing correctly and you should then have access to the SoapClient. I'm sure smarter people than myself could tell you an easier way to do this, but that's what worked for me.
All Answers
Add Web Reference should generate the SforceService class. Look at the c# code generated from the WSDL.
Also, download and store a local copy of the WSDL and use that, don't try and use the URL to the WSDL in add web reference, it won't work. See the getting started guide in the Web Services API Docs.
Thanks for your replies, Simon.
I tried a local copy of the Partner WSDL, but VS2008 complains about the comments...Then after removing all of those, it says the document is not recognized as a known document type, with only a partial error message from 'DISCO Document' report. As a result, I am unable to finish adding the reference.
Thanks,
Dave
Make sure the local file you have is really the WSDL file.
The Add Web Reference dialog shows the content in the WSDL and it looks to be correct. The file path is also correct.
Way at the bottom of the display window there is an error saying that the XML page cannot be displayed using XSL style sheet...with a complaint about the <xsd:complexType name="PackageVersion"> element. Also, if I open the WSDL in VS, it shows errors related to "xsd" namespace refs. Is there some reference that I need in my project, or??
Thanks,
Dave
I've seen your issue when using VS 2008 or VS 2010. There is no SforceService object created when you import any of the WSDLs. There is a SoapClient object that has all the methods that are referenced in the tutorials. I think that might be the object you should be using.
Thanks for the reply, PaulAtInformz.
Have you seen this using the local WSDL file method, or the URL approach? I am unable to get a local WSDL file to work at all. The WSDL URL claims success, and then allows me to add the reference. When I do that, I don't see a SoapClient object in the Object Browser thoough. Do you recall where I might find the SoapClient?
Thanks,
Dave
I have been using the local WSDL file method. To get the local WSDL, I had to open the WSDL link and then view source. I copied everything there and pasted it into a text file and changed the extension to wsdl. Then in VS I added a web service reference and pointed it at file://c:\folder\path\to\file\wsdlFile.wsdl. That imported the whole thing correctly and you should then have access to the SoapClient. I'm sure smarter people than myself could tell you an easier way to do this, but that's what worked for me.
PaulAtInformz,
Thanks! Your suggestion worked, but instead of getting the SoapClient, I actually got the SforceService! Kudos for figuring this out.
The documentation on this area of development is not very clear...It just kind of says "Do this, this, and this, and it works.". Problem is, it doesn't "just work".
For anyone else running into similar issues, it was critical to "view page source" and copy/paste that into the local file (NOT the XML displayed in the browser page). The exact behavior in Visual Studio is different if you target a different .NET, etc. But once you have the SforceService definition in your project, you can get the login() call to work and away you go. Just watch out for the URL and session ID issues after the login() call is made.
Thanks again,
Dave
I'm using VS 2010 and I got as far as generating the Service with wsdl before I found this discussion thread...
But I can't get th login() to work. Can someone paste some example code?
tia
seamus
There's samples in the docs. Make sure you did add web reference, and not add service reference.
In the era of WCF, I don't recommend anyone do "Add web reference", ever.
REST API?
WCF supports REST, if I understand your reply correctly.
http://msdn.microsoft.com/en-us/netframework/dd547388
and in .NET 4 REST support is even better
http://www.dotnetcurry.com/ShowArticle.aspx?ID=399
I can see no reason one would not use WCF for any new web service development on the .NET platform. It's vastly superior to the technologies that preceded it.
I think I got this working in .net 4.0 / C# by adding an old school web reference instead of service reference. right click project - add service reference - point to downloaded - source saved wsdl - click advanced - there's an option for old school web reference instead of service reference.
Based on your suggestion I get this error though
The namespace 'Salesforce.sforce' already contains a definition for 'ExceptionCode'17C:\Users\hpandey\Desktop\SalesforceConnector\Salesforce\Service References\sforce\Reference.cs844Walkthrough
HI ,
Can you please explane a bit more that how did you get sforceservice .I have to consume salesforce webservice in silverlight client but cant add webreference , only service reference can be used , and service reference dont give sforceservice clss , it gives only soapclient class object
Please help .it is urgent
- "Add Service Reference";
- Click on "Advanced" button;
- Click on "Add Web Reference" button;
Now you can add you wsdl file or wsdl url and the SforceService class will be created.
I have downloaded the lates available version of Enterprise.wsdl, and had problems since the beginning. the ()() first and now the SforceService no available.
I have checked and the SforceService is present in the original XLM file downloaded but it is absent from the "reference.vb" file.
I have downloaded the set of VB samples and the attached references that works like a charms, only problem is that this wercsion is dated 2007!!!
I have checked the correct references, imprts and all the stuff, but still i have not the binding with SforceService.
Anyone can help?
Thank you in advance
The method you provided is correct, but sforceService cannot be instantiate it, when execute these 2 lines: SforceService sf = null; sf = new SforceService(); then get following errors:
ex {
"Unable to generate a temporary class (result=1).\r\n
error CS0030: Cannot convert type '
eForm.salesforcewebref.ListViewRecordColumn[]' to '
eForm.salesforcewebref.ListViewRecordColumn
'\r\nerror CS0030: Cannot convert type '
eForm.salesforcewebref.ListViewRecordColumn[]' to '
eForm.salesforcewebref.ListViewRecordColumn
'\r\nerror CS0029: Cannot implicitly convert type '
eForm.salesforcewebref.ListViewRecordColumn' to '
eForm.salesforcewebref.ListViewRecordColumn[]
'\r\nerror CS0029: Cannot implicitly convert type '
eForm.salesforcewebref.ListViewRecordColumn' to '
eForm.salesforcewebref.ListViewRecordColumn[]
Please help to see what is going on?
Shirley Qin
loginClient.login(
null, //LoginScopeHeader
null, //calloptions
sfdcUserName,
loginPassword); and getting the same exception as shirleyxiaoliqin Qin in the above post. Any advice on what is going on . I am using VS 2015 community edition
for workaround.
In that edit [][], I made mistake and removed totally, it has to be just changed to [] (from 2 dimensional array to 1 dimensional). So far I have had these issues:
1. If it was not web-reference (but service reference), SforceService object is not generated.
2. If the [][] in 2 places of reference.cs is not replaced by [] => there is runtime error : Unable to generate a temporary class (result=1)...
3. If the [][] is removed totally, then you will get : Method SforceService.executeListView can not be reflected.
Thanks atila1.3934285468997732E12
It's work for me. Got SforceService after use this method.
For instance, when I use WebRefence and access SforceService, the "query" method is defined like this:
When I don't use Add WebRefrence and use SoapClient, the query method is defined like this:
The first version is obviously simpler, and matches their sample code. So I'm using Add WebReference until this is cleared up.
THX