Check-in [9592c7f1a4]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

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

Overview
Comment:Add option "inlineElementNS" - struggleing at the fact that there are no options available in the WSDL parsing phase. Tickets: [7140a6c07a], [dcce437d7a]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | hao-option-inlineElementNS
Files: files | file ages | folders
SHA3-256:9592c7f1a48c2e3d5ccc6f8ed0b6e331e82d676da7f79647a8e317b9a84086e9
User & Date: oehhar 2017-11-28 15:43:30
Original Comment: Add option "inlineElementNS" - struggleing at the fact that there are no options available in the WSDL parsing phase
References
2017-11-28 17:11 New ticket [7140a6c07a]: ClientSide: Options not available on WSDL parsing phase plus 3 other changes artifact: 53e85bbe93 user: oehhar
2017-11-28 16:18 New ticket [7140a6c07a]. artifact: 7243c489ba user: oehhar
Context
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ClientSide.tcl.

113
114
115
116
117
118
119

120
121
122
123
124
125
126
...
318
319
320
321
322
323
324























































325
326
327
328
329
330
331
...
993
994
995
996
997
998
999
1000

1001
1002
1003
1004
1005

1006
1007
1008
1009
1010
1011
1012
....
1056
1057
1058
1059
1060
1061
1062
1063
1064






1065
1066
1067












1068


1069
1070
1071
1072
1073
1074
1075
        genOutAttr {}
        valueAttrCompatiblityMode 1
        suppressNS {}
        useTypeNs {}
        nsOnChangeOnly {}
        noTargetNs 0
        errorOnRedefine 0

    }
    set ::WS::Client::utilsOptionsList {
        UseNS
        parseInAttr
        genOutAttr
        valueAttrCompatiblityMode
        suppressNS
................................................................................
        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.
#
#>>BEGIN PUBLIC<<
#
................................................................................
#                                   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   {}
    }

................................................................................
    $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]







>







 







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







 







|
>





>







 







|

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







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
319
320
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
....
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
....
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
        genOutAttr {}
        valueAttrCompatiblityMode 1
        suppressNS {}
        useTypeNs {}
        nsOnChangeOnly {}
        noTargetNs 0
        errorOnRedefine 0
        inlineElementNS 1
    }
    set ::WS::Client::utilsOptionsList {
        UseNS
        parseInAttr
        genOutAttr
        valueAttrCompatiblityMode
        suppressNS
................................................................................
        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.
#
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::DefaultConfig
#
# Description : Gets or sets a default config value
#               Does not work for options common with the service part.
#
# Arguments :
#       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
# -------  ----------  ----------   -------------------------------------------
# 2.4.4    2017-11-24  H.Oehlmann   Initial version.
#   
###########################################################################
proc ::WS::Client::DefaultConfig {operation item {value {}}} {
    variable serviceArr
    variable options

    if {$operation eq "listoptions"} {
        return [array names options]
    }
    if {![info exists options($item)]} {
        return -code error "Uknown option '$item' -- must be one of: [join [array names options] {, }]"
    }
    if {$operation eq "set"} {
        set options($item) $value
    }
    if {$operation ne "get"} {
        return -code error "Unknown operation '$operation' -- must be one of listoptions, get, set"
    }
    return $options($item)
}
###########################################################################
#
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
#>>BEGIN PUBLIC<<
#
................................................................................
#                                   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.4    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   {}
    }

................................................................................
    $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.
    # To get the option is not so easy at this stage, as the service name
    # is not known jet. So, only take it, if a service alias is given.
    if {    [info exists serviceArr($defaults(-serviceAlias))]
            && [dict exists $serviceArr($defaults(-serviceAlias)) inlineElementNS]
    } {
        set inlineElementNS [dict get $serviceArr($defaults(-serviceAlias)) inlineElementNS]
    } else {
        set inlineElementNS $options(inlineElementNS)
    }
    if {$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]