You need to sign in to do that
Don't have an account?
sailer
JSON Parsing in SOAP API for apex class
Hi Everyone,
I created the class and exposed has. WSDL and I am able to get the session id and and the result,
I need to send as JSON response for third party Application.
How do parse the JSON and how to send the response?
global class AccountServices
{
webService static String hello(String Name,String Phone,String Website)
{
Account accounts = [SELECT id, name,phone,website FROM Account LIMIT 1];
return 'Hello '+accounts.name+' '+accounts.Phone+' '+accounts.Website+' ! :D';
}
}
Create an Apex REST Method to do this:
Test:
All Answers
Guess with the help of SOAP API we cannt do a JSON response directly in SFDC:
FROM:http://login.salesforce.com/help/doc/en/integrate_what_is_api.htm
But we can have a work around (dont know if its optimal soln): try to form the JSON (after getting the result from the query,
and do the JSON.serealize LIKE:
send this JSON as the return type of the method as the string.
Create an Apex REST Method to do this:
Test:
HI Pat Patterson,
Has the CURL is not enabled in the system i am using google chrome add on test it.
I am getting the Authorization: OAuth 00D90000000mO4Z!AQYAQMyF4TqLDBLlgmDCLGsJfsxl5mcEFNjuMUInJ4Oa8c.5xb5DOIrzPMUkje81t6_MvznkcktP6ZRAZdjYqexN9Y0Y6A0Z
whenver i add the url to get the response
https://ap1.salesforce.com/services/apexrest/account
0:
Hi Pat Patterson,,
The above issues was with the package .it got solved i am able to get the response from salesforce.com
and below is the endpoint
https://ap1.salesforce.com/services/apexrest/testvantage/account.
I need to automate the response by using java code with the login and Ouath credentials.
how do i need to set and gives this end point to the third party appliaction for pulling the data.
@RestResource(urlMapping='/account')
global class TestRestServices {
@HttpGet
global static List<Account> getAccounts() {
List<Account> lst;
try
{
RestRequest req=RestContext.request;
String namevalue=req.params.get('name');
lst=[SELECT name,id ,website,phone,type from Account where type='other'];
return lst;
}catch(Exception e)
{
system.debug('Error'+e.getMessage());
}
return lst;
}
}