6

This is a rather strange hard limit on the number of parameters a method can have in Apex. It doesn't get in the way normally - a large number of parameters is not a good approach to use - but can get in the way of some automatically generated code. If your API has many parameters they are probably best grouped into objects in any case. So instead of a flat ...


5

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 the results of each callout, then process your records and DML after. Why is this? When you perform a DML operation, you are granted a database connection. ...


4

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 as your code calls an endpoint that starts with https://, you're good to go.


4

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. If you are sure no customer is using it, you can empty the class out and just throw an exception if it is ever called in the future. (While leaving something ...


4

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 not the right way to handle authentication for an Apex web service, but it's a right way. It's applicable to situations where you have headless servers talking ...


3

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 for these includes the SOAP XML body that is being sent and the corresponding response. If a developer edition org isn't an option, then there are a few of ...


3

You're asking Apex Code to make a JSON list (array), so that's exactly what it's doing. Just change the line of code where you create the JSON body: req.setBody(JSON.serialize(cont)); You can remove the conwebs array logic.


3

You can generate a WSDL specific for calling you Apex web service. Go to: Setup > App Setup > Develop > Apex Classes. Find your class. There will be a WSDL link next to the Edit and Del links, or a Generate WSDL button with viewing the Apex Class. This WSDL will include the required URL. Note that to call the web service you will need to specify the ...


3

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 code. global class exposewsdl{ global class requestKT{ webservice string inputName; } global class responseOfWs{ webservice ...


3

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 has been done. Exactly how you do that will depend on what changes were committed e.g. if its just one field change you could store the previous value (in ...


3

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 store it on that field. to rollback, simply deserialize and update. Another way is create a class to have only the fields you are interested in and deserialize ...


3

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

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 response and will make request.


2

An Apex Web Service behaves pretty much as any Apex class does. First of all, Profile and Permission Set restrictions on Object security or Field security are not enforced. And that is that. The access level, if set to without sharing will ignore sharing rules (giving the code access to any record in the system, regardless of ownership, sharing, etc). If ...


2

Your provided code isn't valid and can not produce either one of the examples which you demonstrated as results of what is generated. It's a lot easier to assist when you provide a reproducible problem. Below is a working example that supports the structure you're intending and also demonstrates the service payload. Hopefully you can adapt it to your needs. ...


2

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 automatically serialized into JSON/XML for you, you don't need to do it yourself. If you want to return a JSON object from an @RestResource class you have two ...


2

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 directly Make a callout to another webserive - does not need to be marked as @future You can call a static method in a restResource annotated method just like any ...


2

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 enterprise/Partner WSDL. How to get a session Id Approach One: Login using your Enterprise/Partner WSDL (Shown Above) and It will generate a session-id and a URL (...


2

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 "Refresh token is valid until revoked", you can get access token as long as refresh token is invalidated by user. Refresh token is valid until revoked does ...


2

In a dev org, the raw soap request and response are dumped into the debug log. In any other edition they are unavailable.


2

You are doing your callout before your mock implementation. Try reordering the execution to this: Test.startTest(); Test.setMock(HttpCalloutMock.class, new Rfleet_MockHttpResponseGenerator()); Rfleet_Searchaddress.restapi('jso'); Test.stopTest(); this sets the Mock Response to handle the callout before you actually make the callout in your ...


2

This limit is there in API 39 but has vanished from the API 40 docs. (and the crowd rejoiced)


2

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. Guess i needed a good night sleep. I will post my complete working code here just in case someone needs to look at it in future. Javascript button on the list ...


2

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 haven't been instantiated. global class responseOfWs{ List<accList> accList; List<leadList> leadList; List<conList> ...


2

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 expose that class so, you can invoke it without authentication. RestResource annotated class. Go through below link to setup rest resource:- Add a Class as a ...


2

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 Single-Sign On (SSO), the Session ID from a Workflow Outbound Message, or any of the OAuth flows (Web Server, Client, or Username-Password). You provide the Session ...


2

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/35.0 Set your headers as below: SOAPAction-> "" Content-Type-> text/xml And finally Body. Replace Login Id and Password with actual credentials: <soapenv:...


2

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-us.apexcode.meta/apexcode/apex_connector_examples.htm?search_text=github When the platform calls the DataSource.Connection class's query method, the parameter ...


2

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".salesforce.com/services/oauth2/token PARAMETERS client_id = 3MVG99S6MzYiT5k8Wklml6FnGX5UVDSDSASADSAV.lWcKcPlMhaikiPoapcdX, client_secret = ...


2

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 error is only being written out to the debug log. There would be no other indication in the calling service that a problem was encountered. You would just get the ...


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