Questions tagged [callout]

"HTTP Callouts" connect to a remote web server from Apex code.

Filter by
Sorted by
Tagged with
12
votes
1answer
3k views

Testing Batch Job with HTTP Callouts

Suppose I have the following: global class CMBatchRegisterUsers implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful { global final String orgID = UserInfo....
20
votes
1answer
31k views

How do I handle a 302 redirect response to my HTTP callout?

I am accessing an API, but when i debug the response it shows this message [Status=Moved Temporarily, StatusCode=302]. what should i do to access my required response.. my code is given below public ...
5
votes
3answers
234 views

Uncommitted Work Error with MultiStaticResourceCalloutMock

I am using the MultiStaticResourceCalloutMock to test a callout to Twitter. I am using the Test.Start/Stop to wrap the test.mock implementation which has previously fixed the issues we all had with ...
4
votes
1answer
1k views

Can you run Batch Apex after a callout?

I have a callout that is scheduled every hour to import data. Upon finishing the import, I would like to call a Bach Class that works with the imported data. Right now, I get an error saying Database....
3
votes
1answer
244 views

Error in inserting a sobject in batch apex and passing the same object in webservice call

i need to Insert a List of Sobject Pass the ID of SObject that has been inserted in to a webservice call. This has to be done in Batch Apex since it needs to run on a daily basis. Now i have done ...
5
votes
1answer
4k views

Issue in callout to an external REST service over HTTPS from Salesforce

I have to make callout to an external REST service from salesforce. Service provider has shared an 'HTTPS' endpoint with me. I am able to access the service by simply pasting service endpoint in ...
11
votes
2answers
3k views

Sorting Opportunity Line Items programmatically

I've been attempting to do a purely Apex based sorting of Opportunity Line Items based on a solution I found in the Salesforce developer boards. That solution uses a combination of Javascript and Apex ...
2
votes
1answer
2k views

Do Governor limits apply to downloading files?

Governor limits include Maximum size of callout request or response (HTTP request or Web services call) - 3 MB Does this include downloading files via HTTP from external servers? Will those files ...
3
votes
1answer
437 views

Iterable Batch class to page through an variable number of web service results

Is it possible to use a iterable batch job to page through a web services result set? I need to import a potentially large number of records into Salesforce via a third party web service. They ...
10
votes
1answer
680 views

Testing callout with zipped static resource

How can I access the content of a static resource zip file to create several callout mocks? I'd like to group all service responses in a single zip file without create several static resources. In ...
0
votes
1answer
3k views

Making Authenticated Web Service Callouts Using One-Way SSL

How do I make web service call out using one-way ssl. I couldn't find any documentation on this. Salesforce has given documentation for two-way ssl connection.
8
votes
1answer
9k views

Why do I get 'PKIX path building failed' exception with my callout?

Error message :PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Hello all please see the above ...
33
votes
2answers
30k views

HTTP Callout from Triggers

I have a trigger on the Custom Object that calls a class. That class makes an HTTP GET request to a Web Service. However I get the following error: Callout from triggers are currently not supported. ...
6
votes
2answers
418 views

System.CalloutException: “Algorithm missing:”

I have been getting a System.CalloutException with the message "Algorithm missing:" when I try to make a call to a specific endpoint. This is an exception that happens intermittently. For example, ...
3
votes
2answers
3k views

How to use Self-Signed CA for 2-way SSL?

I would like to use Self-Signed CA of Salesforce to build a 2-way SSL connection with my Web Server. The Web Server is built on Apache 2.2 and the 1-way SSl test is fine. In the 2-way SSL test, the CA-...
1
vote
1answer
5k views

What does an HTTP Response with a Status Code of -1 indicate?

I am making a web callout in a Batch Apex class and occasionally I am receiving an HTTPResponse with a StatusCode = -1 and a Status = null. Any ideas on what this indicates? Below are the entries ...
12
votes
2answers
11k views

Call webservice with NTLM authentication

Is it possible calling a webservice using NTLM authentication from apex? It is a microsoft navision webservice, I tried to do it in java following this guide and it works.
29
votes
5answers
17k views

Workaround for the 10 web service callout limit in apex?

What are the workarounds for the 10 web service callout limit in apex. If you need to make, say 50 callouts, how do you batch them so that you can execute them all asynchronously? Is there a good ...
18
votes
2answers
5k views

WebServiceMock causing “CalloutException: You have uncommitted work pending” when creating managed package

I have a number of test methods that call Test.setMock(WebServiceMock.class, new SomeWebServiceMockImpl()); where SomeWebServiceMockImpl implements WebServiceMock. These test methods pass when I run ...
2
votes
3answers
1k views

Options for callouts from triggers

I need to make some callouts from code that initiates from a trigger. I realize that you can't do a callout directly from a trigger. Currently what I do is make a future call to code that then ...
31
votes
6answers
26k views

Testing HttpCallout with HttpCalloutMock and UnitTest Created Data

We have a callout to an external webservice that requires retrieving some data from the database via SOQL and then issuing an HTTP GET request, and performing various logic based upon the response. ...
8
votes
2answers
8k views

web service callout failed error

I'm having an issue with the Address Verification method available through StrikeIron. I imported the following WSDL and am using the generated wsdl2apex code. The WSDL I'm using is here: http://...
5
votes
1answer
16k views

Read timeout error calling a third party REST API

I am getting Read timeout error while calling a third party REST API. Can I catch it using try catch block? Or it is not catchable like other Limit Exceptions. Please explain.
1
vote
1answer
2k views

Forcing a test method to fail if a web service callout is attempted

When an apex test method attempts to make a web service callout something like the following is logged: 23:11:45.288 (4288851000)|EXCEPTION_THROWN|[116]|System.TypeException: Methods defined as ...
6
votes
2answers
959 views

Can I access Remote Site List from Apex?

Our application makes outbound connections to different remote sites, and installs a short list of those sites as part of the Package Installation process. One of our custom objects is a list of ...
80
votes
2answers
13k views

Has anyone, ever, successfully invoked the Metadata API from within Apex?

While researching a semi-related question posted here earlier, I dug up some interesting and conflicting information regarding whether it's even possible to use the Metadata API from within Apex. I ...
3
votes
1answer
251 views

How are wsdl2apex generated private member variables referenced?

When generating apex code through a WSDL, several classes and member variables are generated. Each data type has its own class and the class has at least two private member variables associated with ...
15
votes
2answers
5k views

How do you write a unit test for a trigger whose only function is to make a callout?

What is considered a best practice for writing a unit test (to maintain code coverage) on a trigger whose sole function is making a callout (Which also means it has to use a future method)? Neither ...