1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
<?vsp
--
-- $Id$
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2012 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--
declare resp,inp,outp any;
resp := null;
if ({?'exec'} is not null)
{
declare headers, param, _t any;
declare mid any;
declare wsa_from, wsu_time, par, created, expr, m_id, a_to, act soap_parameter;
declare rst SOAP_CLIENT_REQ;
rst := new SOAP_CLIENT_REQ ();
rst.url := {?'url'};
rst.operation := 'StockQuoteRequest';
wsa_from := new soap_parameter ();
wsa_from.set_xsd ('http://schemas.xmlsoap.org/ws/2004/03/addressing:From');
wsa_from.add_member ('Address', 'http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous');
wsa_from.set_attribute ('Id', 'Id-' || uuid());
created := new soap_parameter (dt_set_tz (now (), 0));
created.set_xsd ('http://schemas.xmlsoap.org/ws/2002/07/utility:Created');
created.set_attribute ('Id', 'Id-' || uuid());
expr := new soap_parameter (dt_set_tz (dateadd ('minute', 500, now ()), 0));
expr.set_xsd ('http://schemas.xmlsoap.org/ws/2002/07/utility:Expires');
expr.set_attribute ('Id', 'Id-' || uuid());
wsu_time := new soap_parameter ();
wsu_time.set_xsd ('http://schemas.xmlsoap.org/ws/2002/07/utility:Timestamp');
wsu_time.add_member ('Created', created);
wsu_time.add_member ('Expires', expr);
m_id := new soap_parameter (lower ('UUID:'||uuid ()));
m_id.set_xsd ('http://schemas.xmlsoap.org/ws/2004/03/addressing:MessageID');
m_id.set_attribute ('Id', 'Id-' || uuid());
a_to := new soap_parameter (rst.url);
a_to.set_xsd ('http://schemas.xmlsoap.org/ws/2004/03/addressing:To');
a_to.set_attribute ('Id', 'Id-' || uuid());
act := new soap_parameter ('http://stockservice.contoso.com/wse/samples/2003/06/StockQuoteRequest');
act.set_xsd ('http://schemas.xmlsoap.org/ws/2004/03/addressing:Action');
act.set_attribute ('Id', 'Id-' || uuid());
headers := vector_concat (
act.get_call_param (''),
wsa_from.get_call_param (''),
m_id.get_call_param (''),
a_to.get_call_param ('')
--, wsu_time.get_call_param ('')
);
if (not xenc_key_exists ('wss-3des'))
xenc_key_3DES_rand_create ('wss-3des', '!sec!');
resp := SOAP_CLIENT (url=>rst.url, operation=>rst.operation, headers=>headers,
style=>1+4+16+2,
parameters=>vector (vector ('symbols', 'http://stockservice.contoso.com/wse/samples/2003/06:symbols_t'),
vector ({?'symbol'})),
auth_type=>'key',
target_namespace=>'http://stockservice.contoso.com/wse/samples/2003/06',
soap_action=>'http://stockservice.contoso.com/wse/samples/2003/06/StockQuoteRequest',
ticket=>xenc_key_inst_create ('wss-3des', xenc_key_inst_create ('wss.pfx')),
security_type=>'encr'
, security_schema => vector ('wsse', WSSE_OASIS_URI (),'wsu', WSSU_OASIS_URI())
);
}
?>
<html>
<HEAD><link rel="stylesheet" type="text/css" href="../demo.css" /></HEAD>
<body>
<H3>Asymmetric encryption SOAP client calling WSE 2.0 Stock demo Service</H3>
<form method="post" action="<?= http_path() ?>" name="mform">
<table class="tableentry">
<tr><td>1. Enter the endpoint URL</td><td>
<input type="text" name="url" size="100" value="http://<host name>/AsymEncryptCodeService/AsymEncryptService.asmx" />
</td></tr>
<tr><td>2. Enter a symbol to get a quote</td><td>
<input type="text" name="symbol" size="15" value="FABRIKAM" />
</td></tr>
<tr><td>3. Call the StockQuoteRequest</td><td><input type="submit" name="exec" value="Execute"></td></tr>
</table>
</form>
<?vsp
if (resp is not null) {
declare inx, oux, atts any;
inp := resp[1];
outp := resp[2];
atts := resp[4];
inx := xslt (TUTORIAL_XSL_DIR () || '/tutorial/services/raw.xsl', xml_tree_doc (inp), vector ('body', 0));
oux := xslt (TUTORIAL_XSL_DIR () || '/tutorial/services/raw.xsl', xml_tree_doc (outp), vector ('body', 0));
?>
<table>
<tr>
<td>
Request
</td>
</tr>
<tr>
<td>
<div class="filelist">
<?vsp http_value (inx, null); ?>
</div>
</td>
</tr>
<tr>
<tr>
<td>
Response
</td>
</tr>
<td>
<div class="filelist">
<?vsp http_value (oux, null); ?>
</div>
</td>
</tr>
</table>
<?vsp
}
?>
</body>
</html>
|