Error 404 for rest webservice request in offline app in GeneXus Ev3 U9 - genexus

I'm developing an offline Android app with Genexus Ev3 U9 and when I try the app in the device I see there is no initial synchronization, even when I try to execute a manual sync the app shuts down. The cat log shows that request made to URLs like http://192.168.12.17/MyAppSmartDevicesEnvironment/gxmetadata/MyApp.android.json
worked fine but when the app tries to get this URL http://192.168.12.17/MyAppSmartDevicesEnvironment/rest/MyAppOfflineDatabase?fmt=json&event=gxchecksync returns 404 I tried the same link in my laptop and it's like the requested resource was not created by GeneXus.
What could be wrong?

There are actually a couple of things you might want to check.
When you accessed http://192.168.12.17/MyAppSmartDevicesEnvironment/gxmetadata/MyApp.android.json you got data but that just means that the virtual directory was successfully created. (which is good of course)
Then you need to check if the WCF module is installed correctly, in order to do that you could try to go to http://192.168.12.17/MyAppSmartDevicesEnvironment/MyAppOfflineDatabase.svc/rest or any other service in your KB. That goes straight to the service implementation. (you can check you web.config file in order to see the actual rewriting rules)
If that works it's certainly a URL Rewrite problem like Sandro and Guscarr suggested.
You can download and install the module from here: http://www.iis.net/downloads/microsoft/url-rewrite

Gcastano,
It seems that you're generating to .net, right?
If so, it could be some problem with iis rewrite module.
Anyway you might check gx software requirements...

It seems that REST services cannot be run on your IIS, as Sandro said, try installing URLRewrite.
Further info at http://wiki.genexus.com/commwiki/servlet/wiki?14575,Android%20-%20FAQ%20and%20Common%20Issues

Related

Laravel deployment issue on Linux sharded server

I have built my Laravel application on a Windows10 machine. For the deployment on my Linux server (shared server), i have followed this youtube tutorial https://www.youtube.com/watch?v=x4VIWOj_9dA
My Application works fine on my developpement computer. The method of the tutorial works fine on window machine. But when i made the deployment on Linux with the same package i have tested on my Windows machine, for a page that does not call a controller, it works but for any page where a controller is called, i receive this error message (an example for a page that requires the kitContrller):
Illuminate\Contracts\Container\BindingResolutionException
Target class [App\Http\Controllers\kitController] does not exist.
My problem is that the target controller existes in the indicated folder without any case problem but the message says that it does not existe.
Please, help.
After some other verifications, i saw that the problem was in my router: In the router, i have written the name of the Controller with lower case (Example: kitController in stead of KitController.
k(Lower case) in stead of K(upper case): That was the problem. I have changed things and it works fine.
Thank u for suggestions.

how to debug during API with laravel

I run my laravel app #localhost.
```php artisan serve --host=localhostIP```
On top I run an Andoid app with the same base URL.
Could anyone tell me how can I debug incoming API´s calls
like if BASEURL/users is called?
Furthermore, how can I log the happening events in the console
I am developing API's with laravel too, i do it this way:
composer require laravel/homestead to have it all in a vm 😉 see https://laravel.com/docs/master/homestead for more information, i use the "per project" installation
Download postman to have the best tool for sending querys to your api and to test your api quick -> https://www.getpostman.com (i use it free)
configure and run your homestead (it's not that complicated).
your homestead is fit with php and xdebug enabled
i am using phpStorm and have my vagrant setup as deployment target
"listen to debug" with phpstorm
to your GET requests, add a queryparam XDEBUG_SESSION_START=PHPSTORM
i can debug my api now 😉
i also wrote https://logcrawler.de to receive the log informations of all my api's and all my server 🤩
I hope, i could help you a little bit
This is my way, but I think it's not good!
Create router api in config/web, Eg:
router/api: Route::post('/check_api', [CheckController::class, 'testFunc'])->name('api.check_api');
web/api: Route::post('test/check_api', [CheckController::class, 'testFunc'])->name('test.check_api');
Create a post by form or ajax in one resource/view like index
Go to page, and debug with phpstorm
You can use logging feature of Laravel. Apply Logs on entry point of application to test whether API url is hitting or not.
use postman
https://www.getpostman.com/downloads/
it's an excellent thing very much usefull

Hyperledger-Composer REST Authentication

Request assistance with hyperledger composer. I have created a network and web app around the REST API that was built with the composer-rest-server. I am able to add participants, assets and execute transaction with the default settings. I am now trying to add authentication to the REST server as well as add identities to new participants. However I got stuck. I have reviewed the information at
https://hyperledger.github.io/composer/integrating/enabling-rest-authentication.html
But I'm not sure where I should place the export COMPOSER_PROVIDERS='{.... information to continue the setup.
Any assistance, tips and tricks are much appreciated.
Ok so I figured it out. The problem was that I was running off an older version of composer-rest-server.
I installed the developer tool back in Sep 17 and did the tutorial soon after. I tried the tutorial again and noticed that the deployment command was different and it would not let me deploy my network.
So I updated the composer-rest-server and component cli and it deployed fine. I then followed the steps on the authentication webpage that I referenced above and it worked as intended. I deployed my personal network with the new command and it worked as intended.
Lesson learned this stuff is still being updated and I should be more aware on what changes. Thank you very much #nilakantha singh deo
Open a new terminal from inside the project folder.Format your COMPOSER_PROVIDERS in notepad according to the document you mentioned and copy the whole message and paste it in the terminal.Then you can echo it (see it) by typing the following.
echo $COMPOSER_PROVIDERS
It should ideally return the same json file.
Then make sure that the compopser-rest-server is running with multiuser mode and authentication enabled in the same terminal where you echoed and saw the COMPOSER_PROVIDERS.
In browser now type
localhost:3000/auth/github
It should ask for authentication .Rest of the steps are listed in the document you mentioned.
Cheers!

WordPress Website shows 403 error when accessing wp-admin/ajax.php page from front end

I am running a WordPress on an Azure Web app connecting to a MySQL server on a different Windows server. When loading the mentioned page in Chrome, it shows 2 popups 403 & Forbidden. Checking the console throws this error - ecbcc.js:2 POST /wp-admin/admin-ajax.php 403 (Forbidden)
This works fine on FireFox & IE but not on Chrome. Any ideas why?
This is because of your cache. Minified version of JS is causing the issue in chrome browser. Check or purge the cache and check for the permissions applied to cached files as well.
I faced the same issue but it took a long time for me to fix it. Because my solution was not caused by common things like cache, .htaccess, files permissions, etc. I apply all the possible solutions as described here. When nothing worked for me, then I talked with my hosting provider and the issue was on their side. Actually, the server has black-listed my IP.
Below is the reply from the support of my hosting provider:
After checking it, it looks like the issue is caused by trigger
ModSecurity rules.
ModSecurity is an Apache module that works as a web application
firewall. It blocks known exploits and provides protection from a
range of attacks against web applications. However, sometimes,
mod_security may incorrectly determine that a certain request is
malicious, while it is actually legitimate. In such a situation, we
can whitelist the triggered mod_security rule on the server, so that
you can bypass the block.
In order to properly investigate, we need you to share your IP address
with us. You can copy it from here: https://ip.web-hosting.com/
Looking forward to your response.
This error can appear for more than one reason. Except for the accepted answer, if you are using a shared hosting solution as a server then it would be best to contact the support of the service. Also if you use Plesk or Cpanel you can check the server logs to see if there is any false positive rule that from mod_security that catches the error. Then you can find the error that could look something like that:
ModSecurity: Warning. Match of "test file" against "REQUEST_FILENAME" required. [file "/etc/httpd/conf/modsecurity.d/rules/custom/006_i360_4_custom.conf"] [line "264"] [id "77140992"]
You can apply the ID on your firewall exclusion list (if this is provided by your hosting service) and then the server will not block the request anymore.
IMPORTANT: If you are not sure what you are doing, ask your hosting provider for support. Experimenting on live servers/sites is not the best option and I would strongly recommend avoiding it.

"Cannot connect to server" while installing ipa through OTA

I have provisioning profile is installed and successfully created the ipa. The ipa will install in Dropbox without any problem, but the same ipa will give the error while installing through OTA.
I have attached the screenshot of the error.
How can i solve the issue. Any help would be appreciated.
Thanks.
The answer may depend on what OTA server you are using.
If you are running your own OTA server, like I am, then the problem may be your URL.
I saw the exact same "Cannot connect to..." error today with my personal OTA server. The problem was with the itms-services URL.
itms-services://?action=download-manifest&url=https://3ea1be94.ngrok.com/TestApp.plist
The .plist file name and the hostname for my &url= parameter were incorrect. Once I fixed them and refreshed the page, everything was fine.
If you are using your own OTA server, check that the &url= paramter is accurate and make sure it is using HTTPS. If you are not running your own OTA server, check with whoever is running it as they may be able to assist.
To proper distribute the IPA file from HTTP you should put a webpage with a Link pointing the itms-services special link for example:
Download App
This manifest file you is very simple, you need the bundleid and the URL to the IPA file
You can find an example of start from this one: https://gist.github.com/kEpEx/777df3cb1fd4bd851409
A couple of important things to consider
Valid certificate is required, and URL from Manifest and IPA should be HTTPS, (I'm not sure if self signed certificated works on this)
Take care of the manifest URL, sometimes you have parameters on the URL, you want to urlencode them or use simplier url
Sometimes you want to auth the users before allowing them to download the manifest or IPA files, take care of this, since cookies on the safari are lost when you click on this link, so if you check for session there based on the cookie you will get the "Cannot connect to" message. You will need to came out with a better aproach like generating temporaty tokens or something like that (this point took me 2 days of work to figure it out why it was failing)

Resources