I'm trying to come up with an application that provides:

1)Ability for a user on a desktop to communicate with a mainframe, without connecting the browser directly to the mainframe code.  I do not want to run a web server on the mainframe due to the security issues I will hit with that.  This has to be an 'outbound' connection from the mainframe.  The mainframe establishes the connection, does not listen for and accept a connection.

2)Ability for the mainframe to create and load databases within Basex. I tried establishing  a direct connection to a Basex server, but that requires my mainframe code to have a crypto service running that will create the MD5 hash value.  If that service isn't up, I can't get past the connection, and I can't require that the service be started.

3)Ability for a user to view the data in the database(s) as they are being updated to get the most current data.



My thought was to have the java comm server start, establish the RMI environment, and then when a command from the user came thru that interface, the java comm server would also start a new thread to connect to the Basex server and that thread would then create and load the database.

It would be a more simple and straight forward application if I could get the user's  browser to communicate directly with the java comm server, and I am trying to research how to do that now.

My biggest issue with doing all of this is that I'm not in my own element.  I'm having to teach myself java on the fly, as I go.

    -- Dave


On 10/27/2017 1:01 PM, Kendall Shaw wrote:
Hi,

Do you need to be doing remote procedure calls? In the abstract possibly 
anything you would want RPC for could be done in java on the communications 
server and basex would be interacted with using it’s APIs.

I have been giving what I think are answers to abstract questions. It might be 
a good idea to ask more high-level questions that allow people to offer 
possible solutions using XQuery XML, XML databases, web applications, etc. 
Describing what you want a solution for that you think would require an XML 
database, might be useful.

Kendall

On 10/27/17, 8:57 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of Dave 
Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david....@duke-software.com> wrote:

     Kendall,
No, not wanting to use RMI to call functions in Basex, but to
     handle communications between  a user on a browser, and my java comm
     server that is talking to my code on the z/OS box.
Something like this: Java comm server starts up, and listens for a connection. Connection established, and a new thread is started. New thread checks to see if Basex is started, and starts one if not. Thread establishes an RMI server. When Basex starts, it starts my RMI client code. Would have to run
     on a separate thread within Basex. (Haven't figured out how to do this
     one yet)
User, on a browser, while connected to the Basex server, needs to
     communicate with the mainframe code. Basex passes the request to the RMI
     client, then waits for the response from the RMI client.(Ditto on this
     one too...need to figure out if this is possible).
RMI client sends request to RMI server thread in my comm server. RMI server thread pushes request across connection to mainframe.
     Waits for response.
Response come in, RMI server thread pushes response to RMI client
     running in Basex.
RMI client pushes response to Basex that then responds to the browser. User views the response. On 10/27/2017 10:34 AM, Kendall Shaw wrote:
     > HI,
     >
     > I would think so. But, if you mean using RMI to call functions in BaseX, 
it’s probably a better idea to run basex on both and use the BaseX client API or 
REST.
     >
     > Kendall
     >
     > On 10/27/17, 8:13 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of Dave 
Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david....@duke-software.com> wrote:
     >
     >      Kendall,
     >
     >           I've now got a java server running that can accept a connection
     >      from my mainframe code.
     >
     >           In the scenario you have below, would it be possible to have 
the
     >      imported module use RMI to communicate with the java communication 
server?
     >
     >           Regards,
     >
     >           -- Dave
     >
     >
     >
     >      On 10/19/2017 8:48 PM, Kendall Shaw wrote:
     >      > Yes. The section in the documentation about RESTXQ shows how 
XQuery can be used to handle HTTP requests. The part about REST shows a way to 
execute queries (programs) and commands over HTTP. BaseX comes with a servlet that 
can run in a web server. The servlet is a java class that is executed by the java vm 
that is running the web server. The servlet also runs the native basex server. BaseX 
also includes a web server that can be used instead of a web server outside of BaseX.
     >      >
     >      > The section in the documentation about Java bindings shows how 
you can create modules that implement XQuery functions in java (or whatever JVM 
language). In xquery like:
     >      >
     >      > Import module namespace d = “ http: //duke-software.com/xml “;
     >      >
     >      > d:compute()
     >      >
     >      > The function d:compute() could be implemented in java so you are 
executing java by invoking the function.
     >      >
     >      > The XQuery that implements a web application could use the module 
that includes the java functions that interact with the mainframe to communicate with 
a service listening in the mainframe. That is driven by the web application.
     >      >
     >      > To  cause basex to handle communication from the second task, you 
could use threads but instead of what I said in the last post, it might be better to 
have the program that interacts with the mainframe run as  a separate OS service that 
handles data coming from the mainframe and data coming from basex.
     >      >
     >      > The user’s browser calls the web service that runs within basex 
(directly or from another web application). That web service includes calls to xquery 
functions that directly communicate with the mainframe over sockets or the separate 
OS service.
     >      >
     >      > The second task could communicate with the OS service that 
executes XQuery in basex and receives data from BaseX which it send to the mainframe.
     >      >
     >      > If you implement xquery functions in java you probably would need 
to look at the examples in the basex source in the basex-examples directory.
     >      >
     >      > Kendall
     >      >
     >      > On 10/19/17, 2:24 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david....@duke-software.com> wrote:
     >      >
     >      >      It is your last sentence that I don't understand, due to my 
lack of
     >      >      knowledge of most all things Basex.
     >      >
     >      >      The Java code that does the communication would be a 
function that is
     >      >      called from within a running Basex server?
     >      >
     >      >           -- Dave
     >      >
     >      >
     >      >      On 10/19/2017 4:12 PM, Kendall Shaw wrote:
     >      >      > If the desktop code can be java, then it could be like:
     >      >      >
     >      >      > A web application running in basex serves the web page 
that is UI for the user.
     >      >      >
     >      >      > That web application uses the module that you wrote in 
java to connect and send and receive data with the mainframe for your 2 tasks. The 
module is used in the web application as xquery functions.
     >      >      >
     >      >      > Kendall
     >      >      >
     >      >      > On 10/19/17, 1:57 PM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david....@duke-software.com> wrote:
     >      >      >
     >      >      >      I googled websockets, and sure enough, the RFC talks 
about the HTTP
     >      >      >      protocol.  I'm not going to try to code that.
     >      >      >
     >      >      >      I've been in this business long enough to know there 
are always multiple
     >      >      >      ways to get something done.  I've got a lot of time 
invested in code
     >      >      >      that creates both schema and xml for my data, and 
really don't want to
     >      >      >      throw that time and effort away.
     >      >      >
     >      >      >      Your suggestion earlier of having a piece of code 
running on a desktop
     >      >      >      external to Basex to provide the communication link 
probably would work,
     >      >      >      but it is starting to look kind of like a kluge now, 
I think.
     >      >      >
     >      >      >      The scenario.
     >      >      >
     >      >      >           Desktop code accepts the connection from the 
mainframe, and
     >      >      >      connects to the Basex server.
     >      >      >
     >      >      >           Would have to do a poll of Basex to determine if 
a new request had
     >      >      >      been added to a request database.
     >      >      >
     >      >      >           User, at a browser, would add a request to the 
database, and then
     >      >      >      wait for the response.
     >      >      >
     >      >      >           Code doing the poll would get the request and 
stuff it down the
     >      >      >      pipe to the mainframe, then go back to its poll.  
Needs to be able to
     >      >      >      recognize when data comes in on the connection as 
well.
     >      >      >
     >      >      >           Response comes in, and the Basex request 
database is updated.
     >      >      >
     >      >      >           Basex server sends the response to the browser.
     >      >      >
     >      >      >      Would this work?
     >      >      >
     >      >      >
     >      >      >      On 10/19/2017 3:08 PM, Kendall Shaw wrote:
     >      >      >      > It does: HTTP.
     >      >      >      >
     >      >      >      > On 10/19/17, 12:42 PM, 
"basex-talk-boun...@mailman.uni-konstanz.de on behalf of Dave Day" 
<basex-talk-boun...@mailman.uni-konstanz.de on behalf of david....@duke-software.com> wrote:
     >      >      >      >
     >      >      >      >      Unless websockets has some protocol sitting on 
top of standard TCP/IP
     >      >      >      >      communication, there shouldn't be an issue.
     >      >      >      >
     >      >      >      >
     >      >      >      >
     >      >      >      >      On 10/19/2017 2:29 PM, Kendall Shaw wrote:
     >      >      >      >      >   On 10/19/17, 10:54 AM, "Christian Grün" 
<christian.gr...@gmail.com> wrote:
     >      >      >      >      >
     >      >      >      >      >      @Kendall:
     >      >      >      >      >
     >      >      >      >      >      > If I understood, it was connecting 
from mainframe to the BaseX server over a socket that was wanted (I assume that means TCP). I 
think that websockets don’t connect to TCP sockets, without HTTP on both sides to establish the 
connection. So, if using HTTP would require implementing  HTTP (or parts of it) in assembly 
language, that is not trivial, possibly.
     >      >      >      >      >
     >      >      >      >      >      Yes, exactly.
     >      >      >      >      >
     >      >      >      >      >
     >      >      >      >      >      @Marco:
     >      >      >      >      >
     >      >      >      >      >      > not only browser clients but all 
other application (written in Java, nodeJS, Python ...) supporting websocket client libraries I 
suppose! ;-)
     >      >      >      >      >
     >      >      >      >      >      Quite definitely! I’ll knock at your 
door once the first beta versions
     >      >      >      >      >      will be around. If you believe you can 
give some helpful input on the
     >      >      >      >      >      feature design in the GitHub issue, 
your feedback will be welcome.
     >      >      >      >      >
     >      >      >      >      > Great, in general. But, if one side is on 
the mainframe unless there is a websocket library there the problem would be the same.
     >      >      >      >      >
     >      >      >      >      > Kendall
     >      >      >      >      >
     >      >      >      >      >      > On 10/19/17, 10:15 AM, 
"basex-talk-boun...@mailman.uni-konstanz.de on behalf of Marco Lettere" 
<basex-talk-boun...@mailman.uni-konstanz.de on behalf of m.lett...@gmail.com> wrote:
     >      >      >      >      >      >
     >      >      >      >      >      >     Hi,
     >      >      >      >      >      >     not only browser clients but all 
other application (written in Java,
     >      >      >      >      >      >     nodeJS, Python ...) supporting 
websocket client libraries I suppose! ;-)
     >      >      >      >      >      >     Waiting eagerly for it ...
     >      >      >      >      >      >     M.
     >      >      >      >      >      >
     >      >      >      >      >      >     On 19/10/2017 19:08, Christian 
Grün wrote:
     >      >      >      >      >      >     > Hi Dave,
     >      >      >      >      >      >     >
     >      >      >      >      >      >     > Kendall has already given you 
all relevant information (thanks!).
     >      >      >      >      >      >     >
     >      >      >      >      >      >     > Very early client bindings of 
BaseX provided support for bidirectional
     >      >      >      >      >      >     > connections. As the 
functionality was rarely used, and as only a few
     >      >      >      >      >      >     > bindings supported this part of 
the protocol, it was eventually
     >      >      >      >      >      >     > dropped. If you scan the 
history of our Wiki and the Github sources,
     >      >      >      >      >      >     > you will probably stumble upon 
the code snippets.
     >      >      >      >      >      >     >
     >      >      >      >      >      >     > The major reason is that most 
of today’s applications that are
     >      >      >      >      >      >     > interactive and are built on 
top of BaseX rely on HTTP. As soon as
     >      >      >      >      >      >     > WebSockets will be available 
[1], it will be possible to send data to
     >      >      >      >      >      >     > browser clients.
     >      >      >      >      >      >     >
     >      >      >      >      >      >     > Hope this helps,
     >      >      >      >      >      >     > Christian
     >      >      >      >      >      >     >
     >      >      >      >      >      >     > [1] 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1449&d=DwIDaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM&s=EE2LEkklhkn_5oQHObR67dH0aMbWgLwEP9Zcx5JHmYM&e=
     >      >      >      >      >      >     >
     >      >      >      >      >      >     >
     >      >      >      >      >      >     >
     >      >      >      >      >      >     > On Thu, Oct 19, 2017 at 7:01 PM, Dave 
Day <david....@duke-software.com> wrote:
     >      >      >      >      >      >     >> Hi Kendall,
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >>      Thanks for the response.
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >>      Seems to me there ought 
to be some way to get a Basex server to write  a
     >      >      >      >      >      >     >> data stream to a socket other 
than as the result of running a query or a
     >      >      >      >      >      >     >> command.
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >>      Maybe someone from the 
Basex developers group  will chime in here.
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >>      -- Dave
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >>
     >      >      >      >      >      >     >> On 10/18/2017 7:56 PM, Kendall 
Shaw wrote:
     >      >      >      >      >      >     >>> Someone can probably give a 
better answer. As far as I know there are no
     >      >      >      >      >      >     >>> xquery socket io functions 
provided with basex. You can write java to do
     >      >      >      >      >      >     >>> that or you can use an 
external process that communicates with the mainframe
     >      >      >      >      >      >     >>> and invoke that process from 
xquery, among other solutions. If you write
     >      >      >      >      >      >     >>> java you could look at the 
basex source to imitate how it uses sockets
     >      >      >      >      >      >     >>> and/or read about socket io 
in java. With that you could poll or send and
     >      >      >      >      >      >     >>> receive data to from the 
mainframe.
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> To know if the mainframe 
connection is connected, I think you can use the
     >      >      >      >      >      >     >>> admin:sessions() function to 
see if it is connected or your program that
     >      >      >      >      >      >     >>> does the io could indicate 
that it is not connected if it can’t communicate.
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> If you use xquery and RESTXQ 
to write the web application, and the same
     >      >      >      >      >      >     >>> basex instance is 
communicating with the mainframe then the xquery in your
     >      >      >      >      >      >     >>> application is already 
running in the basex server.
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> For the second task it’s the 
same idea. You will need to read about how
     >      >      >      >      >      >     >>> updating works:
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>>    
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_XQuery-5FUpdate&d=DwIDaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM&s=_pSKI0JdH9q6EQwFZt5180gq24TDNk9RHCCCU9529v4&e=
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> Or, reading this would tell 
you a lot:
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Table-5Fof-5FContents&d=DwIDaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM&s=d1UB9tyc9LKqvqvzoP9KPWE9x9Q2Va9Ge5qSYrTsEvA&e=
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> Kendall
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>> On 10/18/17, 3:22 PM, 
"basex-talk-boun...@mailman.uni-konstanz.de on
     >      >      >      >      >      >     >>> behalf of Dave Day" 
<basex-talk-boun...@mailman.uni-konstanz.de on behalf of
     >      >      >      >      >      >     >>> david....@duke-software.com> 
wrote:
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>>       Greetings list,
     >      >      >      >      >      >     >>>                 I have an 
idea of how I want to use Basex, and would like
     >      >      >      >      >      >     >>> to know
     >      >      >      >      >      >     >>>       if what I am wanting to 
do will work.
     >      >      >      >      >      >     >>>                 My background 
is IBM mainframe, so the terminology I use is
     >      >      >      >      >      >     >>>       influenced by that.
     >      >      >      >      >      >     >>>                 I have a 
server running in an address space on a mainframe.
     >      >      >      >      >      >     >>> Within
     >      >      >      >      >      >     >>>       that address space are 
multiple tasks active.  I believe the term
     >      >      >      >      >      >     >>> task
     >      >      >      >      >      >     >>>       is equivalent to a 
thread in the distributed world.
     >      >      >      >      >      >     >>>                 I would like 
to have a task initialize when my server comes
     >      >      >      >      >      >     >>> up and
     >      >      >      >      >      >     >>>       establish a connection 
to an instance of a Basex server. This task
     >      >      >      >      >      >     >>> would
     >      >      >      >      >      >     >>>       be responsible for 
processing requests that come in from the Basex
     >      >      >      >      >      >     >>> server.
     >      >      >      >      >      >     >>>                 On a browser, 
I want to have a user connect to an instance
     >      >      >      >      >      >     >>> of the
     >      >      >      >      >      >     >>>       Basex HTTP server.  
From the manual, it states that if the HTTP
     >      >      >      >      >      >     >>> server
     >      >      >      >      >      >     >>>       is started, the client 
server is started as well.  I don't know if
     >      >      >      >      >      >     >>> this
     >      >      >      >      >      >     >>>       is all one instance of 
a Basex, or if there are actually two
     >      >      >      >      >      >     >>> processes
     >      >      >      >      >      >     >>>       that get established.   
The HTTP server will need to know if the
     >      >      >      >      >      >     >>>       connection has been 
established between the mainframe and the client
     >      >      >      >      >      >     >>>       server.  Is this 
possible, and if so, how would that be accomplished?
     >      >      >      >      >      >     >>>                 Assuming that 
the user on the browser needs some
     >      >      >      >      >      >     >>> information from
     >      >      >      >      >      >     >>>       my mainframe server, is 
there a mechanism in place to facilitate the
     >      >      >      >      >      >     >>>       HTTP server sending the 
request to the client server, and the client
     >      >      >      >      >      >     >>>       server sending the 
request to the mainframe.  Would the mainframe
     >      >      >      >      >      >     >>> have
     >      >      >      >      >      >     >>>       to do a poll of some 
kind to see if there was data, or can the client
     >      >      >      >      >      >     >>>       server push the request 
out across the connection?
     >      >      >      >      >      >     >>>                 If the above 
works, that is, Basex acting as a message
     >      >      >      >      >      >     >>> broker
     >      >      >      >      >      >     >>>       between a browser and 
the mainframe, I want to be able to create
     >      >      >      >      >      >     >>> another
     >      >      >      >      >      >     >>>       connection from another 
task on the mainframe to the Basex client
     >      >      >      >      >      >     >>> server
     >      >      >      >      >      >     >>>       as a result of a user 
request on a browser, have that 2nd task create
     >      >      >      >      >      >     >>> a
     >      >      >      >      >      >     >>>       new database, and start 
pushing xml across that 2nd connection.
     >      >      >      >      >      >     >>> While
     >      >      >      >      >      >     >>>       that new database is 
being updated from the mainframe, can the user
     >      >      >      >      >      >     >>> on
     >      >      >      >      >      >     >>>       the browser query the 
new database to get the most current data?
     >      >      >      >      >      >     >>>                 Regards,
     >      >      >      >      >      >     >>>                 -- Dave Day
     >      >      >      >      >      >     >>>
     >      >      >      >      >      >     >>
     >      >      >      >      >      >
     >      >      >      >      >      >
     >      >      >      >      >      >
     >      >      >      >      >
     >      >      >      >      >
     >      >      >      >
     >      >      >      >
     >      >      >      >
     >      >      >
     >      >      >
     >      >      >
     >      >
     >      >
     >      >
     >
     >
     >

Reply via email to