How do these fit together : Silverlight, Apache, PHP, MySQL, Web Services? - database

I have been attempting to teach myself quite a bit about silverlight, and how it all works, for the past few weeks, and I am to the point in my app development where I would like to connect up to my web server's MySQL database.
My web server is capable of running ASP.NET pages, but is Apache, and natively runs PHP (which is what I'm far more familiar with). It has a MySQL database engine, and I am very well-versed in your typical dynamic page creation with PHP and MySQL.
What I'm NOT familiar with are these "Web Services" that people keep mentioning every time I find an answer regarding the question of "how do you connect silverlight to a database?"...
So my basic question is really one of data FLOW, and where everything fits in the puzzle, and how to get it all working in this particular configuration. Most of the answers I have seen deal with IIS instead of Apache, ASP.NET instead of PHP, and MS SQL Server instead of MySQL.
Also, answers tend to start using abbreviations and acronyms without actually explaining what they stand for.
For example: What is WCF, and RIA services, and how do they fit in to the puzzle as a whole?
I suppose I'm just looking for a top-down overview of the structure of data flow on a MACRO level, not on the micro (code) level.
(Edited to add:)
Also: I have done vb.net apps in the past which have used MySQLConnector.NET to pull from my web server's database remotely, but I understand that the client machine would have to be whitelisted as a remote machine, meaning I'd have to open my MYSQL server up, and make the access mask basically %.%.%.% in order for any client to connect... and that is undesirable... so if I understand things right, the web service runs on the web server, and the client sends requests to it, and the web service acts as an intermediary, grabbing the data from the database (possibly with some sort of "stored procedure" look-alike?), and passes the data on to the client... which also means all database access credentials are on the server, and not inside the (potentially hackable) client...
Do I have it right?
Also, when answering, I need to know where the access to the web services is... in the silverlight APP project code, or the silverlight WEB project code...

I have found this wonderful tutorial that helps to explain it...
http://www.designersilverlight.com/2010/05/23/php-mysql-and-silverlight-the-complete-tutorial-part-1/
Here is how I understand it all working.
There are 3 "Layers" to the process: The application, the web server, and the database.
The application calls out to the web server to execute a script file (like a normal PHP script). There script file can have normal URL variables passed to it (like script.php?foo=bar, so $foo is defined as "bar" in the script)... so you can use those URL encoded variable/value pairs to tweak your script results as you would normally with a web page.
I imagine you would have one script per TYPE of database query, with var/value pairs to tweak your results. So on your web server you would end up with numerous PHP scripts, just like you would normally for a website with different pages, and you pass variables in to those scripts to customize the results.
For example, for users, you could have a get_users.php script that would return all users...
but get_users.php?loggedin=true would get all users that are logged in currently
get_users.php?loggedin=true&ingame=true would get all users that are logged in and in a game... You just script the logic and the resulting SQL query accordingly.
All of the results are encoded either with XML or JSON (Javascript Open Notation: see What is JSON and why would I use it? ) for transport to the app... the app, in effect, is reading the results of an echo of the JSON encoded stuff.
If you were to open these scripts in a web browser, the only thing you would see is a text printout of the JSON data... no web page... just data that is read by the app and then decoded in to objects.
So in effect, the silverlight app is reading a text output of a PHP script executed on your web server, and interpreting the output.
^^^^^ THIS IS THE SHORT ANSWER TO MY QUESTION. :)
To be blunt, the whole use of the terminology "web service" is misleading, and what was really leading me astray. I thought it was some sort of service or app you had to install on your web server just like PHPMyAdmin or something.

Related

Fetching database data from angular

Is it possible to fetch database data directly from Front end app(Angular or any other) with out server?
I am not getting any idea to try.
No, you need a server of some kind, whether it's Java, C#, NodeJS, or something like GraphQL.
Let me clarify something, remember that your Angular and React run in Javascript, which run on the user's browser, on the user's computer, whereas the backend code runs on your server which you have a lot of control over. The browser is very much a sandbox and has only limited capabilities due to security concerns and it's development over the years.
Now, you could say, that someone has a API that you can consume without a database server - however, you are probably still not talking to their database server, you're talking to their back-end app server.
There are many services out there such as AWS, Firebase, which can provide this, and are dubbed "Serverless" because the main construct is an application or service, rather than a server.. But somewhere, there's a server.

How to call SOAP web service from InTouch Wonderware or SQL Server 2014

I've been trying for a while to call an existing SOAP web service from InTouch Wonderware or MS SQL 2014. It doesn't matter which of the two calls it, as the Wonderware project reads/writes to the SQL Server database anyway.
My knowledge is mostly limited to Wonderware and its in-program options to access the SQL Server database, which doesn't work well with the usual guides on the web service topic.
The web service is provided by the customer, over a decade old and outsourced, which rules out any changes to it. The goal is to request raw material data from the web service by ID, and later returning the produced material data. The parameters of each function is documented, but the only existing URL requires username/password and directly shows the content of the WSDL file. That file (when saved locally) works on SoapUI, and test cases deliver the required results.
My problem is the first step - connecting to the web service and sending/receiving the messages. WebSVC (the InTouch web service client) cannot handle the basic authentification, even failing to connect when including username and password in the link (which works in any browser). Guides on that topic are often outdated, or don't match the problem at hand.
As my knowledge of databases and web programming is limited, how can I use the web service (in a preferably uncomplicated way)? Performance doesn't matter - the database handles less than 10 requests per minute on average, and delays don't disrupt anything essential.
To quote Jeroen Mostert's comment: "if you're on Windows, PowerShell's New-WebServiceProxy allows you to wire up SOAP services quite easily, and inserting things into SQL Server from it is equally simple (Invoke-Sqlcmd)."
This approach works. To sum up the steps until I got an answer from the web service:
Upgrade to PowerShell 5.1 (Win7 VM didn't have it)
Set up WebServiceProxy by microsoft guide
Add credentials, attributes and test method by external guide, solving the authentication issue and getting the required input format

Server for app and website

I am a begginer when it gets to back-end development.
I already have a front and website (html cuss javascript) and I am considering to make an app version of my website.
My website is a multi category blog.
I had a problem of understanding how can I connect a server to my website AND my native app. I know basics of php.
I read articles and q/as , all I could understand is that mobile apps and website use seperate server.
Web server and application server
-- -- is there a way to make a server for both, or is it better to use seperate servers?
-- -- if I use seperate servers for seperate platforms how do I make them show same content without changing it on both servers ( one database for two?)
-- --I heard about a system of creating a main database and a copy of it . Then I sync the copy to the main. How do I do that.
-- -- are there any doc's I can read on this subjects:
1) server for all platforms
(browser,ios app, android app)
2)databse system for seperate servers
From my general experience and the most basic solution, you have a single server in the backend which houses the database as well as the code required to fetch data from the database and supply it.
For example assume that you wrote a function called fetch all users that fetches users from the db and gives back a list of users as its results.
Now irrespective of which platform you are on, you would be able to call that function fetch users and get the data back, if you're on a mobile app, you would need to make an http request to that function, if you're on the web ie, front end you would be making an ajax request. So yes all your code is in one place in the backend. You do not need to make 2 servers for 2 different platforms.
P.S. when you code for the backend use a framework.

Website that communicates with Server

I'm a newbie. Im thinking about developing a website that people can be come members of and login. I know that ill need to have a server with a database to store info. What i need to know is, do i just need to create the server host site host it and then have my website hosted somewhere else. To sum up, what's needed in the process of developing this type of site?
No, you can host everything in the same server. Back-end and front-end are words just to describe the organization of your code, being HTML, CSS and Javascript files your front-end, and the rest your backend.
Most host services today have Ruby, PHP and ASP supported by all plans, just as MySQL. There are no need for developing two parts in your application - but you can do that if you want.
I suggest you start by studying what is the MVC structure.

Using the EPiServer Communities API from a console app?

I'd like to write a console or winforms application that will interact with the EPiServer database. Since I don't want to muck about in the deep inards of the database I'd like to use the EPiServer API.
However, all the examples are using the "CommunitySystem.CurrentContext" which is null when running outside the website.
Now, I'm going to transfer a large amount of data from a legacy system to EpiServer Community and I really don't want to do that from a web page but from an application I have a little more control of.
Is there any way I can use the API from outside the web context?
I'm not that familiar with the community model. But... I've had no problems at all running huge imports through a web form (or control). The key (besides having disabled execution and database timeouts) has been to run it through Internet Explorer on the site's server and have the site's domain name mapped to 127.0.0.1 in the HOSTS-file. It can run for hours and hours while logging progress to a table or text-file before sending the response.
My colleague Jarle figured out the last bits and blogged the whole process here So if you want to run the EPiServer API outside of IIS, that's the place to start. Works like a charm!

Resources