Check-in [b5e0c651f1]

Not logged in

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

Overview
Comment:ClientSide rev 2.4.6: Define new parameter "serviceNumber" to address a service definition (of n) in a WSDL file. Ticket [955e3754e5]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:b5e0c651f182e26989f145e9a427e8d98e79d12fbc1cb1a79a2a8833390c6086
User & Date: oehhar 2017-12-07 17:37:37
References
2017-12-07 17:41 Closed ticket [955e3754e5]: ClientSide: WSDL with multiple service do not allow service alias plus 3 other changes artifact: 0af5bd5d19 user: oehhar
Context
2018-01-08 17:28
Removed errorneous ifneed http 2.8.12. This is now contained in tcl 8.6.8 check-in: de79f4aab6 user: oehhar tags: trunk
2017-12-07 17:37
ClientSide rev 2.4.6: Define new parameter "serviceNumber" to address a service definition (of n) in a WSDL file. Ticket [955e3754e5] check-in: b5e0c651f1 user: oehhar tags: trunk
2017-12-05 19:50
Comment why dict is build by a list check-in: 57c46d4424 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
....
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017


1018

1019
1020
1021
1022
1023
1024
1025
....
1032
1033
1034
1035
1036
1037
1038
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
....
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
1104
1105
1106
1107
1108
1109
....
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
....
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
....
2651
2652
2653
2654
2655
2656
2657
2658
2659



2660
2661
2662
2663
2664
2665
2666
....
2673
2674
2675
2676
2677
2678
2679

2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692













2693
2694
2695
2696
2697
2698

2699
2700
2701
2702
2703
2704






2705


2706
2707
2708
2709
2710
2711
2712
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
................................................................................
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::GetAndParseWsdl
#
# Description :
#
# Arguments :
#       url     - The url of the WSDL
#       headers     - Extra headers to add to the HTTP request. This
#                       is a key value list argument. It must be a list with
#                       an even number of elements that alternate between
#                       keys and values. The keys become header field names.
#                       Newlines are stripped from the values so the header
#                       cannot be corrupted.
#                       This is an optional argument and defaults to {}.
#       serviceAlias - Alias (unique) name for service.
#                       This is an optional argument and defaults to the name of the


#                       service in serviceInfo.

#
# Returns : The parsed service definition
#
# Side-Effects : None
#
# Exception Conditions : None
#
................................................................................
# 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.1    2017-08-31  H.Oehlmann   Use utility function
#                                   ::WS::Utils::geturl_fetchbody for http call

#
###########################################################################
proc ::WS::Client::GetAndParseWsdl {url {headers {}} {serviceAlias {}}} {
    variable currentBaseUrl

    set currentBaseUrl $url
    switch -exact -- [dict get [::uri::split $url] scheme] {
        file {
            upvar #0 [::uri::geturl $url] token
            set wsdlInfo [ParseWsdl $token(data) -headers $headers -serviceAlias $serviceAlias]
            unset token
        }
        http -
        https {
            if {[llength $headers]} {
                set body [::WS::Utils::geturl_fetchbody $url -headers $headers]
            } else {
                set body [::WS::Utils::geturl_fetchbody $url]
            }
            set wsdlInfo [ParseWsdl $body -headers $headers -serviceAlias $serviceAlias]
        }
        default {
            return \
                -code error \
                -errorcode [list WS CLIENT UNKURLTYP $url] \
                "Unknown URL type '$url'"
        }
................................................................................
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::ParseWsdl
#
# Description : Parse a WSDL
#
# Arguments :
#       wsdlXML - XML of the WSDL
#
# Optional Arguments:
#       -createStubs 0|1 - create stub routines for the service
#                               NOTE -- Webservice arguments are position
#                                       independent, thus the proc arguments
#                                       will be defined in alphabetical order.
#       -headers         - Extra headers to add to the HTTP request. This
#                          is a key value list argument. It must be a list with
#                          an even number of elements that alternate between
#                          keys and values. The keys become header field names.
#                          Newlines are stripped from the values so the header
#                          cannot be corrupted.
#                          This is an optional argument and defaults to {}.
#       -serviceAlias - Alias (unique) name for service.
#                       This is an optional argument and defaults to the name of the
#                       service in serviceInfo.





#
# Returns : The parsed service definition
#
# Side-Effects : None
#
# Exception Conditions :None
#
................................................................................
#                                   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   {}
    }

    array set defaults $args

    set first [string first {<} $wsdlXML]
    if {$first > 0} {
        set wsdlXML [string range $wsdlXML $first end]
    }
    ::log::log debug [list "Parsing WSDL" $wsdlXML]

................................................................................
    } else {
        set url $targetNs
    }

    array unset ::WS::Utils::includeArr
    ::WS::Utils::ProcessIncludes $wsdlNode $url

    if {[string length $defaults(-serviceAlias)]} {
        set serviceAlias $defaults(-serviceAlias)
    } else {
        set serviceAlias {}
    }

    set serviceInfo {}

    foreach serviceInfo [buildServiceInfo $wsdlNode $nsDict $serviceInfo $serviceAlias] {
        set serviceName [dict get $serviceInfo name]

        if {[llength $defaults(-headers)]} {
            dict set serviceInfo headers $defaults(-headers)
        }
        dict set serviceInfo types [::WS::Utils::GetServiceTypeDef Client $serviceName]
        dict set serviceInfo simpletypes [::WS::Utils::GetServiceSimpleTypeDef Client $serviceName]

        set serviceArr($serviceName) $serviceInfo

        if {$defaults(-createStubs)} {
            catch {namespace delete $serviceName}
            namespace eval $serviceName {}
            CreateStubs $serviceName
        }
    }

    $wsdlDoc delete
................................................................................
#
# Description : Parse the WSDL into our internal representation
#
# Arguments :
#    wsdlNode   - The top node of the WSDL
#    results    - Initial definition. This is optional and defaults to no definition.
#    serviceAlias - Alias (unique) name for service.
#                       This is an optional argument and defaults to the name of the
#                       service in serviceInfo.



#
# Returns : The parsed WSDL
#
# Side-Effects : Defines Client mode types as specified by the WSDL
#
# Exception Conditions : None
#
................................................................................
# 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::buildServiceInfo {wsdlNode tnsDict {serviceInfo {}} {serviceAlias {}}} {
    ##
    ## Need to refactor to foreach service parseService
    ##  Service drills down to ports, which drills down to bindings and messages
    ##
    ::log::log debug "Entering ::WS::Client::buildServiceInfo with doc $wsdlNode"

    ##
    ## Parse Service information
    ##













    set serviceNameList [$wsdlNode selectNodes w:service]
    if {[string length $serviceAlias] & ([llength $serviceNameList] > 1)} {
        return \
            -code error \
            -errorcode [list WS CLIENT MULTISVC] \
            "Can not specify alias when WSDL defines multiple services"

    } elseif {[llength $serviceNameList] == 0} {
        return \
            -code error \
            -errorcode [list WS CLIENT NOSVC] \
            "WSDL does not define any services"
    }










    foreach serviceNode $serviceNameList {
        lappend serviceInfo [parseService $wsdlNode $serviceNode $serviceAlias $tnsDict]
    }

    ::log::log debug [list "Leaving ::WS::Client::buildServiceInfo with" $serviceInfo]
    return $serviceInfo







|







 







|
|






|
|
>
>
|
>







 







|

>


|






|









|







 







|






<
<
<







|
|
|
>
>
>
>
>







 







>







>
|



|
|
|







 







<
<
<
<
<
<


|


|
|






|







 







|
|
>
>
>







 







>



|




|




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

<
<
<
<
<
>
|





>
>
>
>
>
>
|
>
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
....
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
....
1035
1036
1037
1038
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
....
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093



1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
....
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
....
1276
1277
1278
1279
1280
1281
1282






1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
....
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
....
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712





2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
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.6

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
................................................................................
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::GetAndParseWsdl
#
# Description :
#
# Arguments :
#       url           - The url of the WSDL
#       headers       - Extra headers to add to the HTTP request. This
#                       is a key value list argument. It must be a list with
#                       an even number of elements that alternate between
#                       keys and values. The keys become header field names.
#                       Newlines are stripped from the values so the header
#                       cannot be corrupted.
#                       This is an optional argument and defaults to {}.
#       serviceAlias  - Alias (unique) name for service.
#                       This is an optional argument and defaults to the name 
#                       of the service in serviceInfo.
#       serviceNumber - Number of service within the WSDL to assign the
#                       serviceAlias to. Only usable with a serviceAlias.
#                       First service (default) is addressed by value "1".
#
# Returns : The parsed service definition
#
# Side-Effects : None
#
# Exception Conditions : None
#
................................................................................
# 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.1  2017-08-31  H.Oehlmann   Use utility function
#                                   ::WS::Utils::geturl_fetchbody for http call
#   2.4.6  2017-12-07  H.Oehlmann   Added argument "serviceNumber".
#
###########################################################################
proc ::WS::Client::GetAndParseWsdl {url {headers {}} {serviceAlias {}} {serviceNumber 1}} {
    variable currentBaseUrl

    set currentBaseUrl $url
    switch -exact -- [dict get [::uri::split $url] scheme] {
        file {
            upvar #0 [::uri::geturl $url] token
            set wsdlInfo [ParseWsdl $token(data) -headers $headers -serviceAlias $serviceAlias -serviceNumber $serviceNumber]
            unset token
        }
        http -
        https {
            if {[llength $headers]} {
                set body [::WS::Utils::geturl_fetchbody $url -headers $headers]
            } else {
                set body [::WS::Utils::geturl_fetchbody $url]
            }
            set wsdlInfo [ParseWsdl $body -headers $headers -serviceAlias $serviceAlias -serviceNumber $serviceNumber]
        }
        default {
            return \
                -code error \
                -errorcode [list WS CLIENT UNKURLTYP $url] \
                "Unknown URL type '$url'"
        }
................................................................................
# Public Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
#>>BEGIN PUBLIC<<
#
# Procedure Name : ::WS::Client::ParseWsdl
#
# Description : Parse a WSDL and create the service. Create stubs if specified.
#
# Arguments :
#       wsdlXML - XML of the WSDL
#
# Optional Arguments:
#       -createStubs 0|1 - create stub routines for the service



#       -headers         - Extra headers to add to the HTTP request. This
#                          is a key value list argument. It must be a list with
#                          an even number of elements that alternate between
#                          keys and values. The keys become header field names.
#                          Newlines are stripped from the values so the header
#                          cannot be corrupted.
#                          This is an optional argument and defaults to {}.
#       -serviceAlias    - Alias (unique) name for service.
#                          This is an optional argument and defaults to the
#                          name of the service in serviceInfo.
#       -serviceNumber   - Number of service within the WSDL to assign the
#                          serviceAlias to. Only usable with a serviceAlias.
#                          First service (default) is addressed by value "1".
#
# NOTE -- Arguments are position independent.
#
# Returns : The parsed service definition
#
# Side-Effects : None
#
# Exception Conditions :None
#
................................................................................
#                                   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
# 2.4.6    2017-12-07  H.Oehlmann   Added argument "-serviceNumber".
#
###########################################################################
proc ::WS::Client::ParseWsdl {wsdlXML args} {
    variable currentBaseUrl
    variable serviceArr
    variable options

    # Build the argument array with the following defaults
    array set argument {
        -createStubs    0
        -headers        {}
        -serviceAlias   {}
        -serviceNumber  1
    }
    array set argument $args

    set first [string first {<} $wsdlXML]
    if {$first > 0} {
        set wsdlXML [string range $wsdlXML $first end]
    }
    ::log::log debug [list "Parsing WSDL" $wsdlXML]

................................................................................
    } else {
        set url $targetNs
    }

    array unset ::WS::Utils::includeArr
    ::WS::Utils::ProcessIncludes $wsdlNode $url







    set serviceInfo {}

    foreach serviceInfo [buildServiceInfo $wsdlNode $nsDict $serviceInfo $argument(-serviceAlias) $argument(-serviceNumber)] {
        set serviceName [dict get $serviceInfo name]

        if {[llength $argument(-headers)]} {
            dict set serviceInfo headers $argument(-headers)
        }
        dict set serviceInfo types [::WS::Utils::GetServiceTypeDef Client $serviceName]
        dict set serviceInfo simpletypes [::WS::Utils::GetServiceSimpleTypeDef Client $serviceName]

        set serviceArr($serviceName) $serviceInfo

        if {$argument(-createStubs)} {
            catch {namespace delete $serviceName}
            namespace eval $serviceName {}
            CreateStubs $serviceName
        }
    }

    $wsdlDoc delete
................................................................................
#
# Description : Parse the WSDL into our internal representation
#
# Arguments :
#    wsdlNode   - The top node of the WSDL
#    results    - Initial definition. This is optional and defaults to no definition.
#    serviceAlias - Alias (unique) name for service.
#                   This is an optional argument and defaults to the name of the
#                   service in serviceInfo.
#    serviceNumber - Number of service within the WSDL to assign the
#                    serviceAlias to. Only usable with a serviceAlias.
#                    First service (default) is addressed by value "1".
#
# Returns : The parsed WSDL
#
# Side-Effects : Defines Client mode types as specified by the WSDL
#
# Exception Conditions : None
#
................................................................................
# 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.6  2017-12-07  H.Oehlmann   Added argument "serviceNumber"
#
#
###########################################################################
proc ::WS::Client::buildServiceInfo {wsdlNode tnsDict {serviceInfo {}} {serviceAlias {}} {serviceNumber 1}} {
    ##
    ## Need to refactor to foreach service parseService
    ##  Service drills down to ports, which drills down to bindings and messages
    ##
    ::log::log debug [list "Entering ::WS::Client::buildServiceInfo with doc" $wsdlNode]

    ##
    ## Parse Service information
    ##
    # WSDL snippet:
    #  <definitions ...>
    #    <service name="service1">
    #      ...
    #    </service>
    #    <service name="service2">
    #      ...
    #    </service>
    #  </definitions>
    # Without serviceAlias and serviceNumber, two services "service1" and
    # "service2" are created.
    # With serviceAlias = "SE" and serviceNumber=2, "service2" is created as
    # "SE".
    set serviceNameList [$wsdlNode selectNodes w:service]





    # Check for no service node
    if {[llength $serviceNameList] == 0} {
        return \
            -code error \
            -errorcode [list WS CLIENT NOSVC] \
            "WSDL does not define any services"
    }
    if {"" ne $serviceAlias} {
        if {$serviceNumber < 1 || $serviceNumber > [llength $serviceNameList]} {
            return \
                -code error \
                -errorcode [list WS CLIENT INVALDCNT] \
                "WSDL does not define service number $serviceNumber"
        }
        set serviceNameList [lrange $serviceNameList $serviceNumber-1 $serviceNumber-1]
    }

    foreach serviceNode $serviceNameList {
        lappend serviceInfo [parseService $wsdlNode $serviceNode $serviceAlias $tnsDict]
    }

    ::log::log debug [list "Leaving ::WS::Client::buildServiceInfo with" $serviceInfo]
    return $serviceInfo

Changes to docs/Calling_a_Web_Service.html.

88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106



107















108
109
110
111
112
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
causes no ill effects to put this in each file using the utilties. </P>
<HR>


<A name=Quering_a_remote_Web_Services_Server_for_its_WSDL_and_parsing_it></A>
<H2>Quering a remote Web Services Server for its WSDL and parsing it </H2>
<P><B>Procedure Name&nbsp;: <I>::WS::Client::GetAndParseWsdl</I></B> </P>

<P><B>Description&nbsp;:</B> </P>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>url</I>     - The url of the WSDL
     <I>headers</I> - Extra headers to add to the HTTP request. This
                 is a key value list argument. It must be a list with
                 an even number of elements that alternate between
                 keys and values. The keys become header field names.
                 Newlines are stripped from the values so the header
                 cannot be corrupted.
                 This is an optional argument and defaults to {}.
     <I>serviceAlias</I> - Alias (unique) name for service.
                     This is an optional argument and defaults to the name of the
                     service in serviceInfo.



</PRE>















<P><B>Returns&nbsp;: The parsed service definition</B> </P>
<P><B>Side-Effects&nbsp;: None</B> </P>
<P><B>Exception Conditions&nbsp;: None</B> </P>
<P><B>Pre-requisite Conditions&nbsp;: None</B> </P>
<HR>

<A name=Parsing_a_saved_WSDL></A>
<H2>Parsing a saved WSDL </H2>
<P><B>Procedure Name&nbsp;: <I>::WS::Client::ParseWsdl</I></B> </P>
<P><B>Description&nbsp;: Parse a WSDL</B> </P>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>wsdlXML</I> - XML of the WSDL
</PRE>
<P><B>Optional Arguments:</B> </P><PRE>     -createStubs 0|1 - create stub routines for the service
                             <B>NOTE</B> -- Webservice arguments are position
                                     independent, thus the proc arguments
                                     will be defined in alphabetical order.
     -headers         - Extra headers to add to the HTTP request. This
                        is a key value list argument. It must be a list with
                        an even number of elements that alternate between
                        keys and values. The keys become header field names.
                        Newlines are stripped from the values so the header
                        cannot be corrupted.
                        This is an optional argument and defaults to {}.
     -serviceAlias - Alias (unique) name for service.
                      This is an optional argument and defaults to the name of the
                      service in serviceInfo.



</PRE>



<P><B>Returns&nbsp;: The parsed service definition</B> </P>
<P><B>Side-Effects&nbsp;: None</B> </P>
<P><B>Exception Conditions&nbsp;:None</B> </P>
<P><B>Pre-requisite Conditions&nbsp;: None</B> </P>
<HR>









>
|
|

|
|
|
|
|
|

|
|
>
>
>

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









|


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

>
>
>







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
causes no ill effects to put this in each file using the utilties. </P>
<HR>


<A name=Quering_a_remote_Web_Services_Server_for_its_WSDL_and_parsing_it></A>
<H2>Quering a remote Web Services Server for its WSDL and parsing it </H2>
<P><B>Procedure Name&nbsp;: <I>::WS::Client::GetAndParseWsdl</I></B> </P>
<P><B>Description&nbsp;: Fetch the WSDL file from the given URL, aprse it and create the service.</B> </P>
<P><B>Arguments&nbsp;:</B> </P><PRE>
     <I>url</I>     - The url of the WSDL
     <I>headers</I> - Extra headers to add to the HTTP request. This
     <I></I>          is a key value list argument. It must be a list with
     <I></I>          an even number of elements that alternate between
     <I></I>          keys and values. The keys become header field names.
     <I></I>          Newlines are stripped from the values so the header
     <I></I>          cannot be corrupted.
     <I></I>          This is an optional argument and defaults to {}.
     <I>serviceAlias</I> - Alias (unique) name for service.
     <I></I>               This is an optional argument and defaults to the name of the
     <I></I>               service in serviceInfo.
     <I>serviceNumber</I> - Number of service within the WSDL to assign the
     <I></I>                serviceAlias to. Only recognized with a serviceAlias.
     <I></I>                First service (default) is addressed by value "1".
</PRE>
<p>The following example WSDL snipped defines two services:</p>
<pre>
  &gt;definitions ...&lt;
    &gt;service name="service1"&lt;
      ...
    &gt;/service&lt;
    &gt;service name="service1"&lt;
      ...
    &gt;/service&lt;
  &gt;/definitions&lt;
</pre>

<p>Using an empty or no <I>serviceAlias</I> would result in the creation of the services "service1" and "service2".</p>
<p>Using <i>serviceAlias</i>="SE" and <i>serviceNumber</i>=2 would result in the creation of the service "SE" containing the "service2" of the WSDL.</p>

<P><B>Returns&nbsp;: The parsed service definition</B> </P>
<P><B>Side-Effects&nbsp;: None</B> </P>
<P><B>Exception Conditions&nbsp;: None</B> </P>
<P><B>Pre-requisite Conditions&nbsp;: None</B> </P>
<HR>

<A name=Parsing_a_saved_WSDL></A>
<H2>Parsing a saved WSDL </H2>
<P><B>Procedure Name&nbsp;: <I>::WS::Client::ParseWsdl</I></B> </P>
<P><B>Description&nbsp;: Parse a WSDL and create the service. Create also the stubs if specified.</B> </P>
<P><B>Arguments&nbsp;:</B> </P><PRE>     <I>wsdlXML</I> - XML of the WSDL
</PRE>
<P><B>Optional Arguments:</B> </P>
<PRE>
     <i>-createStubs</i> 0|1 - create stub routines for the service

     <i>-headers</i>         - Extra headers to add to the HTTP request. This
     <i></i>                   is a key value list argument. It must be a list with
     <i></i>                   an even number of elements that alternate between
     <i></i>                   keys and values. The keys become header field names.
     <i></i>                   Newlines are stripped from the values so the header
     <i></i>                   cannot be corrupted.
     <i></i>                   This is an optional argument and defaults to {}.
     <i>-serviceAlias</i>    - Alias (unique) name for service.
     <i></i>                   This is an optional argument and defaults to the name of the
     <i></i>                   service in serviceInfo.
     <I>serviceNumber</I> - Number of service within the WSDL to assign the
     <I></I>                serviceAlias to. Only recognized with a serviceAlias.
     <I></I>                First service (default) is addressed by value "1".
</PRE>

<p>The arguments are position independent.</p>
<p>For an example use of <i>serviceAlias</i> and <i>serviceNumber</i>, see <a href="#Quering_a_remote_Web_Services_Server_for_its_WSDL_and_parsing_it">the chapter above</a>.</p>
<P><B>Returns&nbsp;: The parsed service definition</B> </P>
<P><B>Side-Effects&nbsp;: None</B> </P>
<P><B>Exception Conditions&nbsp;:None</B> </P>
<P><B>Pre-requisite Conditions&nbsp;: None</B> </P>
<HR>


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







|






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.6 [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]]