From: Ina C. <in...@st...> - 2001-02-06 01:05:46
|
Here is a modified version of the design. Ina ==================================================================== Interface between the client and server side: One of the modules will provide an interface for programmers to send messages to the SOAP server. It will provide as basic functionality the ability to do RPC over SOAP. The hard-coded XML encoding for Mercury datatypes (the same encoding as the SOAP server currently expects) will be used to encode the RPC calls. In addition, an interface will be provided that allows an arbitrary XML message to be passed using SOAP (and the response will be returned as XML too). This will allow programmers to use their own encodings and communicate with any SOAP based service. Eg: :- module client_interface. This function takes in an uri (which specifies the host and port number that the client is connected to), method name (which specifies which RPC to call), and a list of univ (which are the parameters to the RPC). soap_call_mercury_type(uri, method_name, list_of_univ) :- generate SOAP message in XML format and SOAP protocol, tcp__connect to the server, send the request to the server using HTTP, wait for the response, read response in XML format, decode the response to mercury types. Assumptions: When generating SOAP messages for the parameters (list_of_univ), we assume the client will have a copy of the schema that is used in the server side for encoding and decoding types in XML. soap_call_xml_type(uri, method_name, xml_document) :- tcp__connect to the server, send the xml_document to the server using HTTP wait for response, display response. Another module will be a sample consisting the main function, demonstrating how to call the interface to send messages to the SOAP server. It will handle any command line arguments, then call the interface and display the response. Eg. :- module client_demo :- import client_interface. main --> handle command line arguments ( command line arguments = mercury_types -> translate list_of_arguments to list_of_univ, Result = soap_call_mercury_type(uri, method_name, list_of_univ) ; command line arguments = xml_document -> Result = soap_call_xml_type(uri, method_name, xml_document) ; error("input arguments not supported") ), write(Result). |