I'm developing a Adobe AIR application using Flash Builder 4. This app needs to access a remote PHP service which is being hosted on a remote web server.
I am having troubles figuring out how to add a PHP data service which uses a remote service. I can add the PHP data service in Flash Builder as a service hosted on localhost, but given that this will not be feasible when the application is deployed, will not work.
Does anyone know how to connect a Flash Builder (Flex) project to a remote PHP data service?
Thanks,
Chris
Ok, I think I got it figured out. Here's the steps that I took to get it working on the remote server:
First, the service should be set up from Flash Builder as a data service on your local computer (local server running).
After you have checked to make sure the service works from your local machine, upload your PHP service file to the remote server. Also, upload both gateway.php, amf_config.ini, and the ZendFramework folder.
Make sure to keep the folder structure the same on your remote server.
Add a constructor to your service.as file in Flash Builder with a line as follows:
_serviceControl.endpoint = "http://www.remote.com/gateway.php"
Where the URL is pointing to your remote gateway.php.
Make sure your amf_config.ini file on the remote server is configured correctly.
is it possible to pass a variable to service.as for _serviceControl.endpoint eg:
_serviceControl.endpoint = MY_VARIABLE
where MY_VARIABLE is defined somewhere inside the AIR application or is user defined
Related
i am building a test app that will display all the sales made by a shop. this app will be built with the flutter framework, i do not have any problem when it come to front-end, but as of the back-end side of the app i have no idea where to start. i will handle client auth with firebase. i have a test .mdf file filled with test sales numbers and dummy customer data on a separate machine running windows server 2009 r2. My question is whether there is a way to fetch data from that file that is in that server and display it on the app. i have no background in the backend so i will need a thorough explanation on the coding languages and technologies that i will need to use. thanks in advance
i ended up creating an api using nodejs, i made a config file and gave it the db properties as of the username and password i was able to connect to mssqlserver using windows auth and i added a user to give to the config file in the api, i then used ngrok to deploy the running api on the internet and that is what i am using to show the data on the app
I am developing an app with PhoneGap (Cordova) + Framework7 and I need to connect to a database. The issue is that it's an hybrid app, which means the www files are local and the app creates an internal server, and so if you try to use AJAX to run a php file it crosses domains, since it'll try to reach for my webserver while it's running it's own server. What can I do?
(I know Cordova has a utility named WebSQL that connects to SQLite, but my database is MySQL, and I think it can only connect to a local db)
(You can't move php to be local because Cordova can't run php files, also it's probably not very secure)
My suggestion is to use Ajax to access your server. (to run the PHP file) You can allow your server URL in environment variables of frontend.
Check for Content-Security-Policy and connect-src in frontend and add your server URL there. Then you will be able to send Ajax to your server.
Hope this helps.
I would like to debug my Google App Engine (GAE) app locally but without using localhost. Since my application is made up of microservices, the urls in a production environment would be along the lines of:
https://my-service.myapp.appspot.com/
But code in one service can call another service and that means that the urls are hardcoded. I could of course use a mechanism in code to determine whether the app is running locally or on GAE and use urls that are different although I don't see how a local url would handle the since the only way to run an app locally is to use localhost. Hence:
http://localhost:8080/some-service
Notice that "some-service" maps to a servlet, whereas "my-service" is a name assigned to a service when the app is uploaded. These are really two different things.
The only possible solution I was able to find was to use a reverse proxy which would map one url to a different one. Still, it isn't clear whether the GAE development SDK even supports this.
Personally I chose to detect the local development vs GAE environment and build my inter-services URLs accordingly. I feel it was a well-worthy effort, I've been (re)using it a lot. No reverse proxy or any other additional ops necessary, it just works.
Granted, I'm using Python, so I'm not 100% sure a complete similar Java solution exists. But maybe it can point you in the right direction.
To build the per-service URLs I used modules.get_hostname() (the implementation is presented in Resolve Discovery path on App Engine Module). I believe the Java equivalent would be getInstanceHostname() from com.google.appengine.api.modules.
This method, when executed on the local server, automatically provides the particular port the server listens to for each service.
BTW, all my services for an app are executed by a single development server process, which listens on multiple ports (this is, I guess, how it can provide the modules.get_hostname() info). See Running multiple services using dev_appserver.py on different ports. This is part I'm unsure about: if/how the java local dev server can simultaneously run multiple services. Apparently this used to be supported some time ago (when services were still called modules):
Serving multiple GAE modules from one development server?
GAE modules on development server
This can be accomplished with the following steps:
Create an entry in the hosts file
Run the App Engine Dev server from a Terminal using certain options
Use IntelliJ with Remote debugging to attach the App Engine Dev server.
To edit the hosts file on a Mac, edit the file /etc/hosts and supply the domain that corresponds to your service:. Example:
127.0.0.1 my-service.myapp.com
After you save this, you need to restart your computer for the changes to take place.
Run the App Engine Dev server manually:
dev_appserver.sh --address=0.0.0.0 --jvm_flag=-Xdebug
--jvm_flag=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
[path_to_exploded_war_directory]
In IntelliJ, create a debug configuration. Use the Remote template to create this configuration. Set the host to the url you set in the hosts file and set the port to 8000.
You can set a breakpoint and run the app in IntelliJ. IntelliJ will attach to the running instance of App Engine Dev server.
Because you are using a port during debugging and no port is actually used when the app is uploaded to the GAE during production, you need to add code that identifies when the app is running locally and when it's running on GAE. This can be done as follows:
private String mServiceUrl = "my-service.my-app.appspot.com";
...
if (SystemProperty.environment.value() != SystemProperty.Environment.Value.Production) {
mServiceUrl += ":8000";
}
See https://cloud.google.com/appengine/docs/standard/java/tools/using-local-server
An improved solution is to avoid including the port altogether and not having to use code to determine whether your app is running locally or on the production server. One way to do this is to use Charles (an application for monitoring and interacting with requests) and use a feature called Remote Mapping which lets you map one url to another. When enabled, you could map something like:
https://my-service.my-app.appspot.com/
to
https://localhost:8080
You would then enable the option to include the original host, so that this gets delivered to the local dev server. As far as your code is concerned it only sees:
https://my-service.my-app.appspot.com/
although the ip address will be 127.0.0.1:8080 when remote mapping is enabled. To use https on local host however does require that you enable ssl certificates for Charles.
For a complete overview on how to setup and debug microservices for a GAE Java app in IntelliJ, see:
https://github.com/JohannBlake/gae-microservices
I am running unit testing in silverlight.
I have the test data and I need to export it to local disk without user interaction.
I have thinked to export a file but it seems that it requires user interaction.
I thought I could try a local process that listens for silverlight data on a connection, which saves the data automatically, but didnt find if it is possible and how.
Can anyone help me on how to automatically export data from silverlight to local disk?
Checkout the answer on this SO question. It shows how to access the local file system, however it does require user interaction.
I would just add a page to the web app that is hosting the silverlight plugin that allows you to store the data locally. You can the post your data and have your backend (asp.net I suppose) store the data locally. If you already use WCF to comunicate with your backend, you can use that instead.
I have solved with a local server, it provide http web server, policy server and a socket listener.
The server run and:
- listen as http server for silverlight page requests.
- listen on a local port for silverlight test results encoded as xml
- listen on another port as a policy server, because silverlight need it to connect on a socket
Next the server starts internet explorer pointing to his own web server, at unit test page,
When the tests are finished I get the test result data structure in silverlight, open the connection to the local server (validated by the policy server) and send to it the result encoded in a string.
The server have full access to local file system, so it can silently produce output.
I'm developing a silverlight application that uses a web service. It works just fine when I run it on my local machine but when I publish it to a remote server, it fails because it is looking for a a crossdomain.xml policy at localhost:4689 instead of the websites root directory. How do I fix this?
Thanks for the help!
When you add the service reference, the host--in your case, localhost--is included as part of the generated code, and is the default endpoint when you create the service client on the Silverlight end with no constructor parameters.
Use the constructor overload of the service client class that accepts a Uri parameter to specify the correct hostname (and path to the .svc file) on your production server.
You need to edit your ServiceReferences.ClientConfig because when you deploy your project it's still using the endpoint address of your local computer.