6
votes
How can I deprecate/remove a webservice method/class in a Managed Package?
AFAIK you will have to leave the class/method there and just document somewhere that it should no longer be used. But bear in mind one or more of your customers may be using it without your knowledge.
...
6
votes
Accepted
Method does not exist or incorrect signature: void send(System.HttpRequest) from the type System.HttpRequest
You instantiate an Http instance, which has the send method.
Incorrect
HttpResponse response = HttpRequest.send(request);
Correct
HttpResponse response = new Http().send(request);
The HttpRequest ...
6
votes
Accepted
How to return List of a list in Apex Rest Get Method Using SOSL
Don't mix responseBody and a return value. Use one or the other. It's a lot easier to use the return value, and offers more functionality for no extra effort, such as supporting XML and JSON input and ...
5
votes
Accepted
HTTP callout to SOAP webservice
SOAP is a specialization of REST. In other words, a programming language or tool that only understands REST can be coerced into calling a SOAP endpoint, but a tool that only understands SOAP cannot ...
5
votes
Accepted
How to properly send a Json in the body of a POST request?
As the documentation states, setBody accepts a String argument. In this case, you need to serialize the model.
JSON2Apex payload = new JSON2Apex(...);
request.setBody(JSON.serialize(payload));
I'd ...
4
votes
Accepted
Understanding authentication for Apex SOAP web service
Certificate-based authentication is possible via the JWT Oauth flow, and you're on the right track vis-a-vis how to implement it (you do create a Connected App and populate a certificate there).
It's ...
4
votes
Accepted
Apex Callout HTTP POST with Named Credentials error
You've specified the Content-Type as application/json, but you're using a application/x-www-form-encoded encoding style. You need to make sure they agree with each other.
// These do not agree with ...
4
votes
Accepted
Error Handling in REST Webservice
I don't believe that this code can throw any system exceptions at all. If no Accounts are found, or if the input is nonsensical, the class will simply return an empty list.
You need to add more code ...
4
votes
Accepted
Apex function that returns a map
Seems like a minor typo in your method return type declaration.
public static map liveChatCallout(){ ... }
to
public static Map<String,Object> liveChatCallout(){ ... }
3
votes
Accepted
Accessing a Webservice Apex Method via SOAP-UI
You also need to generate one additional Enterprise or Partner WSDL to make login request. There you will supply your credentials and will get security token in response.
Next you will use that ...
3
votes
Accepted
Loading a file form sftp location into salesforce
SFTP is not a protocol that Apex supports. If the external service cannot serve up the content by HTTP(S) you'll need something in the middle to mediate the file transfer.
3
votes
Accepted
Authentication for custom Apex SOAP web service
You need to pass in a Session ID that has API access. You can get this Session ID any way you want, including SOAP login() (see Setup > Develop > API for the WSDL files), SAML authentication via ...
3
votes
Rollback changes after future Webservice call in after trigger
Depending on the performance hit, you will have to model it in your environment
Create a long text field
JSON.serialize the trigger.old value, or class representing the data you are tracking, and ...
3
votes
Rollback changes after future Webservice call in after trigger
As you realise, the trigger's transaction will have committed before the web service response fails. So you have to move into the area of compensating transactions i.e. providing a way to undo what ...
3
votes
Accepted
Need build webhooks in Saleforce to recieve third party server alerts
Salesforce support the way to get the request and provide the response from third party sites. It is RestResource.
Pre-requisite:
Authentication with Salesforce.OR You can setup force.con site and ...
3
votes
Accepted
How to display list values in webservice class?
accist is a list in your code and your res.Name expecting string and you are trying to assign from list to string which is not possible. You need to get first index of your list item as shown in below ...
3
votes
Accepted
pass set of IDs from javascript button to a web service
Thanks Keith. It worked. Now i feel stupid. It was something so simple. Overnight, i got it to work by using JSON.stringify() in the javascript button, and then deserializing it in my batch class. ...
3
votes
Accepted
Importing Wsdl2Apex with multiple wsdl:part in a wsdl:message
Unfortunately I don't think you are going to be able to use wsdl2apex and the corresponding WebServiceCallout.invoke() to call these multipart methods.
As you have observed, the init message is ...
2
votes
Salesforce - Maximum simultaneous requests callout limit
This limit is there in API 39 but has vanished from the API 40 docs. (and the crowd rejoiced)
2
votes
Webservice @httpPost method authentication
This is the way i found out to do,
I tried this with postman tool.
First enter the below URL with respective parameters and make a request for access token
Endpoint url = https://"yourOrgInstance"....
2
votes
External Data source through apex custom adapter
These examples were the most helpful for me (examples of SF Connect custom adapters for various web services including GitHub, Google Drive, and so on):
https://developer.salesforce.com/docs/atlas.en-...
2
votes
Accepted
how to get the session Id for web service calls to salesforce
First you need to set your endpoint of your server.
Endpoint URL (Sandbox)-> https://test.salesforce.com/services/Soap/u/35.0
Endpoint URL (Production)-> https://login.salesforce.com/services/Soap/u/...
2
votes
Salesforce webservice
Odds are the problem is related to these lines:
Catch( Exception ex )
{
System.debug('Error:'+ex.getMessage());// Create a advanced log here
}
Something is breaking the the webservice and the ...
2
votes
Accepted
Getting null pointer exception in webservice class?
Inside this part you should declare the creator function to instantiate the lists of the class, otherwise when you are trying to add values there you get a null pointer since the responses lists ...
2
votes
Does Apex (SOAP) WebService use HTTP POST method by default? Does it support other methods like GET, PUT etc.?
Following is my understanding (as of today):
Salesforce standard SOAP APIs adhere and support HTTP 1.1 and SOAP 1.1
GET/PUT HTTP methods are not supported for Apex SOAP web services, as these APIs ...
2
votes
API Request vs Callouts
API Requests are inbound calls, from external systems to Salesforce (for applicable limits, check the docs). Apex callouts are outbound HTTP/Webservice calls from Apex to external systems (for the ...
2
votes
{"message":"This session is not valid for use with the REST API","errorCode":"INVALID_SESSION_ID"}]
I beleive this RestApiIntegrationController is getting called from UI, LWC or Aura.
So when you do a UserInfo.getSessionID(), it will fetch session Id of lightning domain. Which wont work for calling ...
1
vote
Error Handling in REST Webservice
I have created a valid test class for your code above. However, this is not bulkified. Also I would note that you are returning a list of accounts, however, you only seem to be passing in 1 Account Id....
1
vote
Accepted
TestMethod Doesn't Support Web Service Call Out Error For Trigger on delete
The code that you showed doesn't have any callouts, so I assume that either your Account or Customer Todo trigger have a web service callout in it.
In order to write a test class for a class that has ...
1
vote
Web Services - Getting JSONException while handling request from External System
The problem is Salesforce supports max up to 18 digit number, including decimal points. Even, in a real-time scenario, you won't need any number which is 21 digit see 21 digits ---> (...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
apex-webservice × 114apex × 54
webservices × 41
rest-api × 16
integration × 13
soap × 12
soap-api × 10
callout × 10
apexrest × 9
json × 6
wsdl2apex × 6
unit-test × 5
website-integration × 5
api × 4
rest × 4
httprequest × 4
visualforce × 3
trigger × 3
javascript × 3
community × 3
custom-button × 3
exception × 3
authentication × 3
xml × 3
wsdl × 3