Showing posts with label web service. Show all posts
Showing posts with label web service. Show all posts

Thursday, January 5, 2012

NO-SOFTWARE Salesforce Tutorial: Internal Web Service Callouts

Another developer recently talked about a situation where an Apex web service needed to be exposed to internal, authenticated users in order to work around a DML limitation.

The concept behind the workaround was very intriguing, and after playing around with some Apex code I came up with a tutorial that I hope others may find useful: NO-SOFTWARE Salesforce Tutorial: Internal Web Service Callouts

The key concepts demonstrated in the tutorial include:
  • Generating a WSDL from a global Apex class
  • Generating Apex from a WSDL created from a global Apex class
  • Using the UserInfo.getSessionId method to make callouts to internal web services as an authenticated user

Wednesday, November 10, 2010

NO-SOFTWARE Tutorial for Salesforce Web Services

First... the gripes against Salesforce. Please feel free to open the actual tutorial if you're not interested in reading about how a billion-dollar company published an API with a lack of documentation that would induce balding in even a teenage developer.

16 man-hours of angst and frustration with Salesforce finally yielded a fruit that I can eat and then sleep on. Who would've thought that Salesforce, in its infinite wisdom, with its "NO SOFTWARE" slogan, would overlook the need for a tutorial that shows how to use the Salesforce WSDL in conjunction with the Web Services API. I certainly didn't expect this lack of documentation and support (which is Premier Support in my case).

As a newbie who has never touched a web service before with an immediate and urgent need to call one from my Salesforce org, I had no idea where to begin. Furthermore, my hopes were dashed when I discovered that the Quick Start chapter in the Web Services API Developer's Guide used Apache Axis or Microsoft Visual Studio as an integral part of the tutorial. What happened to "NO SOFTWARE"? Doesn't the Salesforce platform support both inbound messages and outbound messages for web services?

My chagrin was further exacerbated when I discovered to my extreme disappointment that neither the Salesforce-generated Enterprise WSDL nor the Partner WSDL could be directly imported back into Salesforce using the Generate from WSDL feature for Apex classes. Now, where have I encountered a very similar irony... Oh, yeah! I wrote about it in a previous post, "Salesforce CSV Format for Report Exports Is Not IETF RFC 4180-compliant".

Needless to say, when I thought that my first foray into web services would be made less painful by using Salesforce as the learning platform, I thought very, very wrongly. Well, I shouldn't say that, since the experience could've been worse if I had to write two web services from scratch in Java or something.

Anyway, thanks to an abundance of hope and the following inspirations found on the Internet, I believe I now have a workable tutorial that newbies like myself can use to familiarize themselves with using web services in Salesforce.
JavaRanch

Force.com Discussion Boards
If this tutorial helps even one person, I will consider the 16 hours well spent.