Jump to content

g_garzotto

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. g_garzotto

    Trouble with resource path

    You're right. I started from HelloWorld demo, but I didn't notice the RegisterResource call in initialization. Thanks a lot !
  2. Hello everybody, I'm trying MARS to accomplish a simple task: receive a POST call from an external tool (e.g. Postman) containing a valid XML on body, process it and returns another XML. At the end, I should be able to send SOAP requests to this application and returning another XML with fake response. It's basically an emulator of an hardware device. The particularity is that the URL of server MUST BE http://[address]:[port]/cgi-bin/fpmate.cgi and I'm struggle to define paths. Actually, after some tests, my code is the below: Creation of MARS engine procedure TfrmMain.FormCreate(Sender: TObject); begin // MARS-Curiosity Engine FEngine := TMARSEngine.Create; try FEngine.Parameters.LoadFromIniFile; FEngine.BasePath := ''; FEngine.AddApplication('CommandEmulator', 'cgi-bin', ['EmulatorCommands.*']); FServer := TMARShttpServerIndy.Create(FEngine); try FServer.DefaultPort := FEngine.Port; except FServer.Free; raise; end; except FreeAndNil(FEngine); raise; end; end; Definition of resource (contained in a unit called EmulatorCommands.pas). type [Path('fpmate.cgi'), Produces(TMediaType.TEXT_XML)] TEmulatorCommandsResource = class private protected public [POST] function ExecuteCommand([BodyParam] Data: String): string; end; implementation function TEmulatorCommandsResource.ExecuteCommand([BodyParam] Data: String): String; var sXML: String; begin sXML := Data; sXML := StringReplace(sXML, '<?xml version="1.0" encoding="utf-8"?>', '', [rfReplaceAll]); sXML := StringReplace(sXML, '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">', '', [rfReplaceAll]); sXML := StringReplace(sXML, '<s:Body>', '', [rfReplaceAll]); sXML := StringReplace(sXML, '</s:Body>', '', [rfReplaceAll]); sXML := StringReplace(sXML, '</s:Envelope>', '', [rfReplaceAll]); sXML := StringReplace(sXML, #1310, '', [rfReplaceAll]); Result := sXML end; If I execute a request from Postman, I get the result: Resource [fpmate.cgi] not found Surely I'm doing something wrong, but I can't figure out what. Anybody can help ? Thanks in advice
  3. g_garzotto

    Delphi 11 - Android - Google Firebase Crashlytics

    Hello microtronx, I also need to integrate Firebase Crashlytics in my App, I'm still at the beginning. I didn't know that Kastri have this feature, surely I will look at it. I would ask if you can you point me some suggestions on how to do it ? Maybe it's useful also for your question... Thanks in advice, best regsards
×