File: wsdl_import_udt.xml

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (275 lines) | stat: -rw-r--r-- 9,730 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?xml version="1.0" encoding="utf-8" ?>
<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 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
 -  
 -  
-->
  <refentry id="fn_wsdl_import_udt">
  <refmeta>
    <refentrytitle>wsdl_import_udt</refentrytitle>
    <refmiscinfo>ws</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>WSDL_IMPORT_UDT</refname>
    <refpurpose>Returns a string containing a UDT definition</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <funcsynopsis id="fsyn_wsdl_import_udt">
      <funcprototype id="fproto_wsdl_import_udt">
        <funcdef>varchar <function>WSDL_IMPORT_UDT</function></funcdef>
        <paramdef>in <parameter>url</parameter> varchar</paramdef>
        <paramdef>in <parameter>f</parameter> varchar</paramdef>
        <paramdef>in <parameter>exec</parameter> any</paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>
  <refsect1 id="desc_wsdl_import_udt">
    <title>Description</title>
    <para>This function is used to create a user defined type (UDT) definition 
    automatically based on a WSDL file.  The source WSDL is supplied via a URL.</para>
    <para>The returned definition can be saved to a file and/or executed automatically 
    to provide instant access to the new UDT.</para>
    <note><title>Note:</title>
    <para>To save the file you must have an appropriate ACL defined.</para>
    </note>
  </refsect1>
  <refsect1 id="params_wsdl_import_udt"><title>Parameters</title>
    <refsect2><title>url</title>
      <para>The URI of the target WSDL file to build a UDT definition of.</para></refsect2>
    <refsect2><title>f</title>
      <para>The name of the file if the definition is to be saved.  This will produce a 
      file on the file system under the server root directory.</para>
<para>The default value is NULL, which will not create a file.</para></refsect2>
    <refsect2><title>exec</title>
      <para>This flag indicates whether the definition should be immediately 
      executed upon import.  This takes the form of 0 or 1.  The default value
      of 0 will not execute the definition.</para></refsect2>
  </refsect1>
  <refsect1 id="ret_wsdl_import_udt"><title>Return Types</title>
    <para>This function returns the text of the UDT definition as a varchar.</para>
  </refsect1>
<!--
  <refsect1 id="errors_wsdl_import_udt">
    <title>Errors</title>
    <para>This function can generate the following errors:</para>
    <errorcode></errorcode>
  </refsect1>
-->
  <refsect1 id="examples_wsdl_import_udt">
    <title>Examples</title>
    <example id="ex_wsdl_import_udt"><title>Simple example of a WSDL driven UDT</title>
      <para>Web Service proxy wrapper for Redcoal SMS SOAP interface:</para>

<programlisting>
SQL&gt; WSDL_IMPORT_UDT (&#39;http://xml.redcoal.com/soapserver.dll/wsdl/ISoapServer&#39;, &#39;redcoal.sql&#39;);   
</programlisting>

<para>This will create the following file on file system called <computeroutput>redcoal.sql</computeroutput>:</para>
      <screen>
-- Automatically generated code 
-- imported from WSDL URI: &quot;http://xml.redcoal.com/soapserver.dll/wsdl/ISoapServer&quot; 
-- UDT class 
drop type &quot;ISOAPServerservice&quot; 
;
 
create type &quot;ISOAPServerservice&quot; 
  as 
    ( 
      debug int default 0, 
      url varchar default &#39;http://xml.redcoal.com/soapserver.dll/soap/ISoapServer&#39;, 
      request varchar, 
      response varchar 
    ) 
-- Binding: &quot;http://tempuri.org/:ISOAPServerbinding&quot; 
 
method &quot;SendTextSMS&quot; 
       ( 
        &quot;strInSerialNo&quot; any, 
        &quot;strInSMSKey&quot; any, 
        &quot;strInRecipients&quot; any, 
        &quot;strInMessageText&quot; any, 
        &quot;strInReplyEmail&quot; any, 
        &quot;strInOriginator&quot; any, 
        &quot;iInType&quot; any, 
        &quot;strOutMessageIDs&quot; any, 
        &quot;return&quot; any 
       ) returns any, 

.... more methods follows ; do not supplied for brevity        
 
method &quot;RedWebServiceVersion&quot; 
       ( 
        &quot;return&quot; any 
       ) returns any, 
 
method style () returns any 
;
 
-- Methods 
 
create method &quot;SendTextSMS&quot; 
       ( 
        in &quot;strInSerialNo&quot; any, 
        in &quot;strInSMSKey&quot; any, 
        in &quot;strInRecipients&quot; any, 
        in &quot;strInMessageText&quot; any, 
        in &quot;strInReplyEmail&quot; any, 
        in &quot;strInOriginator&quot; any, 
        in &quot;iInType&quot; any, 
        inout &quot;strOutMessageIDs&quot; any, 
        out &quot;return&quot; any 
       ) for &quot;ISOAPServerservice&quot; 
{ 
  declare action, namespace, enc varchar; 
  declare style int; 
  declare _result, _body, xe any; 
  action := &#39;urn:SOAPServerImpl-ISOAPServer#SendTextSMS&#39;; 
   
  namespace := &#39;urn:SOAPServerImpl-ISOAPServer&#39;; 
   
  style := 0; 
   
  if (self.debug) 
    style := style + 2; 
  _result := SOAP_CLIENT ( 
	        url=&gt;self.url, 
		operation=&gt;&#39;SendTextSMS&#39;, 
 		soap_action=&gt;action, 
	        target_namespace=&gt;namespace, 
 		parameters=&gt;vector 
    ( 
     vector(&#39;strInSerialNo&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strInSerialNo&quot; , 
     vector(&#39;strInSMSKey&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strInSMSKey&quot; , 
     vector(&#39;strInRecipients&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strInRecipients&quot; , 
     vector(&#39;strInMessageText&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strInMessageText&quot; , 
     vector(&#39;strInReplyEmail&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strInReplyEmail&quot; , 
     vector(&#39;strInOriginator&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strInOriginator&quot; , 
     vector(&#39;iInType&#39;, &#39;http://www.w3.org/2001/XMLSchema:int&#39;), &quot;iInType&quot; , 
     vector(&#39;strOutMessageIDs&#39;, &#39;http://www.w3.org/2001/XMLSchema:string&#39;), &quot;strOutMessageIDs&quot;  
    ), 
		style=&gt;style 
               ); 
  if (self.debug) 
    { 
      _body := _result[0]; 
      self.request := _result[1]; 
      self.response := _result[2]; 
    } 
  else 
    _body := _result; 
  xe := xml_cut (xml_tree_doc (_body)); 
  &quot;strOutMessageIDs&quot; := xml_cut (xpath_eval (&#39;//strOutMessageIDs&#39;, xe, 1)); 
  &quot;strOutMessageIDs&quot; := soap_box_xml_entity_validating (&quot;strOutMessageIDs&quot;, 
    &#39;http://www.w3.org/2001/XMLSchema:string&#39;, 0); 
  &quot;return&quot; := xml_cut (xpath_eval (&#39;//return&#39;, xe, 1)); 
  &quot;return&quot; := soap_box_xml_entity_validating (&quot;return&quot;, &#39;http://www.w3.org/2001/XMLSchema:int&#39;, 0); 
 
  return _result; 
} 
;

.... more method definitions follows ; not supplied for brevity
 
create method &quot;RedWebServiceVersion&quot; 
       ( 
        out &quot;return&quot; any 
       ) for &quot;ISOAPServerservice&quot; 
{ 
  declare action, namespace, enc varchar; 
  declare style int; 
  declare _result, _body, xe any; 
  action := &#39;urn:SOAPServerImpl-ISOAPServer#RedWebServiceVersion&#39;; 
   
  namespace := &#39;urn:SOAPServerImpl-ISOAPServer&#39;; 
   
  style := 0; 
   
  if (self.debug) 
    style := style + 2; 
  _result := SOAP_CLIENT ( 
	        url=&gt;self.url, 
		operation=&gt;&#39;RedWebServiceVersion&#39;, 
 		soap_action=&gt;action, 
	        target_namespace=&gt;namespace, 
 		parameters=&gt;vector 
                        ( 
 
			), 
		style=&gt;style 
               ); 
  if (self.debug) 
    { 
      _body := _result[0]; 
      self.request := _result[1]; 
      self.response := _result[2]; 
    } 
  else 
    _body := _result; 
  xe := xml_cut (xml_tree_doc (_body)); 
  &quot;return&quot; := xml_cut (xpath_eval (&#39;//return&#39;, xe, 1)); 
  &quot;return&quot; := soap_box_xml_entity_validating (&quot;return&quot;, 
    &#39;http://www.w3.org/2001/XMLSchema:string&#39;, 0); 
 
  return _result; 
} 
;

</screen>
<para>This script, executed via the ISQL tool, or automatically if the &#39;exec&#39; flag is set to &#39;true&#39;,
will define the desired UDT in database.  Developing a simple application for checking the Redcoal SMS SOAP interface 
could be done as follows using a stored procedure:
</para>

      <screen>
create procedure
redcoaltest ()
{
  declare svc &quot;ISOAPServerservice&quot;;
  declare res nvarchar;
  svc := new &quot;ISOAPServerservice&quot; ();
  svc.&quot;RedWebServiceVersion&quot; (res);
  result_names (res);
  result (res);
}
;

</screen>

<para>Which could have the following output:</para>

      <screen>
SQL&gt; redcoaltest();
res
NVARCHAR
____________________________________________

5.0

1 Rows. -- 1974 msec.

</screen>
    </example>
  </refsect1>
  <refsect1 id="seealso_wsdl_import_udt">
    <title>See Also</title>
      <para>The <link linkend="udtcnsmsoap"></link> section.</para>
  </refsect1>
</refentry>