Announcement

Collapse
No announcement yet.

HTTP request don't run on HTML5 package

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HTTP request don't run on HTML5 package

    Hi friends!! I have got a problem with my code to catch a http request on HTML5 package. ALL THIS CODE RUNS PERFECT IN THE UE EDITOR but when I package the project to HTML5 platform and I execute the package files the log shows this:

    Timeout processing Http request
    Connection error

    The code does a petition to a server. This is my code, it's a fragment from a parent class of blueprint asset:

    My Build.cs
    Code:
    using UnrealBuildTool;
     
     public class juangacedos_web : ModuleRules
     {
         public juangacedos_web(TargetInfo Target)
         {
             PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
     
             PrivateDependencyModuleNames.AddRange(new string[] {  });
     
             PrivateDependencyModuleNames.AddRange(new string[] { "HTTP" });
                 PrivateIncludePathModuleNames.AddRange(new string[] { "HTTP" });
     }
    In my .h file I have got this includes:
    Code:
     #include "Runtime/Online/HTTP/Public/Http.h"
     #include "Runtime/Engine/Public/DDSLoader.h"
     #include "Developer/ImageWrapper/Public/Interfaces/IImageWrapper.h"
     #include "Developer/ImageWrapper/Public/Interfaces/IImageWrapperModule.h"
    And My .cpp do this:
    Code:
     void ACOD_cargaObra::BeginPlay()
     {
         Super::BeginPlay();
     
         TSharedRef < IHttpRequest > Request = FHttpModule::Get().CreateRequest();
         
         //Set Request
         Request->SetVerb("GET");
         Request->SetURL(ip + FString("query_obra.php?id=1"));
         GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, Request->GetURL());
         Request->OnProcessRequestComplete().BindUObject(this, &ACOD_cargaObra::PaginaLinkada);
         if (!Request->ProcessRequest()){
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Problem processing the request "));
         }
         
     }
     
     void ACOD_cargaObra::PaginaLinkada(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful){
         FString mensaje;
         FString cadena;
         FString valor;
         TArray <FString> atributos;
         int indice;
     
         if (bWasSuccessful){
             if (!Response.IsValid()){
                 UE_LOG(LogTemp, Warning, TEXT("Response not is valid"));
             }
             else{
                 //
                 //
                 //parsing the response
                 //
                 //
                 mensaje = Response->GetContentAsString();
                 TArray< FString > stringObras;
                 numObras = mensaje.ReplaceInline(TEXT("///"), TEXT("///"), ESearchCase::IgnoreCase);
                 mensaje.ParseIntoArray(&stringObras, TEXT("///"), false);
                 for (int i = 0; i < stringObras.Num() - 1; i++){
                     FString cadena = stringObras[i];
                     for (int j = 0; j < ATRIBUTOS_CUADROS; j++){
                         indice = cadena.Find(TEXT("|||"), ESearchCase::IgnoreCase, ESearchDir::FromStart, 0);
                         atributos.Add(*cadena.Left(indice));
                         cadena = *cadena.Right(cadena.Len() - (indice + 3));
                     }
                     COD_detalle_obra obra(FCString::Atoi(*atributos[0]), atributos[1],
                         FCString::Atoi(*atributos[2]), FCString::Atoi(*atributos[3]),
                         atributos[4], atributos[5], atributos[6], atributos[7]);
                     obras.Add(obra);
                     atributos.Reset();
                 //
                 //
                 //
                 //
                 }
                 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, mensaje);
                 //Event for the blueprint child
                 this->OnQueryFinalizada(stringObras.Num()-1);
             }
         }
         else{
             UE_LOG(LogTemp, Warning, TEXT("Connection error"));
         }
     }
    My ip string it's: FString ip = FString("http://192.168.1.16:3334/");
    And I tried this with the same result in others remote servers
    Thanks!!

    #2
    Hey Adri,

    Thank you for posting this issue on the forums. I will actually be handling your AnswerHub post where I will continue to help resolve the issue you're currently running into.

    Thanks!
    Twitter @UnrealSamantha
    Mobile Development Troubleshooting Guide | Package and Deployment Troubleshooting | How do I report a bug?
    Call me to a thread by posting this: [MENTION]Samantha Sutton[/MENTION]

    Comment

    Working...
    X