4

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.

5

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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.