Check-in [1915e65746]
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 [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Search namespace prefix also in element nodes and not only in definition node of wsdl file. Patch by by Wolfgang Winkler. Ticket [dcce437d7a]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1915e65746eeea72e60674745e509753673da22986cc8f4fb955c412e87c3fcc
User & Date: oehhar 2017-11-03 16:00:30
References
2017-11-03 16:07 Closed ticket [dcce437d7a]: Allow inline namespaces in WSDL plus 2 other changes artifact: 7c6bd816e0 user: oehhar
Context
2017-11-06 08:20
Added check (for nested namespace prefix case), that a namespace prefix is not reused for another URI. See Ticket [dcce437d7a] check-in: fb182ca3fc user: oehhar tags: trunk
2017-11-03 16:00
Search namespace prefix also in element nodes and not only in definition node of wsdl file. Patch by by Wolfgang Winkler. Ticket [dcce437d7a] check-in: 1915e65746 user: oehhar tags: trunk
2017-11-03 15:51
Documentation and formatting, Client.tcl now version 2.4.4 Closed-Leaf check-in: e11e603f89 user: oehhar tags: rfe-dcce437d7aa5e64a
2017-11-03 15:27
Wrong } nesting in comment check-in: 3632fc3da6 user: oehhar tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ClientSide.tcl.

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
985
986
987
988
989
990
991





992
993
994
995
996
997
998
....
1039
1040
1041
1042
1043
1044
1045
1046
















1047


1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
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.3

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
................................................................................
# 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  07/06/2006  G.Lester     Initial version





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

................................................................................
    #   - xs: http://www.w3.org/2001/XMLSchema
    #
    # The top node <wsdl:definitions
    #   targetNamespace="http://www.webserviceX.NET/">
    #   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/ ...>
    # contains the target namespace and all namespace definitions
    dict set nsDict url $targetNs tns$nsCount
    # returns {{wsdl wsdl {}} ....} for the upper example.
















    foreach itemList [$wsdlNode attributes xmlns:*] {


        set ns [lindex $itemList 0]
        set url [$wsdlNode getAttribute xmlns:$ns]
        if {[dict exists $nsDict url $url]} {
            set tns [dict get $nsDict url $url]
        } else {
            ##
            ## Check for hardcoded namespaces
            ##
            switch -exact -- $url {
                http://schemas.xmlsoap.org/wsdl/ {
                    set tns w
                }
                http://schemas.xmlsoap.org/wsdl/soap/ {
                    set tns d
                }
                http://www.w3.org/2001/XMLSchema {
                    set tns xs
                }
                default {
                    set tns tns[incr nsCount]
                }
            }
            dict set nsDict url $url $tns
        }
        dict set nsDict tns $ns $tns
    }
    
    set ::d $nsDict
    $wsdlDoc selectNodesNamespaces {
        w http://schemas.xmlsoap.org/wsdl/
        d http://schemas.xmlsoap.org/wsdl/soap/
        xs http://www.w3.org/2001/XMLSchema
    }

    if {[info exists currentBaseUrl]} {
        set url $currentBaseUrl
    } else {
        set url $targetNs
    }







|







 







>
>
>
>
>







 







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







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
....
1044
1045
1046
1047
1048
1049
1050

1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096






1097
1098
1099
1100
1101
1102
1103
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
................................................................................
# 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  07/06/2006  G.Lester     Initial version
# 2.4.4    2017-11-03  H. Oehlmann  Included ticket [dcce437d7a] with
#                                   solution by Wolfgang Winkler:
#                                   Search namespace prfix also in element
#                                   nodes and not only in definition node
#                                   of wsdl file.
#
#
###########################################################################
proc ::WS::Client::ParseWsdl {wsdlXML args} {
    variable currentBaseUrl
    variable serviceArr

................................................................................
    #   - xs: http://www.w3.org/2001/XMLSchema
    #
    # The top node <wsdl:definitions
    #   targetNamespace="http://www.webserviceX.NET/">
    #   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/ ...>
    # contains the target namespace and all namespace definitions
    dict set nsDict url $targetNs tns$nsCount


    $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="myNS" 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]
            if {[dict exists $nsDict url $url]} {
                set tns [dict get $nsDict url $url]
            } else {
                ##
                ## Check for hardcoded namespaces
                ##
                switch -exact -- $url {
                    http://schemas.xmlsoap.org/wsdl/ {
                        set tns w
                    }
                    http://schemas.xmlsoap.org/wsdl/soap/ {
                        set tns d
                    }
                    http://www.w3.org/2001/XMLSchema {
                        set tns xs
                    }
                    default {
                        set tns tns[incr nsCount]
                    }
                }
                dict set nsDict url $url $tns
            }
            dict set nsDict tns $ns $tns
        }
    }







    if {[info exists currentBaseUrl]} {
        set url $currentBaseUrl
    } else {
        set url $targetNs
    }

ServerSide.tcl became a regular file.

docs/Creating_a_Tcl_Web_Service.html became a regular file.

docs/Rest_flavor_service_response.html became a regular file.

docs/index.html became a regular file.

Changes to pkgIndex.tcl.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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.3 [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]]







|






6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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]]