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> WSDL_IMPORT_UDT ('http://xml.redcoal.com/soapserver.dll/wsdl/ISoapServer', 'redcoal.sql');
</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: "http://xml.redcoal.com/soapserver.dll/wsdl/ISoapServer"
-- UDT class
drop type "ISOAPServerservice"
;
create type "ISOAPServerservice"
as
(
debug int default 0,
url varchar default 'http://xml.redcoal.com/soapserver.dll/soap/ISoapServer',
request varchar,
response varchar
)
-- Binding: "http://tempuri.org/:ISOAPServerbinding"
method "SendTextSMS"
(
"strInSerialNo" any,
"strInSMSKey" any,
"strInRecipients" any,
"strInMessageText" any,
"strInReplyEmail" any,
"strInOriginator" any,
"iInType" any,
"strOutMessageIDs" any,
"return" any
) returns any,
.... more methods follows ; do not supplied for brevity
method "RedWebServiceVersion"
(
"return" any
) returns any,
method style () returns any
;
-- Methods
create method "SendTextSMS"
(
in "strInSerialNo" any,
in "strInSMSKey" any,
in "strInRecipients" any,
in "strInMessageText" any,
in "strInReplyEmail" any,
in "strInOriginator" any,
in "iInType" any,
inout "strOutMessageIDs" any,
out "return" any
) for "ISOAPServerservice"
{
declare action, namespace, enc varchar;
declare style int;
declare _result, _body, xe any;
action := 'urn:SOAPServerImpl-ISOAPServer#SendTextSMS';
namespace := 'urn:SOAPServerImpl-ISOAPServer';
style := 0;
if (self.debug)
style := style + 2;
_result := SOAP_CLIENT (
url=>self.url,
operation=>'SendTextSMS',
soap_action=>action,
target_namespace=>namespace,
parameters=>vector
(
vector('strInSerialNo', 'http://www.w3.org/2001/XMLSchema:string'), "strInSerialNo" ,
vector('strInSMSKey', 'http://www.w3.org/2001/XMLSchema:string'), "strInSMSKey" ,
vector('strInRecipients', 'http://www.w3.org/2001/XMLSchema:string'), "strInRecipients" ,
vector('strInMessageText', 'http://www.w3.org/2001/XMLSchema:string'), "strInMessageText" ,
vector('strInReplyEmail', 'http://www.w3.org/2001/XMLSchema:string'), "strInReplyEmail" ,
vector('strInOriginator', 'http://www.w3.org/2001/XMLSchema:string'), "strInOriginator" ,
vector('iInType', 'http://www.w3.org/2001/XMLSchema:int'), "iInType" ,
vector('strOutMessageIDs', 'http://www.w3.org/2001/XMLSchema:string'), "strOutMessageIDs"
),
style=>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));
"strOutMessageIDs" := xml_cut (xpath_eval ('//strOutMessageIDs', xe, 1));
"strOutMessageIDs" := soap_box_xml_entity_validating ("strOutMessageIDs",
'http://www.w3.org/2001/XMLSchema:string', 0);
"return" := xml_cut (xpath_eval ('//return', xe, 1));
"return" := soap_box_xml_entity_validating ("return", 'http://www.w3.org/2001/XMLSchema:int', 0);
return _result;
}
;
.... more method definitions follows ; not supplied for brevity
create method "RedWebServiceVersion"
(
out "return" any
) for "ISOAPServerservice"
{
declare action, namespace, enc varchar;
declare style int;
declare _result, _body, xe any;
action := 'urn:SOAPServerImpl-ISOAPServer#RedWebServiceVersion';
namespace := 'urn:SOAPServerImpl-ISOAPServer';
style := 0;
if (self.debug)
style := style + 2;
_result := SOAP_CLIENT (
url=>self.url,
operation=>'RedWebServiceVersion',
soap_action=>action,
target_namespace=>namespace,
parameters=>vector
(
),
style=>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));
"return" := xml_cut (xpath_eval ('//return', xe, 1));
"return" := soap_box_xml_entity_validating ("return",
'http://www.w3.org/2001/XMLSchema:string', 0);
return _result;
}
;
</screen>
<para>This script, executed via the ISQL tool, or automatically if the 'exec' flag is set to 'true',
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 "ISOAPServerservice";
declare res nvarchar;
svc := new "ISOAPServerservice" ();
svc."RedWebServiceVersion" (res);
result_names (res);
result (res);
}
;
</screen>
<para>Which could have the following output:</para>
<screen>
SQL> 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>
|