Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Basic HTTP Request from a BlueprintCallable Node


I'm trying to make a basic HTTP Request using a BlueprintCallable node, and I can't make it work. I've read and followed some tutorials and came up with a working "BP Actor" in game doing the HTTP Request, but now i want it to work with a single callable blueprint node like this (without the Target input) : alt text

I've been on this for days now, and I still can't make it work.

Here's what I got now :

.h :

alt text

.cpp :

alt text

The problem is, on the .h file. If I don't put a "static" on my void, the blueprint node ask me for a "Target" in input. I Don't know what "Target" he wants exactly to put here, So I put the void on static. But now, as you can see on the .cpp file, some variables like HTTP or the "this" reference can't be used anymore on this static void.

I'm very bad on CPP, so i'd by glad if someone could help me with this ! Thanks

Product Version: UE 4.15
cpp_bpnode.png (27.6 kB)
cpp_h.png (34.6 kB)
cpp_cpp.png (50.2 kB)
cpp_cpp.png (50.2 kB)
more ▼

asked May 23 '17 at 06:07 PM in C++ Programming

avatar image

11 1 3 4

avatar image Shadowriver May 23 '17 at 07:27 PM

can you try removing tab before "static"? maybe it's confusing UHT

avatar image Kiwii- May 23 '17 at 08:50 PM

Thanks for you answer. I tried it, but it didn't work. I don't think that's the problem, it's normal that it doesn't work. I understand that I can't call non-static parameters of an object in a static function.

avatar image Shadowriver May 23 '17 at 09:10 PM

Ah sorry i missunderstood your quastion ^^" ok here comes the real anwser

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Normally you call function on a object right? By making function static you make it callable without a objectneeded, but still function be in class namespace.... this effectively also means you can't access "this" because you not calling from object anymore, so there is no "this" naymore. You say yourself, you don't want that "Target" pin, but without it you can't deliver "this" variable to the function.

In other words you can access only static and global functions from static functions, same goes with varables.

So in your case instead of using http variable you need to use FHttpModule::Get() (which is also static function) direclly, all save it up in local variable.

more ▼

answered May 23 '17 at 09:19 PM

avatar image

37.1k 935 172 1116

avatar image Kiwii- May 23 '17 at 10:24 PM

Changing the Http Var for a "FHttpModule::Get()" still doesn't work (its not accepted), and i'd still get the "this" problem that I can't use.

avatar image Shadowriver May 24 '17 at 02:24 AM

FHttpModule::Get() should work it's static


It's returning reference so make sure you using "." instead of ->", and as i said you can still use http var, just declere it as local variable inside function.

Sorry didn't notice binding. There no way to get "this" in static, again object you trying to access does not exist, so you need to find alternative methods. In case of event, you can turn OnResponceRecived in to static, and use BindStatic instead of BindUObject.

If i'm not mistaken blueprint supports passing of delegates as arguments too, which you can bind with blueprint events, but i'm not sure if all delegates are supported, you might try research on that too.

h.png (32.4 kB)
cpp.png (51.9 kB)
avatar image Kiwii- May 24 '17 at 09:28 AM

Thank you, This actually works!

I'll post the new (working) code here. It might help someone in the futur =)

.h :

alt text

.cpp :

alt text

h.png (32.4 kB)
cpp.png (51.9 kB)
avatar image PingouinGames Apr 11 '19 at 11:29 PM

Hi, i just read your answer because i have the same problem. But the last posts (working code) you put on ".h : " the .cpp image. The .cpp image is two times.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question