Professional Documents
Culture Documents
svc_xml_generic:request/12
svc_http:request/11
svc_http:rest_request/10
Where is it?
opt/cellcube/conf/xml_generic/
Examples
svc_xml_generic:request/8
XML request template
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="https://orientation.campusen.sn/selection/service/soap">
<soapenv:Header/>
<soapenv:Body>
<![CDATA[
<Data>
<operateur>OAcjRk1</operateur>
<numero_ine>1234567890</numero_ine>
<date_naissance>19800101</date_naissance>
</Data>
]]>
</soapenv:Body>
</soapenv:Envelope>
svc_xml_generic:request/8
XML request template
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="https://orientation.campusen.sn/selection/service/soap">
<soapenv:Header/>
<soapenv:Body>
<![CDATA[
<Data>
<operateur>OAcjRk1</operateur>
<numero_ine><?DYNSTRING "$(tango.INE.)"?></numero_ine>
<date_naissance><?DYNSTRING "$(tango.BDAY.)"?></date_naissance>
</Data>
]]>
</soapenv:Body>
</soapenv:Envelope>
svc_xml_generic:request/8
Dynamical String for XML request template
<?DYNSTRING "$(SvcName.VarName.)"?>
Set the specific session variable’s value, which can only be integer, atom or string.
Name $(tango.id_type.)
Session crashed
<?DYNSTRING “$
[{“LIGHT”, due to the value is
(tango.id_type.)”?>
Value “profile_LIGHT”}, {“FULL”, not a string.
“profile_FULL”}]
Name $(tango.retries.)
<?DYNSTRING “$
“2”
(tango.retries.)”?>
Value “2”
svc_xml_generic:request/8
Dynamical String for XML request template
<?DYNSTRING "$(Attr.)"?>
Attr is one of the following session attributes: ussd_code, subscription, language, bearer,
anonymous, vlr, msisdn, imsi, direct_access, imei, ussdsize, end_ussdsize, operator
<?DYNSTRING "$(random.Number.)"?>
Set the random number in range [1, Number].
<?DYNSTRING "$(list.SvcName.VarName.IdxList.)"?>
Set item value of specific list session variable
<?DYNSTRING "$(conf.AppName.Param.)"?>
<?DYNSTRING "$(conf.AppName.Param.IdxList.)"?>
Set the specific config value, or its specific item value.
<?DYNSTRING
Name pservices::barring_acl_code
“$
(conf.pservices.bar “all_imsi”
ring_acl_code.
Value [{1,all_imsi},{2,all_msisdn}]
[1,2].)”?>
svc_xml_generic:request/8
Dynamical String for XML request template
<?DYNSTRING "$(date.Format.Type.)"?>
Set date time with the specific format.
Type could be utc or local, indicating set UTC0 or local date time value.
Format composes of the following directives and plain texts:
Directive Meaning
%D date (mm/dd/yy)
<?DYNSTRING "$(date.Format.Type.)"?>
Directive Meaning
%F same as %Y-%m-%d
%H hour (00..23)
%I hour (01..12)
%k hour (0..23)
%l hour (1..12)
%m month (01..12)
%M minute (00..59)
<?DYNSTRING "$(date.Format.Type.)"?>
Directive Meaning
%Y year (1970...)
svc_xml_generic:request/8
Dynamical String for XML request template
<?DYNSTRING "$(date.Format.Type.)"?>
Example Result
Where is it?
opt/cellcube/conf/xml_generic/
[{value,"TXNSTATUS","/descendant::COMMAND/TXNSTATUS/text()"},
{xmlnode,"wallet_node","/descendant::COMMAND/DATA/WALLETTYPE"},
{complex,"/descendant::COMMAND/DATA/WALLETTYPE",
[{value,"cpx_name","/descendant::WTNAME/text()"},
{value,"cpx_id","/descendant::WID/text()"},
{value,"cpx_grade","/descendant::GRADE/text()"}
]}
].
svc_xml_generic:request/8
Mapping File
{value, VarName, XPath}
Get the text or attribute value via XPath, then store the value into session variable $
(SvcName.VarName.). SvcName is specified in the plugin’s arguments. If XPath
corresponds to multiple items, the stored value is a list.
{xmlnode, VarName, XPath}
Get the node via XPath, and store it into session variable $(SvcName.VarName.), then
deal with it in concrete plugin. If XPath corresponds to multiple nodes, the stored value is
a list.
{complex, XPath, SubConds}
Search the node corresponding to XPath, and get the values matching SubConds.
svc_xml_generic:request/8
Mapping File example: single node
<?xml version="1.0"?>
<COMMAND> [{"TXNSTATUS","100"},
<TXNSTATUS>200</TXNSTATUS> {"wallet_node",
<TRID>1234567890</TRID> {xmlElement,'WALLETTYPE',...}},
<DATA> {"cpx_name",
<WALLETTYPE> [{error,not_found},"Will","John"]},
<WTNAME>John</WTNAME> {"cpx_id",["333","222","111"]},
<WID>111</WID> {"cpx_grade",
<GRADE>A</GRADE> [{error,not_found},
</WALLETTYPE> {error,not_found},
<WALLETTYPE> "A"]}
<WTNAME>Will</WTNAME> ]. parsing result
<WID>222</WID>
<GRADE/>
</WALLETTYPE>
<WALLETTYPE>
<WTNAME></WTNAME>
<WID>333</WID>
</WALLETTYPE> same mapping
</DATA> no GRADE
</COMMAND>
SOAP response
svc_xml_generic:request/8
Error File
Where is it?
opt/cellcube/conf/xml_generic/
Used to directly indentify failure response. If any one of listed XPathes is found,
the plugin redirects to error or the default link. Although found a XPath, the
corresponding value won’t be saved into session, but the label is. So its usage is
very limited.
[{"TXNSTATUS","/descendant::COMMAND/TXNSTATUS/text()"},
{"wallet_node","/descendant::COMMAND/DATA/WID/text()"}].
label XPath always points a value
[].
svc_xml_generic:request/12
This plugin extends svc_xml_generic:request/8 by providing several extra
arguments.
http_method specifies the HTTP conversation method, only supports
GET/PUT/POST. So that the plugin can handle REST requests.
header_enrichment_from_xmlhttp, host and port: If
header_enrichment_from_xmlhttp is true, the plugin searches config
pserver::xmlhttp_hosts for customized HTTP headers by querying host and port.
svc_http:request/11
This plugin sends http request to the specific URL and extracts the specific
variables and their values from response.
If http request complete successfully, the session will be filled with extracted
variables/values then redirect to the ok page.
If http request fails, redirect to the nok page.
url specifies the URL to be requested.
escape specifies whether encode url according to RFC2396 and HTML4.0 B2.1:
http://www.foo.com/search?你好
http://www.foo.com/search?%E4%BD%A0%E5%A5%BD
svc_http:request/11
routing specifies the appropriate HTTP route.
See config pdist::httpclient_routing
service_name specifies the service name of output variables.
decode_fun specifies the function for decoding the HTTP response. There are only
two options:
http_parser:parse: parses HTTP response format like
“Username=zsmart&Password=zsmart&ACTION_ID=AddFellowISDN”
[{{service_name, “Username”}, “zsmart”}, {{service_name, “Password”}, “zsmart”},
{{service_name, “ACTION_ID”}, “AddFellowISDN”}]
json_parser:parse: parses JSON response format like
{“Username” : ”zsmart”, “Password” : “zsmart”, “ACTION_ID” : “AddFellowISDN”}
{{service_name, “json”}, {“Username” : ”zsmart”, “Password” : “zsmart”, “ACTION_ID” :
“AddFellowISDN”}}
svc_http:request/11
filter specifies list of variables to be retrieved. Multiple variables are comma-
separated, '*' means all, empty means none.
e.g. var1,var2,var3
timeout specifies the request timeout in milliseconds.
method specifies the http request method, could be “post” or “get”.
svc_http:rest_request/10
This plugin sends REST http request to the specific URL and parse result from
response.
If http request completes, and the result is parsed successfully, the session will redirect to
the ok page.
If http request fails, redirect to the nok page.
method specifies the http request method, could be “post”, “get”, “put” or “delete”.
url specifies the URL to be requested.
header specifies the Herader of request.
It should be format as Tag1:Value1${new_line}Tag2:Value2...
body specifies the the Body of request.
routing specifies the appropriate HTTP route.
See config pdist::httpclient_routing
svc_http:rest_request/10
parse_fun specifies the function for parsing the HTTP response. Format:
Module:Function.
The M:F accepts Args (Session, HTTPCode, ResponseHeader, ResponseBody)
Return {ok, NewSession}|{nok, NewSession}.
Default value is http_parser:rest_parse, return ok only when HTTPCode is 200
timeout specifies the request timeout in milliseconds.
Supported XPath Expressions
Cellcube only supports XPath 1.0:
https://www.w3.org/TR/1999/REC-xpath-19991116/