From: Ina C. <in...@st...> - 2001-01-19 00:50:39
|
On Thu, 18 Jan 2001, Peter Ross wrote: > On Thu, Jan 18, 2001 at 05:13:24PM +1100, Ina Cheng wrote: > > > > ======================================================================== > > > > Estimated hours taken: 120 (after new year) > > > > webserver/server/web.m > > a new module handling remote procedure calls using SOAP protocol > > and generating corresponding respones > > > > webserver/server/foo.m > > a new module containing definitions of methods supported > > in the SOAP protocol > > > soap-methods.m sounds like a reasonable name to me. In C programming, they have global variables that I can define the name of the file in one place and refer to it later on. Since I need to call this file in each method, I was wondering does Mercury has something like global variable too? > > %---------------------------------------------------------------------------% > > > > :- module web. > > :- interface. > > :- import_module io, list, string, std_util. > > :- import_module http. > > :- import_module xml, xml:ns. > > > > > > :- type web_method_request > > ---> web_method_request( > > name :: string, % method name > > params :: list(parameter), % list of parameters > > uri :: nsURI % namespace (method) > > ). > > > > :- type parameter > > ---> parameter( > > pName :: string, % parameter name > > pType :: maybe(string), % type if any > > pValue :: string, % data > > pURI :: nsURI % namespace (param) > > ). > > > Why are these types in the interface? Are they used in other modules? Although they are not used in other modules, the predicates below use them. > > > % Converts method name and parameters in xml.ns format to > > % a web request. > > :- pred make_web_request(nsElement, list(nsContent), web_method_request). > > :- mode make_web_request(in, in, out) is det. > > > > % Loads library, invokes method call and generates corresponding > > % response. > > :- pred load_dynamic_library(string::in, web_method_request::in, > > maybe(string)::out, http_code::out, io__state::di, io__state::uo) > > is det. > > > > %---------------------------------------------------------------------------% > > > > :- implementation. > > :- import_module bool, int, require. > > :- import_module dl, name_mangle, foo. > > > > > > % FYI : regard to make_web_request(Proc, Params, Request) > > % > > % Eg. > > % <m:GetStockPrice xmlns:m="some uri"> > > % <stocknum xsi:type="xsd:int">1</stocksum> > > % <date>30</date> > > % </m:GetStockPrice> > > % > > % Proc will be: > > % nsElement(qName("GetStockPrice", "some uri"), > > % [nsAttribute(qName("m", "some uri"), "some uri")], > > % [2, 4, 5, 7, 8], > > % ["m" - "some uri"]) > > % > Where does this proc type come from? Proc comes from another module (soap.m - which I haven't included in the mail) which takes in the whole XML message and retrieve the method only. Ina |