File: ws_s_1.sql

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (169 lines) | stat: -rw-r--r-- 6,240 bytes parent folder | download | duplicates (2)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
--  
--  $Id: ws_s_1.sql,v 1.2 2006/08/16 07:58:13 source Exp $
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2006 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
--  
--  

create procedure
WSS_SETUP ()
{
  if (not exists (select 1 from SYS_USERS where U_NAME = 'WSS'))
    exec ('create user WSS');
}
;

WSS_SETUP ()
;

create procedure AddInt (in a int, in b int) returns int __soap_type 'int'
{
  return (a + b);
}
;

grant execute on AddInt to WSS
;

VHOST_REMOVE (lpath=>'/SecureWebServices');

VHOST_DEFINE (lpath=>'/SecureWebServices', ppath=>'/SOAP/', soap_user=>'WSS',
              soap_opts=>vector('Namespace','http://temp.uri/',
		                'MethodInSoapAction','yes',
				'ServiceName', 'WSSecure',
				'CR-escape', 'no',
				'WS-SEC','yes',
				'WSS-KEY', NULL,
				'WSS-Template', NULL,
				'WSS-Type', 0,
				'WSS-Validate-Signature', 2))
;


-- define a key for client
USER_KEY_LOAD ('WSDK Sample Symmetric Key', 'EE/uaFF5N3ZNJWUTR8DYe+OEbwaKQnso', '3DES', 'DER', null)
;

-- this can be used for 'WSS-KEY'
create procedure
DB.DBA.WSDK_GET_KEY ()
{
  return xenc_key_inst_create ('WSDK Sample Symmetric Key');
}
;

create procedure
WSS_SRV_SETUP ()
{
  __pop_user_id();
  __set_user_id('WSS');
  if (not xenc_key_exists ('WSDK Sample Symmetric Key'))
    USER_KEY_LOAD ('WSDK Sample Symmetric Key', 'EE/uaFF5N3ZNJWUTR8DYe+OEbwaKQnso', '3DES', 'DER', null);
  __pop_user_id();
  __set_user_id('dba');
}
;

WSS_SRV_SETUP ()
;

CREATE PROCEDURE WSS_STOCK_XSD ()
{
  declare ses any;
  ses := string_output ();
http ('<xsd:schema\n', ses);
http ('    xmlns:xsd="http://www.w3.org/2001/XMLSchema"\n', ses);
http ('    xmlns:tns="http://stockservice.contoso.com/wse/samples/2003/06"\n', ses);
http ('    targetNamespace="http://stockservice.contoso.com/wse/samples/2003/06">\n', ses);
http ('    <xsd:element name="StockQuoteRequest">\n', ses);
http ('	<xsd:complexType>\n', ses);
http ('	    <xsd:sequence>\n', ses);
http ('		<xsd:element name="symbols" minOccurs="1" maxOccurs="1" type="tns:symbols_t" />\n', ses);
http ('	    </xsd:sequence>\n', ses);
http ('	</xsd:complexType>\n', ses);
http ('    </xsd:element>\n', ses);
http ('    <xsd:element name="StockQuotes">\n', ses);
http ('	<xsd:complexType>\n', ses);
http ('	    <xsd:sequence>\n', ses);
http ('		<xsd:element name="StockQuote" minOccurs="0" maxOccurs="unbounded" type="tns:StockQuote_t" />\n', ses);
http ('	    </xsd:sequence>\n', ses);
http ('	</xsd:complexType>\n', ses);
http ('    </xsd:element>\n', ses);
http ('    <xsd:complexType name="symbols_t">\n', ses);
http ('	    <xsd:sequence>\n', ses);
http ('		<xsd:element name="Symbol" minOccurs="1" maxOccurs="unbounded" type="xsd:string" />\n', ses);
http ('	    </xsd:sequence>\n', ses);
http ('    </xsd:complexType>\n', ses);
http ('    <xsd:complexType name="StockQuote_t">\n', ses);
http ('	    <xsd:sequence>\n', ses);
http ('		<xsd:element name="Symbol" minOccurs="0" maxOccurs="1" type="xsd:string" />\n', ses);
http ('		<xsd:element name="Last" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="Date" minOccurs="0" maxOccurs="1" type="xsd:dateTime" />\n', ses);
http ('		<xsd:element name="Change" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="Open" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="High" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="Low" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="Volume" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="MarketCap" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="PreviousClose" minOccurs="0" maxOccurs="1" type="xsd:float" />\n', ses);
http ('		<xsd:element name="PreviousChange" minOccurs="0" maxOccurs="1" type="xsd:float" />\n', ses);
http ('		<xsd:element name="Low52Week" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="High52Week" minOccurs="0" maxOccurs="1" type="xsd:int" />\n', ses);
http ('		<xsd:element name="Name" minOccurs="0" maxOccurs="1" type="xsd:string" />\n', ses);
http ('	    </xsd:sequence>\n', ses);
http ('    </xsd:complexType>\n', ses);
http ('</xsd:schema>\n', ses);
  SOAP_LOAD_SCH (string_output_string (ses));
}
;

WSS_STOCK_XSD ()
;

create procedure
WSE_DEMO_TEMPLATE (in body varchar)
{
  declare tmpl, algo, key_name varchar;
  key_name := 'Client Private.pfx';
  algo := xenc_get_key_algo (key_name);
  if (algo is null)
    return NULL;
  tmpl := sprintf ('<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" >
  <SignedInfo>
    <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
    <SignatureMethod Algorithm="%s" />
  </SignedInfo>
  <SignatureValue></SignatureValue>
  <KeyInfo>
    <KeyName>%s</KeyName>
  </KeyInfo>
</Signature>', algo, key_name);
  return dsig_template_ext (xtree_doc (body), tmpl, vector ('wsse', WSSE_OASIS_URI (),'wsu', WSSU_OASIS_URI()),
      'http://schemas.xmlsoap.org/soap/envelope/', 'Body',
 	'http://schemas.xmlsoap.org/ws/2004/03/addressing', 'From',
 	'http://schemas.xmlsoap.org/ws/2004/03/addressing', 'ReplyTo',
 	'http://schemas.xmlsoap.org/ws/2004/03/addressing', 'To',
 	'http://schemas.xmlsoap.org/ws/2004/03/addressing', 'Action',
 	'http://schemas.xmlsoap.org/ws/2004/03/addressing', 'MessageID',
 	WSSU_OASIS_URI(), 'Timestamp'
      );
}
;