5

Currently stuck at trying to send a JSON structure through web services but keep receiving the error:

Method does not exist or incorrect signature: void send(System.HttpRequest) from the type System.HttpRequest

public class order_web_services {

@future(callout=true)
public static void order_web_services_rest(String order_JSON){

    HttpRequest request = new HttpRequest();

    String endpoint = 'https://some_web_site.com';
    request.setEndpoint(endpoint);

    request.setMethod('POST');

    request.setBody(order_JSON);

    HttpResponse response = HttpRequest.send(request);
}}

I am a bit confused as to why this error keeps getting thrown. Can someone please help me out.

1 Answer 1

6

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 does not have this method, and please note it is an instance method, not static.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .