web + statafmstata web services web service xml desktop applications web applications mobile...
TRANSCRIPT
![Page 1: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/1.jpg)
Web + Stata Web + Stata
Alexander ZlotnikTechnical University of Madrid, ETSIT, DIETechnical University of Madrid, ETSIT, DIERamon y Cajal University Hospital
Stata is a registered trademark of StataCorp LP, College Station, TX, USA.
![Page 2: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/2.jpg)
User-contributed programs
ssc install <program>
findit <program>
(runs both search and net search)
net from http://www.website.com/net from http://www.website.com/
manually copy program files to
C:\ado\plus\<subdir>\
![Page 3: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/3.jpg)
Sometimes this is Sometimes this is not enough
![Page 4: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/4.jpg)
Sometimes your program…
… requires complex interactions with
external software packagesexternal software packages
(ex: WinBUGS, MATLAB, Maxima, AnyLogic)
… uses proprietary data sources
(ex: real-time currency exchange rates)(ex: real-time currency exchange rates)
… uses proprietary source code
![Page 5: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/5.jpg)
Sometimes your audience…
… does not have the version of Stata your
program requiresprogram requires
… does not have Stata at all
… does not have a PC, but may … does not have a PC, but may
have a smartphone with a web browser
![Page 6: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/6.jpg)
What if…?
Your programPrivate
data sources
Stata / Mata
Externalprograms
Stata / Mata
Your server
![Page 7: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/7.jpg)
What if…?
Web interfaceYour program
Stata / Mata
Private data sources
Externalprograms
Access from any device
Stata / Mata
Your server
![Page 8: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/8.jpg)
What if…?
Web interfaceYour program
Stata / Mata
Private data sources
Externalprograms
Access from any device
Stata / Mata
Security: client isolation
![Page 9: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/9.jpg)
How?
Option 1:
Translate Stata / Mata program into
Your program
Translate Stata / Mata program into
a general-purpose programming language used
in web applications.
Ex: Java, C / C++, C#, ASP.net + VB.net, Python,
Ruby, etc
![Page 10: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/10.jpg)
How?
Option 1:
Translate Stata / Mata program into
Your program
Translate Stata / Mata program into
a general-purpose programming language used
in web applications.
Ex: Java, C / C++, C#, ASP.net + VB.net, Python,
Ruby, etc
- Few numerical libraries
- May not have the same functions
- Functions may not be implemented
in the same way
-- subtle errors
-- numerical precision issues
-- performance issues
![Page 11: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/11.jpg)
How?
Option 2:
Translate Stata / Mata program into
Your program
Translate Stata / Mata program into
R & RShiny or SAS Stored Process Web
Application
![Page 12: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/12.jpg)
How?
Option 2:
Translate Stata / Mata program into
Your program
Translate Stata / Mata program into
R & RShiny or SAS Stored Process Web
Application
- Still requires a laborious translation
in most cases
- Again, functions may not be implemented - Again, functions may not be implemented
in the same way
- RShiny is a nice alternative but the free
version only supports one concurrent session
![Page 13: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/13.jpg)
How?
Option 3:
Use a slightly modified version of your
Your program
Use a slightly modified version of your
existing Stata program in a web application.
Stata is a registered trademark of StataCorp LP, College Station, TX, USA,
and the Stata logo is used with the permission of StataCorp.
![Page 14: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/14.jpg)
How?
Option 3:
Use a slightly modified version of your
Your program
Use a slightly modified version of your
existing Stata program in a web application.
-- In this presentation, we will see how to build a
web application using your Stata program, with
minimal modifications based on Stata/IC, Stata/SE
or Stata/MP.
-- Very similar techniques can be used with
Numerics for Stata.
Stata is a registered trademark of StataCorp LP, College Station, TX, USA,
and the Stata logo is used with the permission of StataCorp.
![Page 15: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/15.jpg)
Technologies
Program core: Stata + Mata
Web application language: PHP
Web server: Apache
Operating system: Windows
![Page 16: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/16.jpg)
Technologies
Program core: Stata + Mata
Web application language: PHP
Web server: Apache
Operating system: Windows
Well-known
Easy to use
![Page 17: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/17.jpg)
Technologies
Program core: Stata + Mata
Web application language: PHP
Web server: Apache Open source
Operating system: Windows
Well-known
Easy to use
![Page 18: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/18.jpg)
Web application language
PHP implementation example
Other languages may also be used:
- Java (servlets, JSPs)
- Python
- ASP / ASP.net + C# / VB.net- ASP / ASP.net + C# / VB.net
- C/C++, Perl (CGI interface)
-et cetera
![Page 19: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/19.jpg)
Web server
Apache implementation example
Other web servers, application containers and
application servers may also be used:
- Tomcat
- JBoss- JBoss
- Oracle WebLogic
- IBM WebSphere
- Magic xpa
-et cetera
![Page 20: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/20.jpg)
Operating system
It should be possible to do this on any
operating system that supports Stataoperating system that supports Stata
(i.e. Windows, Unix/Linux, Mac OS X).
![Page 21: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/21.jpg)
General idea
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Mata
Web server /
Application serverStata IC / SE / MP
Operating system
![Page 22: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/22.jpg)
Calling Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Mata
Web server /
Application serverStata IC / SE / MP
Operating system
Stata command(s)
![Page 23: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/23.jpg)
Getting a response from Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Matatext files
images
data files
log files
Web server /
Application serverStata IC / SE / MP
Operating system
![Page 24: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/24.jpg)
Simplified example
![Page 25: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/25.jpg)
Web interface
(HTML / JS)
Calling Stata
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Mata
Web server /
Application serverStata IC / SE / MP
Operating system
Stata command(s)
![Page 26: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/26.jpg)
Calling Stata
![Page 27: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/27.jpg)
Calling Stata
<html><head> Web interface </head><head> Web interface </head><body> <form action=“call_stata.php" method="post">
Stata command(s):<br><br><textarea name="stata_commands" ><br><br><input type="submit" value="Send command(s) to Stata" >
</form></body></html>
![Page 28: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/28.jpg)
Calling Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Mata
Web server /
Application serverStata IC / SE / MP
Operating system
Stata command(s)
![Page 29: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/29.jpg)
Calling Stata
call_stata.phpcall_stata.phpcall_stata.phpcall_stata.php
<?php<?php<?php<?php............
$stata_commands = $_POST[“stata_commands”];
write_stata_do_file($stata_commands);
execute_stata_do_file();
............>>>>
![Page 30: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/30.jpg)
Calling Stata
Our web application will execute:
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
We’ll previously write our commands here
$stata_commands
![Page 31: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/31.jpg)
Calling Stata
Our web application will execute:
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
cdcdcdcd <<<<path_to_temp_folderpath_to_temp_folderpath_to_temp_folderpath_to_temp_folder>>>>
We’ll previously write our commands here
Example:
$stata_commands
cdcdcdcd <<<<path_to_temp_folderpath_to_temp_folderpath_to_temp_folderpath_to_temp_folder>>>>sysusesysusesysusesysuse autoautoautoautohistogram pricehistogram pricehistogram pricehistogram price
![Page 32: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/32.jpg)
Calling Stata
Our web application will execute:
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
(Stata User’s Guide, section [B.5])(Stata User’s Guide, section [B.5])
![Page 33: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/33.jpg)
Calling Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Mata
Web server /
Application serverStata IC / SE / MP
Operating system
Stata command(s)
![Page 34: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/34.jpg)
Calling Stata
Ex: PHP
-- synchronous execution-- synchronous execution
-- asynchronous execution
shell_exec(............);
pclose(popen(............,"r"));
![Page 35: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/35.jpg)
Calling Stata
Problem: modern versions of Stata will not
work if called directly from a web server work if called directly from a web server
(SYSTEM user).
stata.exe /e /q …
Web application
Stata IC / SE / MP
PHP: shell_exec()
![Page 36: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/36.jpg)
Calling Stata
Problem: modern versions of Stata will not
work if called directly from a web server work if called directly from a web server
(SYSTEM user).
Solution: wrapper + user impersonation
Wrapper library
Stata IC / SE / MPstata.exe /e /q …
Web application
PHP: shell_exec()
![Page 37: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/37.jpg)
Getting a response from Stata
Web interface
(HTML / JS)
Web application
(PHP / Java /
ASP.net + C# / etc…)
Program written in
Stata / Matatext files
images
data files
log files
Web server /
Application serverStata IC / SE / MP
Operating system
![Page 38: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/38.jpg)
Getting a response from Stata
Our web application will execute:
cdcdcdcd <<<<path_to_temp_folderpath_to_temp_folderpath_to_temp_folderpath_to_temp_folder>>>>
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
We’ll previously write our commands here
Example:cdcdcdcd <<<<path_to_temp_folderpath_to_temp_folderpath_to_temp_folderpath_to_temp_folder>>>>sysusesysusesysusesysuse autoautoautoautohistogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)graph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replace
![Page 39: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/39.jpg)
Getting a response from Stata
Our web application will execute:
cdcdcdcd <<<<path_to_path_to_path_to_path_to_webwebwebweb_folder_folder_folder_folder>/>/>/>/imgimgimgimg////
<<<<path_to_Statapath_to_Statapath_to_Statapath_to_Stata>/>/>/>/Stata.exeStata.exeStata.exeStata.exe /q /e do “/q /e do “/q /e do “/q /e do “commands.docommands.docommands.docommands.do””””
We’ll previously write our commands here
Example:cdcdcdcd <<<<path_to_path_to_path_to_path_to_webwebwebweb_folder_folder_folder_folder>/>/>/>/imgimgimgimg////sysusesysusesysusesysuse autoautoautoautohistogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)histogram price, normal saving(graph01, replace)graph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replacegraph export graph01.png, replace
Now our web application will be able to display<<<<path_to_path_to_path_to_path_to_webwebwebweb_folder_folder_folder_folder>/img/>/img/>/img/>/img/graph01.pnggraph01.pnggraph01.pnggraph01.png
![Page 40: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/40.jpg)
Getting a response from Stata
call_stata.phpcall_stata.phpcall_stata.phpcall_stata.php
<?php<?php<?php<?php............
$stata_commands = $_POST[“stata_commands”];
write_stata_do_file($stata_commands);
execute_stata_do_file();
display_resultsdisplay_resultsdisplay_resultsdisplay_results(); //display graph01.(); //display graph01.(); //display graph01.(); //display graph01.pngpngpngpng
............?>?>?>?>
![Page 41: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/41.jpg)
Getting a response from Stata
call_stata.phpcall_stata.phpcall_stata.phpcall_stata.php
<?<?<?<?phpphpphpphp............
function display_results() {echo “<html>”;echo “ <head>Result</head>”;echo “ <body>”;
>”;echo “ <img src=img/graph01.pnggraph01.pnggraph01.pnggraph01.png>”;
echo “ </body>”;echo “</html>”;}............?>
![Page 42: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/42.jpg)
Getting a response from Stata
![Page 43: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/43.jpg)
Basic security
SQL injection attack:
'; DROP TABLE users;
![Page 44: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/44.jpg)
Basic security
Prevent “Stata injection” attacks:
--Limited, sanitized inputs,
Ideally, no free text fields on the web interface
--Avoid or restrict shell(), xshell(), winexec()--Avoid or restrict shell(), xshell(), winexec()
in your Stata program
![Page 45: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/45.jpg)
Basic security
Bad practice Better practice
![Page 46: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/46.jpg)
Basic security
Prevent “Stata injection” attacks:
--Limited, sanitized inputs,
Ideally, no free text fields on the web interface
--Avoid or restrict shell(), xshell(), winexec()--Avoid or restrict shell(), xshell(), winexec()
in your Stata program
![Page 47: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/47.jpg)
Basic security
Bad practice Better practice
![Page 48: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/48.jpg)
Basic security
It’s even better to avoid dynamic shell() commands
if Stata is executed
Bad practice Better practice
if Stata is executed through a web interface
![Page 49: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/49.jpg)
Implementation Implementation example
![Page 50: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/50.jpg)
Web interface for –nomolog–
A general-purpose nomogram generator for
predictive logistic regression modelspredictive logistic regression models
Zlotnik A, Abraira V. Stata Journal. 2015. Volume 15, Number 2
URL: http://www.zlotnik.net/stata/nomograms
![Page 51: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/51.jpg)
![Page 52: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/52.jpg)
![Page 53: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/53.jpg)
In the web implementation, we must add a tab for loading the
dataset and executing the logistic regression command.
![Page 54: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/54.jpg)
![Page 55: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/55.jpg)
Stata web services
Web servicePrivate
resources
XML
Your program
Stata / Mata
Externalprograms
XMLStata / Mata
![Page 56: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/56.jpg)
Stata web services
Web service
XML
Desktop
applications
Web
applications
XML
Mobile
applications
WSDLSOAP
native iOS appsnative Android apps
![Page 57: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/57.jpg)
Service-oriented architecture
Web service
XML
Enterprise
Service Bus
XML
Other
web services
WSDLSOAP
![Page 58: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/58.jpg)
Credits
![Page 59: Web + StatafmStata web services Web service XML Desktop applications Web applications Mobile applications WSDL SOAP native iOSapps native Android apps Service-oriented architecture](https://reader035.vdocument.in/reader035/viewer/2022062415/5fe7eee8330355741b6ac86e/html5/thumbnails/59.jpg)
Credits
Special thanks to all the people who made and released
these design resources for free:these design resources for free:
◎Presentation template by SlidesCarnival
◎Photographs by Unsplash & Death to the Stock Photo
(license)