Update of /cvsroot/aimmath/AIM/WEB-INF/maple
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5897/maple
Added Files:
Tag: aim-xml
RPC.mpl RQP.mpl rqp.wsdl
Log Message:
--- NEW FILE: RPC.mpl ---
# Copyright (C) 2004 Neil Strickland
# Distributed without warranty under the GPL - see README for details
read("Package.mpl"):
Package("RPC","
This package defines a number of convenient methods for working
with SOAP remote procedure calls.
"):
######################################################################
`Class/Declare`(
`RPC/Operation`,
"An instance of this class encapsulates information about a SOAP
RPC operation.
",
['Field','Documentation'::string,
"A human-readable description of the operation."
],
['Field','LocalName'::string,
"The name of the operation (eg @RQP_ServerInformation@)."
],
['Field','NamespaceName'::string,
"The namespace for the operation name (eg
@http://aim.shef.ac.uk/AiMInfo@)."
],
['Field','Prefix'::string,
"The prefix to be attached to the namespace name (eg @rqp@)"
],
['Field','InputMessageName'::string,
"The name of the input message for this operation. In general
it defaults to the local name of the operation. However, in
the Remote Question Protocol, the convention is that operation
names start with @RQP_@, and this is stripped off to give the
name of the input message.
"
],
['Field','Inputs'::list(`RPC/Parameter`),
"This field contains a list of the input parameters for the
operation, as objects of the class #`RPC/Parameter`#.
"
],
['Field','OutputMessageName'::string,
"The name of the input message for this operation. In general
it defaults to the local name of the operation, followed by
@Response@. However, in the Remote Question Protocol, the
convention is that operation names start with @RQP_@, and this
is stripped off before generating the output message name.
"
],
['Field','Outputs'::list(`RPC/Parameter`),
"This field contains a list of the output parameters for the
operation, as objects of the class #`RPC/Parameter`#."
],
['Field','PProc'::procedure,
"This field contains the procedure that actually does the work
of the RPC call. It should accept two arguments, say @inp@
and @out@. The @inp@ argument should be a table, whose
indices are the input parameter names as specified in the
@Inputs@ field. The @out@ argment should also be a table,
whose indices are the output parameter names as specified in
the @Outputs@ field. The processing procedure may assume
that the @inp@ table has been filled with the appropriate
input parameters, that the types of these parameters have
been checked, and that default values have been inserted
where appropriate. It should fill in the @out@ table and
return @NULL@.
"
],
['Constructor',
"This constructor accepts arguments as follows.
<ul>
<li>The first two arguments are the Maple name of the
operation (which can be different from the contents
of the @LocalName@ field) and a documentation string.
</li>
<li>
An argument of the form @['Name',...]@ can be
used to specify the local name of the operation. This
also sets the @InputMessageName@ and @OutputMessageName@
fields if they have not already been set.
</li>
<li>
An argument of the form @['InputMessageName',...]@ can be
used to set the @InputMessageName@ field.
</li>
<li>
An argument of the form @['Input',...]@ can be used to
specify an input parameter. The second entry in the list
will be passed to #`RPC/ParseParameterSpecification`#,
so it must be of the form accepted by that function.
</li>
<li>
An argument of the form @['OutputMessageName',...]@ can be
used to set the @OuputMessageName@ field.
</li>
<li>
An argument of the form @['Output',...]@ can be used to
specify an output parameter. The second entry in the list
will be passed to #`RPC/ParseParameterSpecification`#,
so it must be of the form accepted by that function.
</li>
<li>
An argument of the form @['Process',...]@ can be used to
specify the processing procedure (ie the value of the
@PProc@ field).
</li>
</ul>
",
proc(this,nam::name,doc::string)
global `Package/SaveNames`;
local y,inp,out,namstring;
this['Documentation'] := doc;
inp := [];
out := [];
for y in args[4..-1] do
if not(type(y,list)) then
error(__("Invalid argument"));
fi;
if y[1] = 'Name' then
this['LocalName'] := y[2];
if this['InputMessageName'] = "" then
this['InputMessageName'] := y[2];
fi;
if this['OutputMessageName'] = "" then
this['OutputMessageName'] := cat(y[2],"Response");
fi;
elif y[1] = 'InputMessageName' then
this['InputMessageName'] := y[2];
elif y[1] = 'Input' then
inp := [op(inp),`RPC/ParseParameterSpecification`(y[2])];
elif y[1] = 'OutputMessageName' then
this['OutputMessageName'] := y[2];
elif y[1] = 'Output' then
out := [op(out),`RPC/ParseParameterSpecification`(y[2])];
elif y[1] = 'Process' then
namstring := cat(this['LocalName'],"!!Process");
assign(convert(namstring,name) = eval(y[2]));
this['PProc'] := eval(convert(namstring,name));
`Package/SaveNames` :=
[op(`Package/SaveNames`),namstring];
else
error(sprintf(__("Invalid argument: %A"),y));
fi;
od;
this['Inputs'] := inp;
this['Outputs'] := out;
NULL
end
],
['Method','Process'::`SOAP/Envelope`,
"The argument @b@ should be the XML element containing the
SOAP input message to be processed. Thus @b@ should be a
child of the @Body@ element of a SOAP @Envelope@ element,
the local name of @b@ should be the value of the
@InputMessageName@ field, and the local names of the
children of @b@ should be the names of the input parameters
listed in the @Inputs@ field. The method processes the
input message and returns a corresponding output message
packaged in a SOAP envelope.
",
proc(this,b::`XML/Element`,defaultnamespace_::string)
### TODO: Error handling
local inp,out,c,n,i,x,y,u,msg,env;
inp := table([]);
out := table([]);
c := b['NonWhiteChildren'];
n := nops(c);
i := 1;
for x in this['Inputs'] do
if i > n then
error(sprintf(__("Input parameter (%s) is missing"),x['Name']));
fi;
y := c[i];
if not(type(y,`XML/Element`) and
y['LocalName'] = x['LocalName'] and
(x['NamespaceName'] = NULL or
y['NamespaceName'] = x['NamespaceName'])) then
error(sprintf(__("Problem with parameter (%s)"),x['LocalName']));
fi;
inp[x['LocalName']] := `XML/ToMaple`(eval(x['Type']),eval(y));
i := i+1;
od;
for x in this['Outputs'] do
out[x['LocalName']] := x['DefaultValue'];
od;
eval(this['PProc'])(inp,out);
u := [];
for x in this['Outputs'] do
y :=
`XML/FromMaple`(
eval(x['Type']),
out[x['LocalName']],
x['LocalName'],
true);
u := [op(u),eval(y)];
od;
### The use of 'rqp' here is an ugly hack
if nargs > 2 then
msg :=
`new/XML/Element`(
[cat("rqp:",this['LocalName'],"Response"),
"xmlns:rqp" = defaultnamespace_],
op(u)
);
else
msg :=
`new/XML/Element`(
cat(this['LocalName'],"Response"),
op(u)
);
fi;
env := `new/SOAP/Envelope`();
env['AddBody',eval(msg)];
eval(env);
end
]
):
######################################################################
`Class/Declare`(
`RPC/Parameter`,
"An instance of this class represents an input or output parameter
for a SOAP RPC operation.
",
['Field','Prefix'::string,
"The prefix to be used for the XML namespace for this parameter."
],
['Field','LocalName'::string,
"The XML local name for this parameter"
],
['Field','NamespaceName'::string,
"The XML namespace name for this parameter"
],
['Field','Type'::`XML/Type`,
"The type of the parameter"
],
['Field','DefaultValue',
"The default value for the parameter"
]
):
######################################################################
`Package/Assign`(
`type/RPC/ParameterSpecification`::boolean,
"Return @true@ if @x@ is a valid argument for the function
#`RPC/GetParameter`#. In more detail, @x@ should be of the
form @n@ or @n::t@ or @n=d@ or @n::t=d@, where
<ul>
<li>@n@ is a string (the XML name of the parameter, which
may or may not include a namespace prefix).
</li>
<li>@t@ is an instance of #`XML/Type`#, specifying the
type of the parameter.
</li>
<li>@d@ is a default value for the parameter (given as a
Maple expression, not as an XML element).
</li>
</ul>
If @t@ and @d@ are both given, then they must be compatible
(or this procedure will return @false@).
",
proc(x::anything)
local y,default,typespec,t;
y := `Util/SplitDeclaration`(x);
if not(type(y[1],[string])) or nops(y[2]) <> 1 then
return(false);
fi;
typespec := op(y[2]);
default := op(y[3]);
if not(type(typespec,`XML/Type`)) then
return(false);
fi;
if default = NULL then
return(true);
fi;
return(type(default,typespec['MapleDefinition']));
end
):
`Package/Assign`(
`RPC/ParseParameterSpecification`::`RPC/Parameter`,
"This converts an expression of type
#`type/RPC/ParameterSpecification`#, and converts it to
an instance of #`RPC/Parameter`#.
",
proc(x::anything)
local y,z,default,typespec,t,p;
p := `new/RPC/Parameter`();
y := `Util/SplitDeclaration`(x);
if not(type(y[1],[string])) or
nops(y[2]) <> 1 then
error(sprintf(__("Invalid argument: %A"),y));
fi;
z := `XML/SplitName`(op(y[1]));
p['Prefix'] := z[1];
p['LocalName'] := z[2];
typespec := op(y[2]);
default := op(y[3]);
p['Type'] := op(y[2]);
p['DefaultValue'] := op(y[3]);
return(eval(p));
end
):
######################################################################
`Class/Declare`(
`RPC/Service`,
"An instance of ths class represents a SOAP RPC service.",
['Constructor',
"The two optional arguments to this constructor specify the
values of the @CommandNamespace@ and @DefaultNamespace@
fields.
",
proc(this,cnamespace_::string,dnamespace_::string)
this['Operations'] := table([]);
if nargs > 1 then
this['CommandNamespace'] := cnamespace_;
fi;
if nargs > 2 then
this['DefaultNamespace'] := dnamespace_;
fi;
end
],
['Field','Operations'::table,
"This field holds a table of #`RPC/Operation`# objects,
indexed by their XML local names.
"
],
['Field','CommandNamespace'::string,
"This field holds the default value of the @NamespaceName@
field for operations in this service.
"
],
['Field','DefaultNamespace'::string,
"<b>Clarify the use of this field</b>"
],
['Method','AddOperation',
"Add an operation to this service. The method arguments
are passed to the constructor #`new/RPC/Operation`# to
produce the operation to be added.
",
proc(this)
local x;
x := `new/RPC/Operation`(args[2..-1]);
x['NamespaceName'] := this['CommandNamespace'];
this['Operations'][x['LocalName']] := eval(x);
end
],
['Method','Process',
"The argument of this method should be the string representation
of a SOAP envelope containing an RPC call. The method parses
this string representation, extracts the operation name and
input message, and sends the input message to the @Process@
method of the appropriate @`RPC/Operation`@ instance taken
from the @Operations@ field of this service. It is assumed
that the input message is the first child of the @Body@ element
of the envelope. Any other elements should be multi-reference
definitions. The SOAP 1.1 specification does not insist that
these must go after the input message, but that seems to be a
<it>de facto</it> standard.
",
proc(this,rpccall::string)
local t,cc,c,p,d,ex,
faultcode,faultstring,faultdetail;
try
t := `new/SOAP/Envelope`(rpccall);
catch:
return(`SOAP/Fault`("Server","Could not parse RPC call"));
end try;
cc := eval(t['Body'])['NonWhiteChildren'];
# cc := select(c -> (c['LocalName'] = "Body"),cc);
if nops(cc) = 0 then
return(`SOAP/Fault`("Client","No RPC command"));
# elif nops(cc) > 1 then
# return(`SOAP/Fault`("Client","RPC body has more than one body"));
fi;
c := cc[1];
# if this['CommandNamespace'] <> "" and
# c['NamespaceName'] <> this['CommandNamespace'] then
# return(`SOAP/Fault`("Client","Bad command namespace"));
# fi;
p := eval(this['Operations'][c['LocalName']]);
if not(type(p,`RPC/Operation`)) then
p := eval(this['Operations']["DefaultOperation"]);
if not(type(p,`RPC/Operation`)) then
return(`SOAP/Fault`("Client","Operation not implemented"));
fi;
fi;
if this['DefaultNamespace'] = "" then
d := NULL;
else
d := this['DefaultNamespace'];
fi;
try
return(p['Process',eval(c),d]);
catch:
ex := [lastexception];
if nops(ex) > 1 and ex[2] = "SOAP Fault" then
faultcode := `if`(nops(ex)>2, ex[3], "Client");
faultstring := `if`(nops(ex)>3, ex[4], "Unknown error");
faultdetail := `if`(nops(ex)>4, ex[5], op([]));
return(
`SOAP/Fault`(faultcode,faultstring,faultdetail)
);
else
return(
`SOAP/Fault`(
"Server",
cat("Processing error: ",StringTools:-FormatMessage(lasterror))));
fi;
end try;
end
]
):
EndPackage():
--- NEW FILE: RQP.mpl ---
# Copyright (C) 2005 Neil Strickland
# Distributed without warranty under the GPL - see README for details
read("Package.mpl"):
Package("RQP","
This package defines classes corresponding to the complex types
used in the Remote Question Protocol (RQP).
"):
`Package/Assign`(
`RQP/ArrayOfstring`,
"The #`XML/Type`# for arrays of strings.",
`new/XML/Type`(
"rqp:ArrayOfstring",
"<xs:complexType name=\"ArrayOfstring\">
<xs:complexContent>
<xs:restriction base=\"soap-enc:Array\">
<xs:sequence>
<xs:element name=\"item\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"unbounded\" />
</xs:sequence>
<xs:attribute ref=\"soap-enc:arrayType\" wsdl:arrayType=\"xs:string[]\" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>",
list(string),
proc(a,h)
local t,hh;
t := sprintf("xs:string[%d]",nops(a));
if type([h],[string]) then
hh := [h,"soap-enc:ArrayType" = t];
else
hh := [op(h),"soap-enc:ArrayType" = t];
fi;
`new/XML/Element`(hh,op(map(s -> [["item","xsi:type" = "xs:string"],s],a)));
end,
proc(x)
local c;
c := map(`XML/ContentString`,x['NonWhiteChildren']);
if not(type(c,list(string))) then
error(__("Invalid contents in ArrayOfstring"));
fi;
return(c);
end,
"soap-enc:Array"
)
):
`Package/Assign`(
`RQP/ArrayOfanyURI`,
"The #`XML/Type`# for arrays of URIs.",
`new/XML/Type`(
"rqp:ArrayOfanyURI",
"<xs:complexType name=\"ArrayOfanyURI\">
<xs:complexContent>
<xs:restriction base=\"soap-enc:Array\">
<xs:sequence>
<xs:element name=\"item\" type=\"xs:anyURI\" minOccurs=\"0\" maxOccurs=\"unbounded\" />
</xs:sequence>
<xs:attribute ref=\"soap-enc:arrayType\" wsdl:arrayType=\"xs:anyURI[]\" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>",
list(string),
proc(a,h)
local t,hh;
t := sprintf("xs:anyURI[%d]",nops(a));
if type([h],[string]) then
hh := [h,"soap-enc:ArrayType" = t];
else
hh := [op(h),"soap-enc:ArrayType" = t];
fi;
`new/XML/Element`(hh,op(map(s -> [["item","xsi:type" = "xs:anyURI"],s],a)));
end,
proc(x)
local c;
c := map(`XML/ContentString`,x['NonWhiteChildren']);
if not(type(c,list(string))) then
error(__("Invalid contents in ArrayOfanyURI"));
fi;
return(c);
end,
"soap-enc:Array"
)
):
`Package/Assign`(
`RQP/error`,
"The #`XML/Type`# for errors in RQP. An error is represented
as a list of the form @[identifier,message,detail]@.
or @[identifier,message,detail,detailtype]@.
",
`new/XML/Type`(
"rqp:error",
"<xs:complexType name=\"error\">
<xs:sequence>
<xs:element name=\"identifier\" type=\"xs:anyURI\" />
<xs:element name=\"message\" type=\"xs:string\" />
<xs:element name=\"detail\" type=\"xs:anyType\" />
</xs:sequence>
</xs:complexType>",
{[string,string,anything],[string,string,anything,string]},
proc(a,h)
local t,d;
if nops(a) = 3 then
t := "xs:string";
d := sprintf("%A",a[3]);
else
t := a[4];
d := a[3];
fi;
`new/XML/Element`(
h,
["identifier",a[1]],
["message",a[2]],
[["detail", "xsi:type" = t],d]
);
end,
proc(x)
local c,d,dc,id,msg,detail;
c := x['NonWhiteChildren'];
if nops(c) <> 3 then
error(__("Invalid RQP error structure"));
fi;
d := eval(c[3]);
if not(type(d,`XML/Element`)) then
error(__("Invalid RQP error structure"));
fi;
dc := d['NonWhiteChildren'];
if nops(dc) <> 1 then
error(__("Invalid RQP error structure"));
fi;
id := `XML/ContentString`(c[1]);
msg := `XML/ContentString`(c[2]);
detail := eval(dc[1]);
return([id,msg,eval(detail)]);
end
)
):
`Package/Assign`(
`RQP/ArrayOferror`,
"",
`new/XML/Type`(
"rqp:ArrayOferror",
"<xs:complexType name=\"ArrayOferror\">
<xs:complexContent>
<xs:restriction base=\"soap-enc:Array\">
<xs:sequence>
<xs:element name=\"item\" type=\"rqp:error\" minOccurs=\"0\" maxOccurs=\"unbounded\" />
</xs:sequence>
<xs:attribute ref=\"soap-enc:arrayType\" wsdl:arrayType=\"rqp:error[]\" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>",
list([string,string,anything]),
proc(a,h)
local t,hh;
t := sprintf("rqp:error[%d]",nops(a));
if type([h],[string]) then
hh := [h,"soap-enc:ArrayType" = t];
else
hh := [op(h),"soap-enc:ArrayType" = t];
fi;
`new/XML/Element`(hh,
op(map2(`XML/FromMaple`,`RQP/error`,a,"item",true)));
end,
proc(x)
map2(`XML/ToMaple`,`RQP/error`,x['NonWhiteChildren']);
end,
"soap-enc:Array"
)
):
`Package/Assign`(
`RQP/variable`,
"The #`XML/Type`# for variables in RQP. For compatibility with
certain parts of QTI, these variables are string-valued, and
are permitted to have multiple values or no value. They are
represented in Maple as a list of the form
@[identifier,[first value,...,last value]]@.
",
`new/XML/Type`(
"rqp:variable",
"<xs:complexType name=\"variable\">
<xs:sequence>
<xs:element name=\"identifier\" type=\"xs:NCName\" />
<xs:element name=\"values\" type=\"rqp:ArrayOfstring\" />
</xs:sequence>
</xs:complexType>",
[string,list(string)],
proc(a,h)
local v;
v := ("soap-enc:ArrayType" = sprintf("xs:string[%d]",nops(a[2])));
`new/XML/Element`(
h,[["identifier", "xsi:type" = "xs:NCName"],a[1]],
[["values","xsi:type" = "soap-enc:Array", v],
op(map(s -> [["item","xsi:type" = "xs:string"],s],a[2]))]);
end,
proc(x)
local c,id,vals;
c := x['NonWhiteChildren'];
if nops(c) <> 2 then
error(__("Invalid RQP variable structure"));
fi;
id := `XML/ContentString`(c[1]);
vals := `XML/ToMaple`(`RQP/ArrayOfstring`,c[2]);
return([id,vals]);
end,
"soap-enc:Array"
)
):
`Package/Assign`(
`RQP/ArrayOfvariable`,
"",
`new/XML/Type`(
"rqp:ArrayOfvariable",
"<xs:complexType name=\"ArrayOfvariable\">
<xs:complexContent>
<xs:restriction base=\"soap-enc:Array\">
<xs:sequence>
<xs:element name=\"item\" type=\"rqp:variable\" minOccurs=\"0\" maxOccurs=\"unbounded\" />
</xs:sequence>
<xs:attribute ref=\"soap-enc:arrayType\" wsdl:arrayType=\"rqp:variable[]\" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>",
list([string,list(string)]),
proc(a,h)
local t,hh;
t := sprintf("rqp:variable[%d]",nops(a));
if type([h],[string]) then
hh := [h,"soap-enc:ArrayType" = t];
else
hh := [op(h),"soap-enc:ArrayType" = t];
fi;
`new/XML/Element`(hh,
op(map2(`XML/FromMaple`,`RQP/variable`,a,"item",true)));
end,
proc(x)
map2(`XML/ToMaple`,`RQP/variable`,x['NonWhiteChildren']);
end,
"soap-enc:Array"
)
):
`Package/Assign`(
`RQP/input`,
"",
`new/XML/Type`(
"rqp:input",
"<xs:complexType name=\"input\">
<xs:sequence>
<xs:element name=\"name\" type=\"xs:NCName\" />
<xs:element name=\"value\" type=\"xs:string\" />
</xs:sequence>
</xs:complexType>
",
[string,string],
proc(a,h)
local v;
v := ("soap-enc:ArrayType" = sprintf("xs:string[%d]",nops(a[2])));
`new/XML/Element`(
h,
[["name", "xsi:type" = "xs:NCName"],a[1]],
[["value","xsi:type" = "xs:string"], a[2]]
);
end,
proc(x)
local c,nam,val;
c := x['NonWhiteChildren'];
if nops(c) <> 2 then
error(__("Invalid RQP input structure"));
fi;
nam := `XML/ContentString`(c[1]);
val := `XML/ContentString`(c[2]);
return([nam,val]);
end
)
):
`Package/Assign`(
`RQP/ArrayOfinput`,
"",
`new/XML/Type`(
"rqp:ArrayOfinput",
"<xs:complexType name=\"ArrayOfinput\">
<xs:complexContent>
<xs:restriction base=\"soap-enc:Array\">
<xs:sequence>
<xs:element name=\"item\" type=\"tns:input\" minOccurs=\"0\" maxOccurs=\"unbounded\" />
</xs:sequence>
<xs:attribute ref=\"soap-enc:arrayType\" wsdl:arrayType=\"tns:input[]\" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
",
list([string,list(string)]),
proc(a,h)
local t,hh;
t := sprintf("rqp:variable[%d]",nops(a));
if type([h],[string]) then
hh := [h,"soap-enc:ArrayType" = t];
else
hh := [op(h),"soap-enc:ArrayType" = t];
fi;
`new/XML/Element`(hh,
op(map2(`XML/FromMaple`,`RQP/variable`,a,"item",true)));
end,
proc(x)
map2(`XML/ToMaple`,`RQP/variable`,x['NonWhiteChildren']);
end,
"soap-enc:Array"
)
):
`Package/Assign`(
`RQP/output`,
"The #`XML/Type`# for RQP outputs.",
`new/XML/Type`(
"rqp:output",
"<xs:complexType name=\"output\">
<xs:sequence>
<xs:element name=\"identifier\" type=\"xs:anyURI\" />
<xs:element name=\"encoding\" type=\"xs:string\" />
<xs:element name=\"output\" type=\"xs:string\" />
</xs:sequence>
</xs:complexType>",
[string$3],
proc(a,h)
local x;
x := `new/XML/Element`(
h,
[["identifier","xsi:type" = "xs:anyURI"],a[1]],
[["encoding","xsi:type" = "xs:string"],a[2]],
[["output","xsi:type" = "xs:string","convertLaTeX" = "true"],a[3]]
);
return(eval(x));
end,
proc(x)
local c,id,enc,out;
c := x['NonWhiteChildren'];
if nops(c) <> 3 then
error(__("Invalid RQP outputSection structure"));
fi;
id := `XML/ContentString`(c[1]);
enc := `XML/ContentString`(c[2]);
out := `XML/ContentString`(c[3]);
return([id,enc,out]);
end
)
):
`Package/Assign`(
`RQP/ArrayOfoutput`,
"",
`new/XML/Type`(
"rqp:ArrayOfoutput",
"<xs:complexType name=\"ArrayOfoutput\">
<xs:complexContent>
<xs:restriction base=\"soap-enc:Array\">
<xs:sequence>
<xs:element name=\"item\" type=\"rqp:output\" minOccurs=\"0\" maxOccurs=\"unbounded\" />
</xs:sequence>
<xs:attribute ref=\"soap-enc:arrayType\" wsdl:arrayType=\"rqp:output[]\" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>",
list([string$3]),
proc(a,h)
local t,hh;
t := sprintf("rqp:output[%d]",nops(a));
if type([h],[string]) then
hh := [h,"soap-enc:ArrayType" = t];
else
hh := [op(h),"soap-enc:ArrayType" = t];
fi;
`new/XML/Element`(hh,
op(map2(`XML/FromMaple`,`RQP/output`,a,"item",true)));
end,
proc(x)
map2(`XML/ToMaple`,`RQP/output`,x['NonWhiteChildren']);
end,
"soap-enc:Array"
)
):
EndPackage():
--- NEW FILE: rqp.wsdl ---
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://schemas.rqp.org/rqp" xmlns:tns="http://schemas.rqp.org/rqp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/">
<types>
<xs:schema targetNamespace="http://schemas.rqp.org/rqp">
<xs:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<!-- Arrays of Base and Simple Types -->
<xs:complexType name="ArrayOfstring">
<xs:complexContent>
<xs:restriction base="soap-enc:Array">
<xs:sequence>
<xs:element name="item" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="soap-enc:arrayType" wsdl:arrayType="xs:string[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ArrayOfanyURI">
<xs:complexContent>
<xs:restriction base="soap-enc:Array">
<xs:sequence>
<xs:element name="item" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="soap-enc:arrayType" wsdl:arrayType="xs:anyURI[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<!-- Complex Types and Arrays of Complex Types -->
<!-- error object -->
<xs:complexType name="error">
<xs:sequence>
<xs:element name="identifier" type="xs:anyURI" />
<xs:element name="message" type="xs:string" />
<xs:element name="detail" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOferror">
<xs:complexContent>
<xs:restriction base="soap-enc:Array">
<xs:sequence>
<xs:element name="item" type="tns:error" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:error[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<!-- variable object -->
<xs:complexType name="variable">
<xs:sequence>
<xs:element name="identifier" type="xs:NCName" />
<xs:element name="values" type="tns:ArrayOfstring" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfvariable">
<xs:complexContent>
<xs:restriction base="soap-enc:Array">
<xs:sequence>
<xs:element name="item" type="tns:variable" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:variable[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<!-- input object -->
<xs:complexType name="input">
<xs:sequence>
<xs:element name="name" type="xs:NCName" />
<xs:element name="value" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfinput">
<xs:complexContent>
<xs:restriction base="soap-enc:Array">
<xs:sequence>
<xs:element name="item" type="tns:input" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:input[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<!-- output object -->
<xs:complexType name="output">
<xs:sequence>
<xs:element name="identifier" type="xs:anyURI" />
<xs:element name="encoding" type="xs:string" />
<xs:element name="output" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfoutput">
<xs:complexContent>
<xs:restriction base="soap-enc:Array">
<xs:sequence>
<xs:element name="item" type="tns:output" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:output[]" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
</types>
<!-- Faults -->
<message name="Fault">
<part name="detail" type="tns:error" />
</message>
<!-- ServerInformation operation -->
<message name="ServerInformation" />
<message name="ServerInformationResponse">
<part name="identifier" type="xs:anyURI" />
<part name="name" type="xs:NCName" />
<part name="description" type="xs:string" />
<part name="cloning" type="xs:boolean" />
<part name="implicitCloning" type="xs:boolean" />
<part name="rendering" type="xs:boolean" />
<part name="itemFormats" type="tns:ArrayOfanyURI" />
<part name="renderFormats" type="tns:ArrayOfanyURI" />
</message>
<!-- ItemInformation operation -->
<message name="ItemInformation">
<part name="source" type="xs:string" />
<part name="format" type="xs:anyURI" />
<part name="index" type="xs:unsignedInt" />
</message>
<message name="ItemInformationResponse">
<part name="format" type="xs:anyURI" />
<part name="sourceErrors" type="tns:ArrayOferror" />
<part name="template" type="xs:boolean" />
<part name="adaptive" type="xs:boolean" />
<part name="timeDependent" type="xs:boolean" />
<part name="canComputerScore" type="xs:boolean" />
<part name="solutionAvailable" type="xs:boolean" />
<part name="hintAvailable" type="xs:boolean" />
<part name="validationPossible" type="xs:boolean" />
<part name="maxScore" type="xs:unsignedInt" />
<part name="length" type="xs:unsignedInt" />
</message>
<!-- ProcessTemplate operation -->
<message name="ProcessTemplate">
<part name="source" type="xs:string" />
<part name="format" type="xs:anyURI" />
<part name="seed" type="xs:unsignedInt" />
</message>
<message name="ProcessTemplateResponse">
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
</message>
<!-- Clone operation -->
<message name="Clone">
<part name="source" type="xs:string" />
<part name="format" type="xs:anyURI" />
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
</message>
<message name="CloneResponse">
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
<part name="clone" type="xs:string" />
</message>
<!-- SessionInformation operation -->
<message name="SessionInformation">
<part name="source" type="xs:string" />
<part name="format" type="xs:anyURI" />
<part name="index" type="xs:unsignedInt" />
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
<part name="persistentData" type="xs:string" />
<part name="embedPrefix" type="xs:QName" />
</message>
<message name="SessionInformationResponse">
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
<part name="correctResponses" type="tns:ArrayOfinput" />
</message>
<!-- Render operation -->
<message name="Render">
<part name="source" type="xs:string" />
<part name="format" type="xs:anyURI" />
<part name="index" type="xs:unsignedInt" />
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
<part name="persistentData" type="xs:string" />
<part name="responses" type="tns:ArrayOfinput" />
<part name="advanceState" type="xs:boolean" />
<part name="embedPrefix" type="xs:QName" />
<part name="appletBase" type="xs:anyURI" />
<part name="mediaBase" type="xs:anyURI" />
<part name="renderFormat" type="xs:anyURI" />
<part name="modalFormat" type="xs:anyURI" />
</message>
<message name="RenderResponse">
<part name="seed" type="xs:unsignedInt" />
<part name="templateVars" type="tns:ArrayOfvariable" />
<part name="persistentData" type="xs:string" />
<part name="outcomeVars" type="tns:ArrayOfvariable" />
<part name="output" type="tns:ArrayOfoutput" />
</message>
<portType name="rqp">
<operation name="RQP_ServerInformation">
<input message="tns:ServerInformation" />
<output message="tns:ServerInformationResponse" />
<fault name="RQP_Fault" message="tns:Fault" />
</operation>
<operation name="RQP_ItemInformation">
<input message="tns:ItemInformation" />
<output message="tns:ItemInformationResponse" />
<fault name="RQP_Fault" message="tns:Fault" />
</operation>
<operation name="RQP_ProcessTemplate">
<input message="tns:ProcessTemplate" />
<output message="tns:ProcessTemplateResponse" />
<fault name="RQP_Fault" message="tns:Fault" />
</operation>
<operation name="RQP_Clone">
<input message="tns:Clone" />
<output message="tns:CloneResponse" />
<fault name="RQP_Fault" message="tns:Fault" />
</operation>
<operation name="RQP_SessionInformation">
<input message="tns:SessionInformation" />
<output message="tns:SessionInformationResponse" />
<fault name="RQP_Fault" message="tns:Fault" />
</operation>
<operation name="RQP_Render">
<input message="tns:Render" />
<output message="tns:RenderResponse" />
<fault name="RQP_Fault" message="tns:Fault" />
</operation>
</portType>
<binding name="rqp" type="tns:rqp">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="RQP_ServerInformation">
<soap:operation soapAction="RQP_ServerInformation" />
<input>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
<fault>
<soap:fault name="tns:RQP_Fault" use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStye="http://schemas.xmlsoap.org/soap/encoding/" />
</fault>
</operation>
<operation name="RQP_ItemInformation">
<soap:operation soapAction="RQP_ItemInformation" />
<input>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
<fault>
<soap:fault name="tns:RQP_Fault" use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStye="http://schemas.xmlsoap.org/soap/encoding/" />
</fault>
</operation>
<operation name="RQP_ProcessTemplate">
<soap:operation soapAction="RQP_ProcessTemplate" />
<input>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
<fault>
<soap:fault name="tns:RQP_Fault" use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStye="http://schemas.xmlsoap.org/soap/encoding/" />
</fault>
</operation>
<operation name="RQP_Clone">
<soap:operation soapAction="RQP_Clone" />
<input>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
<fault>
<soap:fault name="tns:RQP_Fault" use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStye="http://schemas.xmlsoap.org/soap/encoding/" />
</fault>
</operation>
<operation name="RQP_SessionInformation">
<soap:operation soapAction="RQP_SessionInformation" />
<input>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
<fault>
<soap:fault name="tns:RQP_Fault" use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStye="http://schemas.xmlsoap.org/soap/encoding/" />
</fault>
</operation>
<operation name="RQP_Render">
<soap:operation soapAction="RQP_Render" />
<input>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
<fault>
<soap:fault name="tns:RQP_Fault" use="encoded" namespace="http://schemas.rqp.org/rqp" encodingStye="http://schemas.xmlsoap.org/soap/encoding/" />
</fault>
</operation>
</binding>
<service name="rqp">
<port name="rqp" binding="tns:rqp">
<soap:address location="http://alice.shef.ac.uk/AiM3/Alice" />
</port>
</service>
</definitions>
|