function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StefyStefy 

Accessing Salesforce API from a Silverlight application

Hi,

 

I'm trying to create a Silverlight application to access the Salesforce API. I managed to authenticate through oAuth, but now I don't know where to go from there as I didn't find any answer in your API documentation. 

 

Thanks,

Stefan Filip

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

At this point, i would probably say skip soap altogether and call the rest api instead.

All Answers

SuperfellSuperfell

Can you import the WSDL into your application, like a regular c# app ?

StefyStefy

Hi Simon,

 

Thanks for your reply. I managed to import the partner WSDL in my application. The problem is that I don't have the type SforceService defined in the generated proxy (I also tried to create a console application and I don't see it there either). Anyway, I managed to call the login method from a SoapClient object. The problem is that as I said earlier I want to use oAuth and I don't know how can I pass the SessionId I get in the WSDL service calls.

 

Thanks,

Stefan

SuperfellSuperfell

If you use oAuth, you're eventually left with a sessionId, which you'd pass in the SessionHeader to make API calls, same way as if you'd called login and gotten a sessionId that way.

vfeinmanvfeinman

Hi, I'm running into the same issue where I can add a Service Reference, but can't create a SforceService object. Have you resolved this?

 

-Victor

SuperfellSuperfell

You need to add a web reference, not a service reference if you want an SforceService object. (add web reference is behind the advanced button on the add service reference dialog)

ColoradoMikeColoradoMike

Hi Simon,

 

I'm working on a Silverlight project now too.  The challenge is that with VS 2010 and Silverlight 4, the "Add Web Reference" choice on the "Advanced" page has been removed!

 

I'm stuck using a WCF style SoapClient!  Any assistance you can provide in setting the SessionId would be most appreciated.

 

~~ Michael

SuperfellSuperfell

At this point, i would probably say skip soap altogether and call the rest api instead.

This was selected as the best answer
ColoradoMikeColoradoMike

I spent the day today trying to get REST to work with Silverlight, but without success.

 

I'm getting a SecurityException and I think the reason may be because of the "crossdomain.xml" files on the Salesforce servers not explicitly allowing cross-domain Authorization header writing ability:

 

http://timheuer.com/blog/archive/2010/04/23/silverlight-authorization-header-access.aspx

 

Simon, do you think this policy file would be the culrpit that would prevent a SL app from communicating via the REST Api?

 

Interestingly, I copied my code (which is pretty similar to the article) to a normal .NET application and it runs fine.  I'm hosting the Silverlight XAP file on a Visualforce page.

 

Any suggestion would be appreciated.

 

~~ Michael