Check-in [ecbb5e058a]
Not logged in

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

Overview
Comment:Preliminary hacks working towards custom SOAP headers. Ticket [7c2ae385da]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | soap-header
Files: files | file ages | folders
SHA3-256:ecbb5e058a424deb180cc7c2ce250249ec6d32f38242d709c1832204f0b88b6f
User & Date: andy 2018-07-24 04:47:45
Original Comment: Preliminary hacks working towards custom SOAP headers
References
2018-09-03 18:01 New ticket [7c2ae385da] Use XSD file. artifact: c9995ace97 user: oehhar
Context
2018-07-24 04:47
Preliminary hacks working towards custom SOAP headers. Ticket [7c2ae385da] Leaf check-in: ecbb5e058a user: andy tags: soap-header
2018-07-24 02:47
Remove extra colon in namespace delimiter check-in: 01f9053e79 user: andy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ClientSide.tcl.

147
148
149
150
151
152
153




















































154
155
156
157
158
159
160
        suppressNS
        useTypeNs
        nsOnChangeOnly
    }
}

 




















































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







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







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
        suppressNS
        useTypeNs
        nsOnChangeOnly
    }
}

 

# BEGIN Andy Goth hacks -------------------------------------------------------

if {0} {
    package require log
    package require WS::Client
    #log::lvSuppress debug 0
    WS::Client::GetAndParseWsdl https://coverity.labs.quest.com/ws/v9/configurationservice?wsdl
    WS::Client::GetAndAddXsdTypes ConfigurationServiceService http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd 
    WS::Client::AddInputHeader ConfigurationServiceService getVersion wsse:Security {
        wsse:UsernameToken {wsse:Username foo wsse:Password bar}
    }
}

proc ::WS::Client::GetAndAddXsdTypes {serviceName url {headers {}}} {
    switch -- [dict get [::uri::split $url] scheme] {
    file {
        upvar #0 [::uri::geturl $url] token
        set xsd $token(data)
        unset token
    } http - https {
        if {[llength $headers]} {
            set xsd [::WS::Utils::geturl_fetchbody $url -headers $headers]
        } else {
            set xsd [::WS::Utils::geturl_fetchbody $url]
        }
        # HACK?? convert from UTF-8? shouldn't this have already been handled?
        set xsd [encoding convertfrom utf-8 $xsd]
    } default {
        return \
            -code error \
            -errorcode [list WS CLIENT UNKURLTYP $url] \
            "Unknown URL type '$url'"
    }}

    AddXsdTypes $serviceName $xsd $url
}

proc ::WS::Client::AddXsdTypes {serviceName xsd baseUrl} {
    variable serviceArr

    dom parse $xsd doc
    $doc documentElement node
    set tnsCount [llength [dict keys\
            [dict get $serviceArr($serviceName) tnsList url]]]
    ::WS::Utils::parseScheme Client $baseUrl $node $serviceName\
            serviceArr($serviceName) tnsCount
    $doc delete
}

# END Andy Goth hacks ---------------------------------------------------------

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

Changes to Utilities.tcl.

2819
2820
2821
2822
2823
2824
2825

2826

2827
2828
2829
2830
2831
2832
2833
....
2950
2951
2952
2953
2954
2955
2956

2957



2958
2959
2960
2961

2962



2963
2964
2965
2966
2967
2968
2969
....
2990
2991
2992
2993
2994
2995
2996

2997



2998
2999
3000
3001
3002
3003
3004
....
3021
3022
3023
3024
3025
3026
3027

3028



3029
3030
3031
3032
3033
3034
3035
....
3052
3053
3054
3055
3056
3057
3058

3059



3060
3061
3062
3063
3064
3065
3066
....
3082
3083
3084
3085
3086
3087
3088

3089



3090
3091
3092
3093
3094
3095
3096
....
3112
3113
3114
3115
3116
3117
3118

3119



3120
3121
3122
3123
3124
3125
3126
3127
3128
3129

3130



3131
3132
3133
3134
3135
3136
3137
    upvar 1 $serviceInfoVar serviceInfo
    variable currentSchema
    variable nsList
    variable options
    variable unknownRef

    set currentSchema $schemaNode

    set tmpTargetNs $::WS::Utils::targetNs

    foreach attr [$schemaNode attributes] {
        set value {?}
        catch {set value [$schemaNode getAttribute $attr]}
        ::log::logsubst debug {Attribute $attr = $value}
    }
    if {[$schemaNode hasAttribute targetNamespace]} {
        set xns [$schemaNode getAttribute targetNamespace]
................................................................................
        }
    }

    if {$lastUnknownRefCount} {
        switch -exact -- $options(StrictMode) {
            debug -
            warning {

                set ::WS::Utils::targetNs $tmpTargetNs



                ::log::logsubst $options(StrictMode) {Found $lastUnknownRefCount forward type references: [join [array names unknownRef] {,}]}
            }
            error -
            default {

                set ::WS::Utils::targetNs $tmpTargetNs



                return \
                    -code error \
                    -errorcode [list WS $mode UNKREFS [list $lastUnknownRefCount]] \
                    "Found $lastUnknownRefCount forward type references: [join [array names unknownRef] {,}]"
            }
        }
    }
................................................................................
                    set errorCode $::errorCode
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}

                    set ::WS::Utils::targetNs $tmpTargetNs



                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t last element: $::elementName}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}

                    set ::WS::Utils::targetNs $tmpTargetNs



                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}
                    ::log::logsubst error {\t last element: $::elementName}

                    set ::WS::Utils::targetNs $tmpTargetNs



                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorCode $::errorCode
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}

                    set ::WS::Utils::targetNs $tmpTargetNs



                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorCode $::errorCode
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}

                    set ::WS::Utils::targetNs $tmpTargetNs



                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
        }
    }


    set ::WS::Utils::targetNs $tmpTargetNs



    ::log::logsubst debug {Leaving :WS::Utils::parseScheme $mode $baseUrl $schemaNode $serviceName $serviceInfoVar $tnsCountVar}
    ::log::logsubst debug {Target NS is now: $::WS::Utils::targetNs}
    dict set serviceInfo tnsList tns $prevTnsDict
}

###########################################################################
#







>
|
>







 







>
|
>
>
>




>
|
>
>
>







 







>
|
>
>
>







 







>
|
>
>
>







 







>
|
>
>
>







 







>
|
>
>
>







 







>
|
>
>
>










>
|
>
>
>







2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
....
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
....
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
....
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
....
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
....
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
....
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
    upvar 1 $serviceInfoVar serviceInfo
    variable currentSchema
    variable nsList
    variable options
    variable unknownRef

    set currentSchema $schemaNode
    if {[info exists ::WS::Utils::targetNs]} {
        set tmpTargetNs $::WS::Utils::targetNs
    }
    foreach attr [$schemaNode attributes] {
        set value {?}
        catch {set value [$schemaNode getAttribute $attr]}
        ::log::logsubst debug {Attribute $attr = $value}
    }
    if {[$schemaNode hasAttribute targetNamespace]} {
        set xns [$schemaNode getAttribute targetNamespace]
................................................................................
        }
    }

    if {$lastUnknownRefCount} {
        switch -exact -- $options(StrictMode) {
            debug -
            warning {
                if {[info exists tmpTargetNs]} {
                    set ::WS::Utils::targetNs $tmpTargetNs
                } else {
                    unset -nocomplain ::WS::Utils::targetNs
                }
                ::log::logsubst $options(StrictMode) {Found $lastUnknownRefCount forward type references: [join [array names unknownRef] {,}]}
            }
            error -
            default {
                if {[info exists tmpTargetNs]} {
                    set ::WS::Utils::targetNs $tmpTargetNs
                } else {
                    unset -nocomplain ::WS::Utils::targetNs
                }
                return \
                    -code error \
                    -errorcode [list WS $mode UNKREFS [list $lastUnknownRefCount]] \
                    "Found $lastUnknownRefCount forward type references: [join [array names unknownRef] {,}]"
            }
        }
    }
................................................................................
                    set errorCode $::errorCode
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}
                    if {[info exists tmpTargetNs]} {
                        set ::WS::Utils::targetNs $tmpTargetNs
                    } else {
                        unset -nocomplain ::WS::Utils::targetNs
                    }
                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t last element: $::elementName}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}
                    if {[info exists tmpTargetNs]} {
                        set ::WS::Utils::targetNs $tmpTargetNs
                    } else {
                        unset -nocomplain ::WS::Utils::targetNs
                    }
                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}
                    ::log::logsubst error {\t last element: $::elementName}
                    if {[info exists tmpTargetNs]} {
                        set ::WS::Utils::targetNs $tmpTargetNs
                    } else {
                        unset -nocomplain ::WS::Utils::targetNs
                    }
                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorCode $::errorCode
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}
                    if {[info exists tmpTargetNs]} {
                        set ::WS::Utils::targetNs $tmpTargetNs
                    } else {
                        unset -nocomplain ::WS::Utils::targetNs
                    }
                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
................................................................................
                    set errorCode $::errorCode
                    set errorInfo $::errorInfo
                    ::log::logsubst error {Could not parse:\n [$element asXML]}
                    ::log::logsubst error {\t error was: $msg}
                    ::log::logsubst error {\t error info: $errorInfo}
                    ::log::logsubst error {\t error in: [lindex [info level 0] 0]}
                    ::log::logsubst error {\t error code: $errorCode}
                    if {[info exists tmpTargetNs]} {
                        set ::WS::Utils::targetNs $tmpTargetNs
                    } else {
                        unset -nocomplain ::WS::Utils::targetNs
                    }
                    return \
                        -code error \
                        -errorcode $errorCode \
                        -errorinfo $errorInfo \
                        $msg
                }
            }
        }
    }

    if {[info exists tmpTargetNs]} {
        set ::WS::Utils::targetNs $tmpTargetNs
    } else {
        unset -nocomplain ::WS::Utils::targetNs
    }
    ::log::logsubst debug {Leaving :WS::Utils::parseScheme $mode $baseUrl $schemaNode $serviceName $serviceInfoVar $tnsCountVar}
    ::log::logsubst debug {Target NS is now: $::WS::Utils::targetNs}
    dict set serviceInfo tnsList tns $prevTnsDict
}

###########################################################################
#