Title: Querying a Relational Database of SPASE Metadata
1Querying a Relational Database of SPASE Metadata
Cory NatheAugsburg College
2What is it for?
- Implement a site to insert SPASE records into a
database. - Implement a SPASE based interface for a client to
query the database. - The client is located on the space.augsburg.edu
server while the database is on the
xspace.augsburg.edu server.
3How does it work?
- Two servers communicate using SOAP to exchange
XML-based messages. - Simple Object Access Protocol (SOAP) is a
protocol for exchanging XML-based messages over
computer networks, using HTTP.
4Query process Step 1
At the client side, the query information is
entered into an HTML form.
5Query process Step 2
SOAP Message
PHP
Upon submission, a related PHP program is called.
This PHP program takes the necessary form
information and enters it as function parameters
into the body of a SOAP message.
6Query process Step 3
XML
Client
Server
The SOAP/XML message is then passed to the
server machine.
7Query process Step 4
SOAP Message
PHP
Database
The server then takes the parameters from the
message and performs the function call through
another PHP program. This, in turn, queries the
necessary SPASE database tables and fields.
8Query process Step 5
XML
Client
Server
Upon completion of the query, the server machine
returns the results to the client as an array of
database field information in an XML message
using SOAP.
9Query process Step 6
SOAP Message
PHP
HTML Page
The resulting array is then processed to create a
table of information with IDs, links, and
resource names.
10Demonstration
- http//xspace.augsburg.edu/skar/spaseTest.html
- http//space.augsburg.edu/nathe/spase/query.html
11Example SOAP message
ltsoapEnvelope xmlnssoap"http//schemas.xmlsoap
.org/soap/envelope/"gt ltsoapBodygt
ltgetProductDetails xmlns"http//warehouse.example
.com/ws"gt ltproductIDgt827635lt/productIDgt
lt/getProductDetailsgt lt/soapBodygt
lt/soapEnvelopegt
Client Request
ltsoapEnvelope xmlnssoap"http//schemas.xmlsoap
.org/soap/envelope/"gt ltsoapBodygt
ltgetProductDetailsResponse xmlns"http//warehouse
.example.com/ws"gt ltgetProductDetailsResultgt
ltproductNamegtToptimate 3-Piece
Setlt/productNamegt ltproductIDgt827635lt/prod
uctIDgt ltdescriptiongt3-Piece luggage set.
Black Polyester.lt/descriptiongt ltprice
currency"NIS"gt96.50lt/pricegt
ltinStockgttruelt/inStockgt lt/getProductDetails
Resultgt lt/getProductDetailsResponsegt
lt/soapBodygt lt/soapEnvelopegt
Server Response
12Client PHP program
namespace "http//xspace.augsburg.edu/nathe/so
apServer" xmlDir"http//xspace.augsburg.edu/sk
ar/xml/" require_once('SOAP/Client.php') info
new SOAP_client("http//xspace.augsburg.edu/nat
he/soapServer/databaseserver.php") print
"lthtmlgtltheadgtlttitlegtSPASE Query
Resultslt/titlegtlt/headgt" print "ltbody
bgcolor'lightblue'gt" print "lthrgt" if(resType!
"") params array("resType"gtresType,"resid
Find"gtresidFind,"format"gtformat,
"startDate"gtstartDate,"s
topDate"gtstopDate,"releaseOp"gtreleaseOp,
"releaseDate"gtreleaseDate
) response info-gtcall("FindResources",param
s,namespace) if(response-gtmessage) echo
"ERROR message " . response-gtmessage
13Server PHP program
lt? class database var link function
database() linkmysql_connect("localhost/
tmp/mysql.sock", "skar", "qazwsx")
mysql_select_db("Spase",link) f
unction FindResources(resType,residFind,format,
startDate,
stopDate,releaseOp,releaseDa
te) test"RESOURCEID like
'".residFind."'"