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. ...
Keith C's user avatar
  • 134k
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 ...
Adrian Larson's user avatar
  • 149k
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 ...
sfdcfox's user avatar
  • 477k
5 votes

Getting System.CalloutException: You have uncommitted work pending

You are not allowed to perform any DML operations before making any type of callout. You will need to process all callouts first (this might mean having a for loop for just your callouts first), store ...
dsharrison's user avatar
  • 3,982
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 ...
sfdcfox's user avatar
  • 477k
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 ...
Adrian Larson's user avatar
  • 149k
4 votes
Accepted

Is the data exchange with a https endpoint, encrypted?

Heroku automatically provides a SSL certificate for standard subdomains. As long as you are using HTTPS, your app's communications are already encrypted with no extra effort. In other words, as long ...
sfdcfox's user avatar
  • 477k
4 votes
Accepted

Extra Backslash in Json String when exposing webservice

It looks like you are returning a String from your REST endpoint which is then being sanitised by Salesforce JSON serializer. Any object returned from a method in an @RestResource annotated class is ...
Alex Tennant's user avatar
  • 13.5k
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 ...
sfdcfox's user avatar
  • 477k
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 ...
David Reed's user avatar
  • 91.7k
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 ...
David Reed's user avatar
  • 91.7k
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(){ ... }
TSmith's user avatar
  • 4,922
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 ...
Eric's user avatar
  • 53.9k
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 ...
Keith C's user avatar
  • 134k
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 ...
Ashwani's user avatar
  • 22.5k
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 ...
Himanshu's user avatar
  • 10.5k
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. ...
user123's user avatar
  • 61
3 votes

WebServiceCallout (wsdl2apex)

The easiest way to debug a WebServiceCallout.invoke call is to capture the debug log from a Developer Edition org. In this case it will include the CALLOUT_REQUEST, CALLOUT_RESPONSE events. The info ...
Daniel Ballinger's user avatar
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 ...
sfdcfox's user avatar
  • 477k
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.
Charles T's user avatar
  • 10.9k
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 ...
Tushar Sharma's user avatar
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 ...
Daniel Ballinger's user avatar
2 votes
Accepted

salesforce web service call another web service

A web service inside salesforce can: Execute the methods in the callout directly if within the same salesforce org. If the method does not use any of the request headers you can call the method ...
Eric's user avatar
  • 53.9k
2 votes
Accepted

Testing custom apex webservice with SOAP UI

The web-service WSDL that you have created will not contain any method to login. In the 18th line of your webservice, you will be required to pass a session Id, which you can obtain using the ...
manjit5190's user avatar
  • 7,983
2 votes
Accepted

Session Id invalid but Refresh Token Policy is set to Refresh token is valid until revoked

Access tokens always work for hours only. When the access token expires, you need to get new Access token by using the Refresh token. Here the validity of refresh token come in place. If it is set to ...
Ashwani's user avatar
  • 22.5k
2 votes
Accepted

How to write test class for websevice?

You are doing your callout before your mock implementation. Try reordering the execution to this: Test.startTest(); Test.setMock(HttpCalloutMock.class, new Rfleet_MockHttpResponseGenerator()); ...
Eric's user avatar
  • 53.9k
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 ...
Alexander Aeons Torn's user avatar
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)
Dave Durant's user avatar
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/...
Rohit Mourya's user avatar
  • 3,851
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-...
moth's user avatar
  • 454

Only top scored, non community-wiki answers of a minimum length are eligible