You need to sign in to do that
Don't have an account?
chico_kk
Call web service from Salesforce.
I want to know what is the best way to call a web service from Salesforce.
The process involves
From an Contact SF page...
1.Call a webservice that I host in my webserver
2.Creating a task associated with the contact based on the webservice result
Also
What the best way to authenticate in my web service
1 - Should I create a UsernameWs/PasswordWs Field in the User Object and pass it
or
2 - pass the sessionId
<!--
url = "http://www.somedomain.com/xx.asmx"
alert(url);
try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){
return false;}
there is no good way to consume a web service from within salesforce.com
you are better off having an externally hosted application poll the salesforce.com api. ie, your externally hosted application can poll salesforce.com every hour, look for the contacts that fit your criteria, and then add tasks based on your business requirements. in this case you would want your salesforce username and
another option is to create a custom link (which will need to be clicked) that calls a .jsp or .aspx or whatever kind of server processing enabled page that then accesses your webservice. you can pass any of your contact record field data through the url. once you have completed your processing, you can call the api to update your contact with the proper tasks (or whatever). in that case you will need to pass the valid sessionId to be used by all of your application's calls back to the api. the nice thing about this is it takes advantage of your session management rules in salesforce.com as well.
hope that helps.
-cory
"in this case you would want your salesforce username and "
should read:
in this case you would want your salesforce username and password in an encrypted config file, as you will need to access to send login info to the api each time your application runs.
sorry about that...
Let me explain want I want:
I want to send a SMS to a contact
a. The user has to write the message (preferably in Salesforce) send it to my WebApplication (it could be a web service or not)
a.1 Salesforce must register a Task
a.2 After a while (up to 2 hours) the task must be Updated (SMS Delivered or Not)
Some Thoughts
1- I wanted to use a “JavaScript SOAP Client” to use the web service but it returns error (permission denied – it’s a security browser issue - see the following msgs).
What is the use of “Calling a Web Service”, it seems to me that they are only Web Links (googlemap, gmail, fedex etc).
2- Since my web application can take up to 2 hours to update the SF Task, I must do it using the .net API and save the Username and Password in the my Web App Database (the session expires in a 1 hour- so It’s out of question) , I’m I right? It could be a potential security risk.
3- Using the SF Ajax Library doesn’t returns an Error (permission denied – see 1.) Why?
Seems like you are the right path to do this on the server / .NET, but not sure what issue you are encountering there.