1

I haven't worked with web services and was hoping someone could provide some guidance. I have read the API documentation for this external web service API and I need some help understanding how I can accomplish the following. The API documentation states:

A connection to the service is required before calling any function. This requires setting up a binding and having a valid address for the service. The sample has a function that will configure the binding, but a valid address will have to be supplied

So, I need the URL endpoint (web address to the service). Do I have to setup a remote site in Salesforce? What is the binding? The documentation doesn't include any sample.

I am only using this API once to pull data and insert into several objects in Salesforce. I understand from the documentation what methods I need to call and the parameters I need to pass, but since this is a one time pull I'm wondering what would be the easiest approach? HTTP Request/Response, parse the XML and insert using execute anonymous from the developer console?

Sorry for the novice questions. Just trying to get my head wrapped around web services.

Thanks.

2
  • Does this other service have some kind of export tool? If so, easiest is probably export to CSV from other service, import using one of the Data Loading tools.
    – pchittum
    Jun 2, 2015 at 16:41
  • I would much prefer that, but no, it does not. The API provides the data relationship consolidation so I don't have to do all the field mapping, etc.
    – Dman100
    Jun 2, 2015 at 16:51

2 Answers 2

2

The first step before making a webservice callout is configuring Remote site settings Salesforce. This is a way of telling Salesforce that this is a valid or authorized URL. For example, if the endpoint where you will be hitting is http://www.mapquestapi.com?APPID=dvdbdfgdf123bbf, then you must add http://www.mapquestapi.com in your remote site settings. Adding only base url of the endpoint would do. You won't be able to make any callouts until you add the url in the remote site settings.

Now, since you are fetching data from an external source, choosing REST or SOAP depends upon the volume of data. If you use REST, it will be easier to maintain since it's lightweight and can also be used in mobility. I personally favor using JSON with REST callout. However, getting the response in JSON format has quite some limitations. We need to take care if the heap size governor limit in Salesforce since your JSON response may be quite huge. Anyway, if you make this callout asynchronously then this limit is doubled (from 6 MB to 12 MB), so hitting that limit would be quite difficult.

There are three classes - HTTP, HttpRequest and HttpResponse that can be utilized to form your request and retrieve your response. You should go through these three classes to understand the functionality better.

Hence, technically you would be needing two classes - one for creating the request and other for typecasting the response into the format you need. If you use JSON, you can simply serialize and deserialize the JSON string and get the work done.

If you have specific questions related to the above, you can post them in comments. We can discuss further.

1
  • Thanks for the help. What is referring to with the binding?
    – Dman100
    Jun 2, 2015 at 17:03
0

If it's just a one time use thing, it might not be worth the trouble to build these webservices. Have you taken a look at the Data Loader yet?

2
  • Yes, that would be my preference, but the webservices pull the data on the external system from multiple tables into a data set that will insert into the Salesforce objects eliminating the need to go thru all the data mappings that we would otherwise have to do.
    – Dman100
    Jun 3, 2015 at 13:12
  • If you want to build into the web-services yourself, and the goal is to move data from another system into salesforce, you would probably want to use either the enterprise or the bulk api. Also, execute anonymous can be called through webservices, but I wouldn't recommend it for moving data. It's really just for executing a script.
    – martin
    Jun 3, 2015 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .