Changes On Branch hao-option-inlineElementNS
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch hao-option-inlineElementNS Excluding Merge-Ins

This is equivalent to a diff from f52de14493 to 9e96c059eb

2017-12-04 20:51
New global option "inlineElementNS" to switch inline WSDL namespace prefixes. Document "WS::Client::SetOption". Extend both option procedures by a return of current dict. Tickets: [7140a6c07a], [dcce437d7a]. ::WS::Client package now version 2.4.5 check-in: 4bc013299a user: oehhar tags: trunk
2017-12-04 20:47
New global option "inlineElementNS" to switch inline WSDL namespace prefixes. Document "WS::Client::SetOption". Extend both option procedures by a return of current dict. Tickets: [7140a6c07a], [dcce437d7a] Closed-Leaf check-in: 9e96c059eb user: oehhar tags: hao-option-inlineElementNS
2017-11-28 15:43
Add option "inlineElementNS" - struggleing at the fact that there are no options available in the WSDL parsing phase. Tickets: [7140a6c07a], [dcce437d7a] check-in: 9592c7f1a4 user: oehhar tags: hao-option-inlineElementNS
2017-11-28 15:37
Two log optimizations "a $b" -> [list "a" $b] check-in: f52de14493 user: oehhar tags: trunk
2017-11-14 10:14
Reworked the webservice call option list documentation (so I understand it better) check-in: 63108ec92f user: oehhar tags: trunk

Changes to ClientSide.tcl.

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package require Tcl 8.4
package require WS::Utils 2.4 ; # dict, lassign
package require tdom 0.8
package require http 2
package require log
package require uri

package provide WS::Client 2.4.4

namespace eval ::WS::Client {
    # register https only if not yet registered
    if {[catch { http::unregister https } lPortCmd]} {
        # not registered -> register on my own
        if {[catch {
            package require tls







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package require Tcl 8.4
package require WS::Utils 2.4 ; # dict, lassign
package require tdom 0.8
package require http 2
package require log
package require uri

package provide WS::Client 2.4.5

namespace eval ::WS::Client {
    # register https only if not yet registered
    if {[catch { http::unregister https } lPortCmd]} {
        # not registered -> register on my own
        if {[catch {
            package require tls
113
114
115
116
117
118
119

120




















121
122
123
124
125
126
127
        genOutAttr {}
        valueAttrCompatiblityMode 1
        suppressNS {}
        useTypeNs {}
        nsOnChangeOnly {}
        noTargetNs 0
        errorOnRedefine 0

    }




















    set ::WS::Client::utilsOptionsList {
        UseNS
        parseInAttr
        genOutAttr
        valueAttrCompatiblityMode
        suppressNS
        useTypeNs







>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
        genOutAttr {}
        valueAttrCompatiblityMode 1
        suppressNS {}
        useTypeNs {}
        nsOnChangeOnly {}
        noTargetNs 0
        errorOnRedefine 0
        inlineElementNS 1
    }
    ##
    ## List of options which are copied to the service array
    ##
    set ::WS::Client::serviceLocalOptionsList {
        skipLevelWhenActionPresent
        skipLevelOnReply
        skipHeaderLevel
        suppressTargetNS
        allowOperOverloading
        contentType
        UseNS
        parseInAttr
        genOutAttr
        valueAttrCompatiblityMode
        suppressNS
        useTypeNs
        nsOnChangeOnly
        noTargetNs
    }

    set ::WS::Client::utilsOptionsList {
        UseNS
        parseInAttr
        genOutAttr
        valueAttrCompatiblityMode
        suppressNS
        useTypeNs
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
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::SetOption
#
# Description : Set or get an option


#
# Arguments :





#       option  - Option to be set/retrieved

#       args    - Value to set the option to

#
# Returns : The value of the option
#
# Side-Effects :        None
#
# Exception Conditions :        None
#
# Pre-requisite Conditions :    None
#
# Original Author : Gerald W. Lester
#
#>>END PUBLIC<<
#
# Maintenance History - as this file is modified, please be sure that you
#                       update this segment of the file header block by
#                       adding a complete entry at the bottom of the list.
#
# Version     Date     Programmer   Comments / Changes / Reasons
# -------  ----------  ----------   -------------------------------------------
#       1  04/272009   G.Lester     Initial version





###########################################################################
proc ::WS::Client::SetOption {option args} {
    variable options




    if {[info exists options($option)]} {
        if {[llength $args] == 0} {











            return $options($option)
        } elseif {[llength $args] == 1} {



            set options($option) [lindex $args 0]

        } else {





            return  -code error \
                    -errorcode [list WS CLIENT INVALDCNT $args] \





                    "Invalid number of values: '$args'"
        }


    } else {


        return  -code error \
                -errorcode [list WS CLIENT UNKOPT $option] \
                "Uknown option: '$option'"


















    }
}

###########################################################################
#
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.







|
>
>


>
>
>
>
>

>

>




















>
>
>
>
>

|

>
>
>
|
|
|
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
|
>
|
>
>
>
>
>
|
<
>
>
>
>
>
|

>
>
|
>
>


|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::SetOption
#
# Description : Set or get file global or default option.
#               Global option control the service creation process.
#               Default options are takren as defaults to new created services.
#
# Arguments :
#       -globalonly
#               - Return list of global options/values
#       -defaultonly
#               - Return list of default options/values
#       --
#       option  - Option to be set/retrieved
#                 Return all option/values if omitted
#       args    - Value to set the option to
#                 Return the value if not given
#
# Returns : The value of the option
#
# Side-Effects :        None
#
# Exception Conditions :        None
#
# Pre-requisite Conditions :    None
#
# Original Author : Gerald W. Lester
#
#>>END PUBLIC<<
#
# Maintenance History - as this file is modified, please be sure that you
#                       update this segment of the file header block by
#                       adding a complete entry at the bottom of the list.
#
# Version     Date     Programmer   Comments / Changes / Reasons
# -------  ----------  ----------   -------------------------------------------
#       1  04/272009   G.Lester     Initial version
#   2.4.5  2017-12-04  H.Oehlmann   Return all current options if no argument
#                                   given. Options -globalonly or -defaultonly
#                                   limit this to options which are (not)
#                                   copied to the service.
#                                   
###########################################################################
proc ::WS::Client::SetOption {args} {
    variable options
    variable serviceLocalOptionsList
    if {0 == [llength $args]} {
        return [array get options]
    }
    set args [lassign $args option]
    
    switch -exact -- $option {
        -globalonly {
            ##
            ## Return list of global options
            ##
            set res {}
            foreach option [array names options] {
                if {$option ni $serviceLocalOptionsList} {
                    lappend res $option $options($option)
                }
            }
            return $res

        }
        -defaultonly {
            ##
            ## Return list of default options
            ##
            set res {}
            foreach option [array names options] {
                if {$option in $serviceLocalOptionsList} {
                    lappend res $option $options($option)
                }
            }
            return $res

        }
        -- {
            ##
            ## End of options
            ##
            set args [lassign $args option]
        }
    }
    ##
    ## Check if given option exists
    ##
    if {![info exists options($option)]} {
        return  -code error \
                -errorcode [list WS CLIENT UNKOPT $option] \
                "Unknown option: '$option'"
    }
    ##
    ## Check if value is given
    ##
    switch -exact -- [llength $args] {
        0 {
            return $options($option)
        }
        1 {
            set value [lindex $args 0]
            set options($option) $value
            return $value
        }
        default {
            return  -code error \
                    -errorcode [list WS CLIENT INVALDCNT $args] \
                    "To many parameters: '$args'"
        }
    }
}

###########################################################################
#
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
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
# Maintenance History - as this file is modified, please be sure that you
#                       update this segment of the file header block by
#                       adding a complete entry at the bottom of the list.
#
# Version     Date     Programmer   Comments / Changes / Reasons
# -------  ----------  ----------   -------------------------------------------
#       1  04/14/2009  G.Lester     Initial version
#


#
###########################################################################
proc ::WS::Client::CreateService {serviceName type url target args} {
    variable serviceArr
    variable options


    if {$options(errorOnRedefine) && [info exists serviceArr($serviceName)]} {
        return -code error "Service '$serviceName' already exists"
    } elseif {[info exists serviceArr($serviceName)]} {
        unset serviceArr($serviceName)
    }

    dict set serviceArr($serviceName) types {}
    dict set serviceArr($serviceName) operList {}
    dict set serviceArr($serviceName) objList {}
    dict set serviceArr($serviceName) headers {}
    dict set serviceArr($serviceName) targetNamespace tns1 $target
    dict set serviceArr($serviceName) name $serviceName
    dict set serviceArr($serviceName) location $url
    dict set serviceArr($serviceName) style $type
    dict set serviceArr($serviceName) imports {}
    dict set serviceArr($serviceName) inTransform {}
    dict set serviceArr($serviceName) outTransform {}
    foreach item [array names options] {
        dict set serviceArr($serviceName) $item $options($item)
    }
    foreach {name value} $args {
        set name [string trimleft $name {-}]
        dict set serviceArr($serviceName) $name $value
    }








|
>
>





>


















|







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# Maintenance History - as this file is modified, please be sure that you
#                       update this segment of the file header block by
#                       adding a complete entry at the bottom of the list.
#
# Version     Date     Programmer   Comments / Changes / Reasons
# -------  ----------  ----------   -------------------------------------------
#       1  04/14/2009  G.Lester     Initial version
# 2.4.5    2017-12-04  H.Oehlmann   Use distinct list of option items, which are
#                                   copied to the service array. Not all options
#                                   are used in the service array.
#
###########################################################################
proc ::WS::Client::CreateService {serviceName type url target args} {
    variable serviceArr
    variable options
    variable serviceLocalOptionsList

    if {$options(errorOnRedefine) && [info exists serviceArr($serviceName)]} {
        return -code error "Service '$serviceName' already exists"
    } elseif {[info exists serviceArr($serviceName)]} {
        unset serviceArr($serviceName)
    }

    dict set serviceArr($serviceName) types {}
    dict set serviceArr($serviceName) operList {}
    dict set serviceArr($serviceName) objList {}
    dict set serviceArr($serviceName) headers {}
    dict set serviceArr($serviceName) targetNamespace tns1 $target
    dict set serviceArr($serviceName) name $serviceName
    dict set serviceArr($serviceName) location $url
    dict set serviceArr($serviceName) style $type
    dict set serviceArr($serviceName) imports {}
    dict set serviceArr($serviceName) inTransform {}
    dict set serviceArr($serviceName) outTransform {}
    foreach item $serviceLocalOptionsList {
        dict set serviceArr($serviceName) $item $options($item)
    }
    foreach {name value} $args {
        set name [string trimleft $name {-}]
        dict set serviceArr($serviceName) $name $value
    }

272
273
274
275
276
277
278
279


280

281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302



303
304
305
306
307

308
309
310
311



312




















313
314
315

316
317
318
319




320


321



322

323
324
325
326
327
328
329
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::Config
#
# Description : Configure a service information
#
# Arguments :
#       serviceName - Service name to add namespace to


#       item        - The item to configure

#       value       - Optional, the new value
#
# Returns :     The value of the option
#
# Side-Effects :        None
#
# Exception Conditions :        None
#
# Pre-requisite Conditions :    None
#
# Original Author : Gerald W. Lester
#
#>>END PUBLIC<<
#
# Maintenance History - as this file is modified, please be sure that you
#                       update this segment of the file header block by
#                       adding a complete entry at the bottom of the list.
#
# Version     Date     Programmer   Comments / Changes / Reasons
# -------  ----------  ----------   -------------------------------------------
#       1  04/14/2009  G.Lester     Initial version
#



#
###########################################################################
proc ::WS::Client::Config {serviceName item {value {}}} {
    variable serviceArr
    variable options


    set serviceInfo $serviceArr($serviceName)
    set validOptionList [array names options]
    lappend validOptionList location targetNamespace



    if {[lsearch -exact $validOptionList $item] == -1} {




















        return -code error "Uknown option '$item' -- must be one of: [join $validOptionList {, }]"
    }


    if {$value ne {}} {
        dict set serviceInfo $item $value
        set serviceArr($serviceName) $serviceInfo
    }







    return [dict get $serviceInfo $item]





}

###########################################################################
#
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#







|
>
>
|
>
|

|


















|
>
>
>


|


>

<
|

>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
|
<
|
|
>
>
>
>
|
>
>
|
>
>
>
|
>







358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432

433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::Config
#
# Description : Configure a service information
#
# Arguments :
#       serviceName - Service name to add namespace to.
#                     Return a list of items/values of default options if not
#                     given.
#       item        - The item to configure. Return a list of all items/values
#                     if not given.
#       value       - Optional, the new value. Return the value, if not given.
#
# Returns :     The value of the option or a list of item/value pairs.
#
# Side-Effects :        None
#
# Exception Conditions :        None
#
# Pre-requisite Conditions :    None
#
# Original Author : Gerald W. Lester
#
#>>END PUBLIC<<
#
# Maintenance History - as this file is modified, please be sure that you
#                       update this segment of the file header block by
#                       adding a complete entry at the bottom of the list.
#
# Version     Date     Programmer   Comments / Changes / Reasons
# -------  ----------  ----------   -------------------------------------------
#       1  04/14/2009  G.Lester     Initial version
#   2.4.5  2017-12-04  H.Oehlmann   Allow to set an option to the empty string.
#                                   Return all option/values, if called without
#                                   item. Return default items/values if no
#                                   service given.
#
###########################################################################
proc ::WS::Client::Config {args} {
    variable serviceArr
    variable options
    variable serviceLocalOptionsList


    set validOptionList $serviceLocalOptionsList
    lappend validOptionList location targetNamespace
    
    if {0 == [llength $args]} {
        set res {}
        foreach item $validOptionList {
            lappend res $item
            if {[info exists options($item)]} {
                lappend res $options($item)
            } else {
                lappend res {}
            }
        }
        return $res
    }    
    set args [lassign $args serviceName]
    if {0 == [llength $args]} {
        set res {}
        foreach item $validOptionList {
            lappend res $item [dict get $serviceArr($serviceName) $item]
        }
        return $res
    }
    
    set args [lassign $args item]
    if { $item ni $validOptionList } {
        return -code error "Uknown option '$item' -- must be one of: [join $validOptionList {, }]"
    }

    switch -exact -- [llength $args] {
        0 {

            return [dict get $serviceArr($serviceName) $item]
        }
        1 {
            set value [lindex $args 0]
            dict set serviceArr($serviceName) $item  $value
            return $value
        }
        default {
            ::log::log debug "To many arguments arguments {$args}"
            return \
                -code error \
                -errorcode [list WS CLIENT INVARGCNT $args] \
                "To many arguments '$args'"
        }
    }
}

###########################################################################
#
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
993
994
995
996
997
998
999
1000

1001
1002
1003
1004
1005

1006
1007
1008
1009
1010
1011
1012
#                                   solution by Wolfgang Winkler:
#                                   Search namespace prfix also in element
#                                   nodes and not only in definition node
#                                   of wsdl file.
# 2.4.4    2017-11-06  H.Oehlmann   Added check (for nested namespace prefix
#                                   case), that a namespace prefix is not
#                                   reused for another URI.
#

#
###########################################################################
proc ::WS::Client::ParseWsdl {wsdlXML args} {
    variable currentBaseUrl
    variable serviceArr


    array set defaults {
        -createStubs    0
        -headers        {}
        -serviceAlias   {}
    }








|
>





>







1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
#                                   solution by Wolfgang Winkler:
#                                   Search namespace prfix also in element
#                                   nodes and not only in definition node
#                                   of wsdl file.
# 2.4.4    2017-11-06  H.Oehlmann   Added check (for nested namespace prefix
#                                   case), that a namespace prefix is not
#                                   reused for another URI.
# 2.4.5    2017-11-24  H.Oehlmann   Added option "inlineElementNS" to activate
#                                   namespace definition search in element nodes
#
###########################################################################
proc ::WS::Client::ParseWsdl {wsdlXML args} {
    variable currentBaseUrl
    variable serviceArr
    variable options

    array set defaults {
        -createStubs    0
        -headers        {}
        -serviceAlias   {}
    }

1056
1057
1058
1059
1060
1061
1062




1063
1064


1065
1066
1067






1068


1069
1070
1071
1072
1073
1074
1075
    $wsdlDoc selectNodesNamespaces {
        w http://schemas.xmlsoap.org/wsdl/
        d http://schemas.xmlsoap.org/wsdl/soap/
        xs http://www.w3.org/2001/XMLSchema
    }

    ##




    ## loop over the top definitions node and all elements nodes
    ##


    # Element nodes may declare namespaces inline like:
    # <xs:element xmlns:q1="myURI" type="q1:MessageQ1"/>
    # ticket [dcce437d7a]






    foreach elemNode [linsert [$wsdlDoc selectNodes {//xs:element}] 0 $wsdlNode] {


        # Get list of xmlns attributes
        # This list looks for the example like: {{q1 q1 {}} ... }
        set xmlnsAttributes [$elemNode attributes xmlns:*] 
        # Loop over found namespaces
        foreach itemList $xmlnsAttributes {
            set ns [lindex $itemList 0]
            set url [$elemNode getAttribute xmlns:$ns]







>
>
>
>
|

>
>
|
|
|
>
>
>
>
>
>
|
>
>







1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
    $wsdlDoc selectNodesNamespaces {
        w http://schemas.xmlsoap.org/wsdl/
        d http://schemas.xmlsoap.org/wsdl/soap/
        xs http://www.w3.org/2001/XMLSchema
    }

    ##
    ## build list of namespace definition nodes
    ##
    ## the top node is always used
    set NSDefinitionNodeList [list $wsdlNode]
    
    ##
    ## get namespace definitions in element nodes
    ##
    ## Element nodes may declare namespaces inline like:
    ## <xs:element xmlns:q1="myURI" type="q1:MessageQ1"/>
    ## ticket [dcce437d7a]
    
    # This is only done, if option inlineElementNS is set in the default
    # options. Service dependent options may not be used at this stage,
    # as serviceArr is not created jet (Client::Config will fail) and the
    # service name is not known jet.
    if {$options(inlineElementNS)} {
        lappend NSDefinitionNodeList {*}[$wsdlDoc selectNodes {//xs:element}]
    }
    foreach elemNode $NSDefinitionNodeList {
        # Get list of xmlns attributes
        # This list looks for the example like: {{q1 q1 {}} ... }
        set xmlnsAttributes [$elemNode attributes xmlns:*] 
        # Loop over found namespaces
        foreach itemList $xmlnsAttributes {
            set ns [lindex $itemList 0]
            set url [$elemNode getAttribute xmlns:$ns]

Changes to docs/Calling_a_Web_Service.html.

296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
</PRE>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>serviceName</I>     - The service to create stubs for
</PRE>
<P><B>Returns&nbsp;: A string describing the created procedures.</B> </P>
<P><B>Side-Effects&nbsp;: Existing namespace is deleted.</B> </P>
<P><B>Exception Conditions&nbsp;: None</B> </P>
<P><B>Pre-requisite Conditions&nbsp;: Service must have been defined.</B> </P>
<HR>

<A name=Synchronous_Call_returning_the_raw_XML></A>
<H2>Synchronous Call returning the raw XML </H2>
<P><B>Procedure Name&nbsp;: <I>::WS::Client::DoRawCall</I></B> </P>
<P><B>Description&nbsp;: Call an operation of a web service</B> </P>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>serviceName</I>     - The name of the Webservice
     <I>operationName</I>   - The name of the Operation to call







|







296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
</PRE>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>serviceName</I>     - The service to create stubs for
</PRE>
<P><B>Returns&nbsp;: A string describing the created procedures.</B> </P>
<P><B>Side-Effects&nbsp;: Existing namespace is deleted.</B> </P>
<P><B>Exception Conditions&nbsp;: None</B> </P>
<P><B>Pre-requisite Conditions&nbsp;: Service must have been defined.</B> </P>
<HR />

<A name=Synchronous_Call_returning_the_raw_XML></A>
<H2>Synchronous Call returning the raw XML </H2>
<P><B>Procedure Name&nbsp;: <I>::WS::Client::DoRawCall</I></B> </P>
<P><B>Description&nbsp;: Call an operation of a web service</B> </P>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>serviceName</I>     - The name of the Webservice
     <I>operationName</I>   - The name of the Operation to call
321
322
323
324
325
326
327

328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345

346
347
348



































349
350
351
352
353

354



355



356
357
358
359
360

361
362
363

364
365
366



367
368

















369
370



371
372
373
374
375
376
377
<P><B>Returns&nbsp;:</B> </P><PRE>     The XML of the operation.
</PRE>
<P><B>Side-Effects&nbsp;: None</B> </P>
<P><B>Exception Conditions&nbsp;:</B> </P><PRE>     <B>WSCLIENT HTTPERROR</B>      - if an HTTP error occured
</PRE>
<P><B>Pre-requisite Conditions&nbsp;: Service must have been defined.</B> </P>



<p><a name="Template"></a>
</p><h2>Generating a Template Dictionary</h2>
<p><b>Procedure Name&nbsp;: <i>::WS::Utils::GenerateTemplateDict</i></b> </p>
<p><b>Description&nbsp;: Generate a template dictionary object for a given type.</b> </p>
<p><b>Arguments&nbsp;:</b> </p>
<pre>
     <i>mode</i>            - The mode, <b>Client</b> or <b>Server</b>
     <i>serviceName</i>     - The name of the Webservice
     <i>type</i>            - The name of the type
     <i>arraySize</i>       - Number of elements to generate in an array.  Default is 2
<ul>
</pre>
<p><b>Returns&nbsp;:</b> </p><pre>A dictionary object for a given type.  If any circular references exist, they will have the value of &lt;** Circular Reference **&gt;
<p><b>Side-Effects&nbsp;: None</b> </p>
<p><b>Exception Conditions&nbsp;&nbsp;: None</b> </p>
<p><b>Pre-requisite Conditions&nbsp;: Service must have been defined.</b> </p></pre><p></p>



<p><a name="Config"></a>
</p><h2>Configuring a Service </h2>



































<p><b>Procedure Name&nbsp;: <i>::WS::Client::Config</i></b> </p>
<p><b>Description&nbsp;: Configure a service's information</b> </p>
<p><b>Arguments&nbsp;:</b> </p>
<pre>
     <i>serviceName</i>     - The name of the Webservice

     <i>item</i>   - The item to configure.  Must be one of



</pre>



<ul>
<li><pre>allowOperOverloading</pre>
	<p>An overloaded operation is an operation with the same name but different  may exist with different input parameter sets.</p>
	<p>This option throws an error, if a WSDL is parsed with an overloaded operation.</p>
	Default: 1</li>

<li><pre>contentType</pre>
	The http content type of the http request sent to call the web service.<br />
	Default: "text/xml;charset=utf-8"</li>

<li><pre>errorOnRedefine</pre>
	Throw an error, if a service is created (CreateService etc) for an already existing service.<br />
	Default value: 0</li>



<li><pre>genOutAttr</pre>
	generate attributes on outbound tags, see <A HREF="Using_Options.html#genOutAttr">here</A> for details</li>

















<li><pre>location</pre>
	The URL of the service. This is initialized on the value in the WSDL file, when the WSDL file is parsed. The value may be overwritten setting this option.</li>



<li><pre>noTargetNs</pre>
	The target namespace URI is normally included twice in the envelope of the webservice call:<br />
	<pre>
&lt;SOAP-ENV:Envelope
	...
	xmlns="http://targeturi.org/"
	xmlns:tns1="http://targeturi.org/"







>


















>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|


|
>
|
>
>
>

>
>
>





>



>

|
|
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
>
>
>







321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<P><B>Returns&nbsp;:</B> </P><PRE>     The XML of the operation.
</PRE>
<P><B>Side-Effects&nbsp;: None</B> </P>
<P><B>Exception Conditions&nbsp;:</B> </P><PRE>     <B>WSCLIENT HTTPERROR</B>      - if an HTTP error occured
</PRE>
<P><B>Pre-requisite Conditions&nbsp;: Service must have been defined.</B> </P>

<HR />

<p><a name="Template"></a>
</p><h2>Generating a Template Dictionary</h2>
<p><b>Procedure Name&nbsp;: <i>::WS::Utils::GenerateTemplateDict</i></b> </p>
<p><b>Description&nbsp;: Generate a template dictionary object for a given type.</b> </p>
<p><b>Arguments&nbsp;:</b> </p>
<pre>
     <i>mode</i>            - The mode, <b>Client</b> or <b>Server</b>
     <i>serviceName</i>     - The name of the Webservice
     <i>type</i>            - The name of the type
     <i>arraySize</i>       - Number of elements to generate in an array.  Default is 2
<ul>
</pre>
<p><b>Returns&nbsp;:</b> </p><pre>A dictionary object for a given type.  If any circular references exist, they will have the value of &lt;** Circular Reference **&gt;
<p><b>Side-Effects&nbsp;: None</b> </p>
<p><b>Exception Conditions&nbsp;&nbsp;: None</b> </p>
<p><b>Pre-requisite Conditions&nbsp;: Service must have been defined.</b> </p></pre><p></p>

<HR />

<p><a name="Config"></a>
</p><h2>Configuring a Service </h2>

There are two procedures to configure a service:
<ul>
	<li>::WS::Client::SetOption</li>
	<li>::WS::Client::Config</li>
</ul>

<p>The first procedure contains the default options of the package.
The default options are used on service creation and are then copied to the service.</p>

<p>The second procedure contains the options of each service.
They are copied on service creation from the default options.</p>

<p>Most option items may be accessed by both functions.
Some options are only used on service creation phase, which do not exist as service option.
Other options do not exist as default option, as they are initialized from the WSDL file.</p>

<p>In the following, first the two access routines are described.
Then, a list of options for both functions are given, with remarks, if they are only valid for one of the two procedures.</p>

<p><b>Procedure Name&nbsp;: <i>::WS::Client::SetOption</i></b> </p>
<p><b>Description&nbsp;: Get or set the default options of the package</b> </p>
<p><b>Arguments&nbsp;:</b> </p>
<pre>
     <i>-globalonly</i>   - Return a list of global-only options and their values.
     <i></i>                Global-only options are not copied to the service.
     <i>-defaultonly</i>  - Return a list of default-only options and their values.
     <i></i>                default-only options are copied to the service.
     <i>--</i>            - End of options
     <i>item</i>          - The option item to get or configure.
     <i></i>                Return a list of all item/value pairs if ommitted. 
     <i>value</i>         - The value to set the option item to.
     <i></i>                Return current value if omitted.
</pre>

<p><b>Procedure Name&nbsp;: <i>::WS::Client::Config</i></b> </p>
<p><b>Description&nbsp;: Get or set the options local to a service definition</b> </p>
<p><b>Arguments&nbsp;:</b> </p>
<pre>
     <i>serviceName</i> - The name of the Webservice.
     <i></i>              Return a list of default items/values paires if not given.
     <i>item</i>        - The option item to get or configure.
     <i></i>              Return a list of all item/value pairs, if not given. 
     <i>value</i>       - The value to set the option item to.
     <i></i>              Return current value if omitted.
</pre>

<p><b>Option List:</b> </p>

<ul>
<li><pre>allowOperOverloading</pre>
	<p>An overloaded operation is an operation with the same name but different  may exist with different input parameter sets.</p>
	<p>This option throws an error, if a WSDL is parsed with an overloaded operation.</p>
	Default: 1</li>

<li><pre>contentType</pre>
	The http content type of the http request sent to call the web service.<br />
	Default: "text/xml;charset=utf-8"</li>

<li><pre>errorOnRedefine</pre>
	<p>Throw an error, if a service is created (CreateService etc) for an already existing service.</p>
	<p>Default value: 0</p>
	<p>This item may not be used with <i>::WS::Client::Config</i>.</p>
	</li>

<li><pre>genOutAttr</pre>
	generate attributes on outbound tags, see <A HREF="Using_Options.html#genOutAttr">here</A> for details</li>

<li><pre>inlineElementNS</pre>
	<p>Namespace prefixes for types may be defined within the WSDL root element.</p>
	<p>This item may not be used with <i>::WS::Client::Config</i>.</p>
	<p>Activate this option, to also search namespace prefixes in the type definition.
	As those are seen as global prefixes, there might be a double-used prefix which will cause a processing error, if different URI's are assigned.</p>

	<p>The error would be caused by a WSDL as follows</p>
	<pre>
	&lt;wsdl:definitions targetNamespace="http://www.webserviceX.NET/"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/
		xmlns:q1="myURI1"
		...&gt;
	    ...
	    &lt;xs:element xmlns:q1="myURI2" type="q1:MessageQ1"/&gt;
	</pre>
	</li>
<li><pre>location</pre>
	<p>The URL of the service. This is initialized on the value in the WSDL file, when the WSDL file is parsed. The value may be overwritten setting this option.</p>
	<p>This item may not be used with <i>::WS::Client::SetOption</i>.</p>
	</li>

<li><pre>noTargetNs</pre>
	The target namespace URI is normally included twice in the envelope of the webservice call:<br />
	<pre>
&lt;SOAP-ENV:Envelope
	...
	xmlns="http://targeturi.org/"
	xmlns:tns1="http://targeturi.org/"
423
424
425
426
427
428
429
430


431
432
433
434
435
436
437
	Derived from options.
	<br />Internally, this option sets the option "suppressNS" to "tns1".
	<br />This option was set to call a service published by SAP.
	<br />This option made a call to a certain MS Web Service fail with the error message: "Input parameter 'Parameter1' can not be NULL or Empty.". 
	<br />Default is 0 (do not suppress).
	</li>
<li><pre>targetNamespace (default: empty string)</pre>
	the target namespace of the service, derived from the WSDL.</li>


<li><pre>UseNS (default: empty string)</pre>
	See <A HREF="Using_Options.html#UseNS">here</A>
	</li>
<li><pre>useTypeNS (default: empty string)</pre>
	use type's namespace prefix as prefix of elements</li>
<li><pre>valueAttrCompatiblityMode (default: 1)</pre>
	If this and genOutAttr/parseInAttr are set, then values are specified in the dictionary as {}.  Otherwise if genOutAttr/parseInAttr is set this is not set, then the values are specified in the dictionary as ::value.</li>







|
>
>







492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
	Derived from options.
	<br />Internally, this option sets the option "suppressNS" to "tns1".
	<br />This option was set to call a service published by SAP.
	<br />This option made a call to a certain MS Web Service fail with the error message: "Input parameter 'Parameter1' can not be NULL or Empty.". 
	<br />Default is 0 (do not suppress).
	</li>
<li><pre>targetNamespace (default: empty string)</pre>
	<p>the target namespace of the service, derived from the WSDL.</p>
	<p>This item may not be used with <i>::WS::Client::SetOption</i>.</p>
	</li>
<li><pre>UseNS (default: empty string)</pre>
	See <A HREF="Using_Options.html#UseNS">here</A>
	</li>
<li><pre>useTypeNS (default: empty string)</pre>
	use type's namespace prefix as prefix of elements</li>
<li><pre>valueAttrCompatiblityMode (default: 1)</pre>
	If this and genOutAttr/parseInAttr are set, then values are specified in the dictionary as {}.  Otherwise if genOutAttr/parseInAttr is set this is not set, then the values are specified in the dictionary as ::value.</li>

Changes to pkgIndex.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex -direct" command
# and sourced either when an application starts up or
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded WS::AOLserver 2.4.0 [list source [file join $dir AOLserver.tcl]]
package ifneeded WS::Channel 2.4.0 [list source [file join $dir ChannelServer.tcl]]
package ifneeded WS::Client 2.4.4 [list source [file join $dir ClientSide.tcl]]
package ifneeded WS::Embeded 2.4.0 [list source [file join $dir Embedded.tcl]]
package ifneeded WS::Server 2.4.0 [list source [file join $dir ServerSide.tcl]]
package ifneeded WS::Utils 2.4.0 [list source [file join $dir Utilities.tcl]]
package ifneeded WS::Wub 2.4.0 [list source [file join $dir WubServer.tcl]]
package ifneeded Wsdl 2.4.0 [list source [file join $dir WubServer.tcl]]













|





|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex -direct" command
# and sourced either when an application starts up or
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded WS::AOLserver 2.4.0 [list source [file join $dir AOLserver.tcl]]
package ifneeded WS::Channel 2.4.0 [list source [file join $dir ChannelServer.tcl]]
package ifneeded WS::Client 2.4.5 [list source [file join $dir ClientSide.tcl]]
package ifneeded WS::Embeded 2.4.0 [list source [file join $dir Embedded.tcl]]
package ifneeded WS::Server 2.4.0 [list source [file join $dir ServerSide.tcl]]
package ifneeded WS::Utils 2.4.0 [list source [file join $dir Utilities.tcl]]
package ifneeded WS::Wub 2.4.0 [list source [file join $dir WubServer.tcl]]
package ifneeded Wsdl 2.4.0 [list source [file join $dir WubServer.tcl]]
package ifneeded http 2.8.12 [list source [file join $dir http-2.8.12.tcl]]