www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Phrases
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
VAD
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
dav add & update fun...
dav lock manipulatio...
dav manipulation fun...
dav search functions
dav_exp
lfs_exp
serv_queue_top
urlrewrite_create_re...
user_key_load
vhost_define
vhost_remove
webdav users & group...
client_attr
connection_get
connection_id
connection_is_dirty
connection_set
connection_vars
connection_vars_set
dbname
ftp_get
ftp_ls
ftp_put
get_certificate_info
get_keyword
get_keyword_ucase
http
http_acl_get
http_acl_remove
http_acl_set
http_body_read
http_client
http_client_ext
http_client_ip
http_debug_log
http_enable_gz
http_file
http_flush
http_get
http_header
http_header_get
http_kill
http_listen_host
http_map_get
http_map_table
http_param
http_path
http_pending_req
http_physical_path
http_proxy
http_request_get
http_request_header
http_request_status
http_rewrite
http_root
http_url
http_value
http_xslt
ses_connect
ses_disconnect
ses_read_line
ses_write
tcpip_gethostbyaddr
tcpip_gethostbyname
vsp_calculate_digest
wsdl_import_udt
XML
XPATH & XQUERY

Functions Index

wsdl_import_udt

Returns a string containing a UDT definition
varchar WSDL_IMPORT_UDT (in url varchar, in f varchar, in exec any);
Description

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.

The returned definition can be saved to a file and/or executed automatically to provide instant access to the new UDT.

Note:

To save the file you must have an appropriate ACL defined.

Parameters
url – The URI of the target WSDL file to build a UDT definition of.
f – 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. The default value is NULL, which will not create a file.
exec – 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.
Return Types

This function returns the text of the UDT definition as a varchar.

Examples
Simple example of a WSDL driven UDT

Web Service proxy wrapper for Redcoal SMS SOAP interface:

SQL> WSDL_IMPORT_UDT ('http://xml.redcoal.com/soapserver.dll/wsdl/ISoapServer', 'redcoal.sql');   

This will create the following file on file system called redcoal.sql:

-- 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; 
} 
;

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:

create procedure
redcoaltest ()
{
  declare svc "ISOAPServerservice";
  declare res nvarchar;
  svc := new "ISOAPServerservice" ();
  svc."RedWebServiceVersion" (res);
  result_names (res);
  result (res);
}
;

Which could have the following output:

SQL> redcoaltest();
res
NVARCHAR
____________________________________________

5.0

1 Rows. -- 1974 msec.

See Also

The section.