Publishing Web-Services
Web service is a HTTP based communication technology for computers on network.
In enterprise system web-service is used to implement EDI(Web-EDI) and
also to integrate smart devices. You can publish Script-Launcher programs
as original web-services.
Using Web-Services
You can communicate with existing web-services by using methods of Session Object in scripts. As shown below, X-TEA Driver can send http-requests to web-service
controler of A-Company to get http-responses. Then X-TEA Driver will parse
responses to operate your database.

Publishing Web-Services
You can provide your own web-services to your partners, namely you implement
X-TEA Server in your Tomcat to publish Script Launcher programs as web-services.
As shown below, X-TEA Server recieves http-requests from B-Company System
and launch a program(type of XF000) coded in the requests. And X-TEA Server
will incorporate processing results of the program into responses and send
them back.

Let's see detail process of launching programs accoding to http request.
When X-TEA Server receives an http request it will generate a session for
the request. And it will scan the parameter with keyword 'function' to
call the equevalent function of Script Launcher in system definition(shown
as Spec in fig.). When the function terminated, the session will incorporate
the result into an http response with keyword 'result' and terminate itself.
Web-EDI is not an only purpose of web-services but they will help enterprise
systems to integrate smart devices. X-TEA Server can communicate with those
smart devices by means of http request/response. Consequently applications
on smart devices do not have to have complicated codes to operate tables
in the system as functions of Script Launcher do most they need to do.
Procesures to set X-TEA Server as Web-Service Controler
(1)Programming a function for Web-Service
At first, you need to program a function of Script Launcher for web-service.
Refer to a coding sample in Script Launcher. It differs from normal functions as follow.
- You can not use dialogs nor call form/print functions.
- You can scan parameters in http requests by reading instance.parmMap.
- Y ou can send result of processing back to http responses by setting values to instance.returnMap with keyword of 'RESULT'.
(2)Setting Servlet Container(Tomcat)
Install Tomcat and write web.xml as follows to run X-TEA Server on the
container. Rewrite "C:\XXXXX\YYYYY.xeaf" according to your environment.
If you do not want to fix user, omit tags of User and Password(Then you
need to put those parameters in http request with keyword of USER and PASSWORD).
Value of "xeadServer.Service" with tag <servlet-class>
is the name of web-service controler class of X-TEA Server.
<?xml version="1.0" encoding="Windows-31J"?>
<web-app>
<servlet>
<servlet-name>Service</servlet-name>
<servlet-class>xeadServer.Service</servlet-class>
<init-param>
<param-name>SystemDefinition</param-name>
<param-value>C:\XXXXX\YYYYY.xeaf</param-value>
</init-param>
<init-param>
<param-name>User</param-name>
<param-value>00000</param-value>
</init-param>
<init-param>
<param-name>Password</param-name>
<param-value>0000000000</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Service</servlet-name>
<url-pattern>/Service</url-pattern>
</servlet-mapping>
</web-app>
Put web.xml and JAR files(they are in the install folder of X-TEA Driver)
on Tomcat folders as follow.
../webapps (Tomcat Servlet Folder)
/xteaServer (Project Folder for X-TEA Server)
/WEB-INF (web.xml placed here)
/lib (JAR files placed here)
(3)Launching system
Launch Tomcat and type URL as http://localhost:8080/xteaServer/Service
in your browser(put IP address if server is not local in stead of localhost).
If things are alright, it will show page as follows. Then you POST http
requests into the URL via your applications to see how things work. You
need to put the parameter of function ID with keyword of 'FUNCTION' in
http request to be posted.

Security Warning
If web-service works in opened network, encode message by any means or use VPN.
|