Check-in [4c451e8a5f]
Not logged in

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

Overview
Comment:consistently use trimright when removing paren pairs

git-svn-id: http://tclws.googlecode.com/svn/trunk@68 4eab59b1-ed42-0410-973d-ab9b78d4c8bc

Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | proposed-main
Files: files | file ages | folders
SHA1: 4c451e8a5fea16106f37020e37ad89bcd9680ffd
User & Date: jeff@bovine.net@4eab59b1-ed42-0410-973d-ab9b78d4c8bc 2010-11-12 18:22:22.000
Context
2010-11-12
20:28
Issue 12: Support for legacy pySOAP (Python) rpc-encoded clients

git-svn-id: http://tclws.googlecode.com/svn/trunk@69 4eab59b1-ed42-0410-973d-ab9b78d4c8bc check-in: 61d35ec5ba user: jeff@bovine.net@4eab59b1-ed42-0410-973d-ab9b78d4c8bc tags: proposed-main

18:22
consistently use trimright when removing paren pairs

git-svn-id: http://tclws.googlecode.com/svn/trunk@68 4eab59b1-ed42-0410-973d-ab9b78d4c8bc check-in: 4c451e8a5f user: jeff@bovine.net@4eab59b1-ed42-0410-973d-ab9b78d4c8bc tags: proposed-main

18:15
Issue 13: Server Array types have extra "()" in generated WSDL

git-svn-id: http://tclws.googlecode.com/svn/trunk@67 4eab59b1-ed42-0410-973d-ab9b78d4c8bc check-in: ad911b8800 user: jeff@bovine.net@4eab59b1-ed42-0410-973d-ab9b78d4c8bc tags: proposed-main

Changes
Unified Diff Ignore Whitespace Patch
Changes to Utilities.tcl.
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
proc ::WS::Utils::GetCrossreference {mode service} {
    variable typeInfo

    array set crossreference {}

    dict for {type typeDict} [dict get $typeInfo $mode $service] {
        foreach {field fieldDict} [dict get $typeDict definition] {
            set fieldType [string trim [dict get $fieldDict type] {()}]
            incr crossreference($fieldType,count)
            lappend crossreference($fieldType,usedBy) $type.$field
        }
        if {![info exists crossreference($type,count) ]} {
            set crossreference($type,count) 0
            set crossreference($type,usedBy) {}
        }







|







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
proc ::WS::Utils::GetCrossreference {mode service} {
    variable typeInfo

    array set crossreference {}

    dict for {type typeDict} [dict get $typeInfo $mode $service] {
        foreach {field fieldDict} [dict get $typeDict definition] {
            set fieldType [string trimright [dict get $fieldDict type] {()}]
            incr crossreference($fieldType,count)
            lappend crossreference($fieldType,usedBy) $type.$field
        }
        if {![info exists crossreference($type,count) ]} {
            set crossreference($type,count) 0
            set crossreference($type,usedBy) {}
        }
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
#
###########################################################################
proc ::WS::Utils::getTypeWSDLInfo {mode serviceName field type} {
    set typeInfo {maxOccurs 1 minOccurs 1 name * type *}
    dict set typeInfo name $field
    set typeList [TypeInfo $mode $serviceName $type]
    if {[lindex $typeList 0] == 0} {
        dict set typeInfo type s:[string trim $type {()}]
    } else {
        dict set typeInfo type $serviceName:[string trim $type {()}]
    }
    if {[lindex $typeList 1]} {
        dict set typeInfo maxOccurs unbounded
    }

    return $typeInfo
}







|

|







1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
#
###########################################################################
proc ::WS::Utils::getTypeWSDLInfo {mode serviceName field type} {
    set typeInfo {maxOccurs 1 minOccurs 1 name * type *}
    dict set typeInfo name $field
    set typeList [TypeInfo $mode $serviceName $type]
    if {[lindex $typeList 0] == 0} {
        dict set typeInfo type s:[string trimright $type {()}]
    } else {
        dict set typeInfo type $serviceName:[string trimright $type {()}]
    }
    if {[lindex $typeList 1]} {
        dict set typeInfo maxOccurs unbounded
    }

    return $typeInfo
}
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
                    dict set results $partName [convertTypeToDict $mode $serviceName $item $partType $root]
                }
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set partType [string trim $partType {()}]
                set tmp [list]
                foreach row $item {
                    if {$options(parseInAttr)} {
                        set rowList {}
                        foreach attr [$item attributes] {
                            if {[llength $attr] == 1} {
                                append rowList $attr [$row getAttribute $attr]







|







1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
                    dict set results $partName [convertTypeToDict $mode $serviceName $item $partType $root]
                }
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set partType [string trimright $partType {()}]
                set tmp [list]
                foreach row $item {
                    if {$options(parseInAttr)} {
                        set rowList {}
                        foreach attr [$item attributes] {
                            if {[llength $attr] == 1} {
                                append rowList $attr [$row getAttribute $attr]
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
                }
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trim $itemType ()]
                foreach row $dataList {
                    $parent appendChild [$doc createElement $itemXns:$itemName retNode]
                    if {$options(genOutAttr)} {
                        set dictList [dict keys $row]
                        foreach attr [lindex [::struct::set intersect3 $standardAttributes $dictList] end] {
                            if {[string equal $attr  {}]} {
                                lappend attrList $attr [dict get $row $attr]







|







1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
                }
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trimright $itemType ()]
                foreach row $dataList {
                    $parent appendChild [$doc createElement $itemXns:$itemName retNode]
                    if {$options(genOutAttr)} {
                        set dictList [dict keys $row]
                        foreach attr [lindex [::struct::set intersect3 $standardAttributes $dictList] end] {
                            if {[string equal $attr  {}]} {
                                lappend attrList $attr [dict get $row $attr]
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
                convertDictToTypeNoNs $mode $service $doc $retnode $resultValue $itemType
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trim $itemType ()]
                foreach row $dataList {
                    $parent appendChild [$doc createElement $itemName retnode]
                    if {$options(genOutAttr)} {
                        set dictList [dict keys $row]
                        foreach attr [lindex [::struct::set intersect3 $standardAttributes $dictList] end] {
                            if {[string equal $attr  {}]} {
                                lappend attrList $attr [dict get $row $attr]







|







1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
                convertDictToTypeNoNs $mode $service $doc $retnode $resultValue $itemType
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trimright $itemType ()]
                foreach row $dataList {
                    $parent appendChild [$doc createElement $itemName retnode]
                    if {$options(genOutAttr)} {
                        set dictList [dict keys $row]
                        foreach attr [lindex [::struct::set intersect3 $standardAttributes $dictList] end] {
                            if {[string equal $attr  {}]} {
                                lappend attrList $attr [dict get $row $attr]
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
                $retNode appendChild [$doc createTextNode $resultValue]
            }
            {0 1} {
                ##
                ## Simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trim $itemType {()}]
                foreach resultValue $dataList {
                    $parent appendChild [$doc createElement $xns:$itemName retNode]
                    $retNode setAttribute xsi:type xs:$itemType
                    set resultValue [dict get $dict $itemName]
                    $retNode appendChild [$doc createTextNode $resultValue]
                }
            }
            {1 0} {
                ##
                ## Non-simple non-array
                ##
                $parent appendChild [$doc createElement $xns:$itemName retNode]
                $retNode setAttribute xsi:type xs:$itemType
                                 convertDictToEncodedType $mode $service $doc $retNode [dict get $dict $itemName] $itemType
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trim $itemType ()]
                foreach item $dataList {
                    $parent appendChild [$doc createElement $xns:$itemName retNode]
                    $retNode setAttribute xsi:type xs:$itemType
                    convertDictToEncodedType $mode $service $doc $retNode $item $tmpType
                }
            }
        }







|




















|







1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
                $retNode appendChild [$doc createTextNode $resultValue]
            }
            {0 1} {
                ##
                ## Simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trimright $itemType {()}]
                foreach resultValue $dataList {
                    $parent appendChild [$doc createElement $xns:$itemName retNode]
                    $retNode setAttribute xsi:type xs:$itemType
                    set resultValue [dict get $dict $itemName]
                    $retNode appendChild [$doc createTextNode $resultValue]
                }
            }
            {1 0} {
                ##
                ## Non-simple non-array
                ##
                $parent appendChild [$doc createElement $xns:$itemName retNode]
                $retNode setAttribute xsi:type xs:$itemType
                                 convertDictToEncodedType $mode $service $doc $retNode [dict get $dict $itemName] $itemType
            }
            {1 1} {
                ##
                ## Non-simple array
                ##
                set dataList [dict get $dict $itemName]
                set tmpType [string trimright $itemType ()]
                foreach item $dataList {
                    $parent appendChild [$doc createElement $xns:$itemName retNode]
                    $retNode setAttribute xsi:type xs:$itemType
                    convertDictToEncodedType $mode $service $doc $retNode $item $tmpType
                }
            }
        }
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
                set nodeFound 1
                set partName [$middleNode getAttribute name]
                set partType [lindex [split [$middleNode getAttribute type string:string] {:}] end]
                set partMax [$middleNode getAttribute maxOccurs 1]
                if {[string equal $partMax 1]} {
                    lappend partList $partName [list type $partType comment $comment]
                } else {
                    lappend partList $partName [list type [string trim ${partType} {()}]() comment $comment]
                }
            }
            extension {
                set baseName [lindex [split [$middleNode getAttribute base] {:}] end]
                set tmp [partList $mode $middleNode $serviceName results $tns]
                if {[llength $tmp]} {
                    set nodeFound 1







|







2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
                set nodeFound 1
                set partName [$middleNode getAttribute name]
                set partType [lindex [split [$middleNode getAttribute type string:string] {:}] end]
                set partMax [$middleNode getAttribute maxOccurs 1]
                if {[string equal $partMax 1]} {
                    lappend partList $partName [list type $partType comment $comment]
                } else {
                    lappend partList $partName [list type [string trimright ${partType} {()}]() comment $comment]
                }
            }
            extension {
                set baseName [lindex [split [$middleNode getAttribute base] {:}] end]
                set tmp [partList $mode $middleNode $serviceName results $tns]
                if {[llength $tmp]} {
                    set nodeFound 1
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
                                    set ref $attr
                                }
                                catch {set attrArr($name) [$element getAttribute $ref]}
                            }
                            set partName item
                            set partType [lindex [split $attrArr(arrayType) {:}] end]
                            set partType [string map {{[]} {()}} $partType]
                            lappend partList $partName [list type [string trim ${partType} {()}]() comment $comment]
                            set nodeFound 1
                        }
                    }
                    extension {
                        set tmp [partList $mode $middleNode $serviceName results $tns]
                        if {[llength $tmp]} {
                        set nodeFound 1







|







2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
                                    set ref $attr
                                }
                                catch {set attrArr($name) [$element getAttribute $ref]}
                            }
                            set partName item
                            set partType [lindex [split $attrArr(arrayType) {:}] end]
                            set partType [string map {{[]} {()}} $partType]
                            lappend partList $partName [list type [string trimright ${partType} {()}]() comment $comment]
                            set nodeFound 1
                        }
                    }
                    extension {
                        set tmp [partList $mode $middleNode $serviceName results $tns]
                        if {[llength $tmp]} {
                        set nodeFound 1
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
            catch {
                set partName [$node getAttribute name]
                set partType [lindex [split [$node getAttribute type string:string] {:}] end]
                set partMax [$node getAttribute maxOccurs 1]
                if {[string equal $partMax 1]} {
                    set partList [list $partName [list type $partType comment {}]]
                } else {
                    set partList [list $partName [list type [string trim ${partType} {()}]() comment {}]]
                }
            }
        }
        extension {
            set baseName [lindex [split [$node getAttribute base] {:}] end]
            #puts "base name $baseName"
            if {[lindex [TypeInfo Client $serviceName $baseName] 0]} {







|







2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
            catch {
                set partName [$node getAttribute name]
                set partType [lindex [split [$node getAttribute type string:string] {:}] end]
                set partMax [$node getAttribute maxOccurs 1]
                if {[string equal $partMax 1]} {
                    set partList [list $partName [list type $partType comment {}]]
                } else {
                    set partList [list $partName [list type [string trimright ${partType} {()}]() comment {}]]
                }
            }
        }
        extension {
            set baseName [lindex [split [$node getAttribute base] {:}] end]
            #puts "base name $baseName"
            if {[lindex [TypeInfo Client $serviceName $baseName] 0]} {
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
                        }
                    } else {
                        set partMax [$element getAttribute maxOccurs 1]
                    }
                    if {[string equal $partMax 1]} {
                        lappend partList $partName [list type $partType comment $comment]
                    } else {
                        lappend partList $partName [list type [string trim ${partType} {()}]() comment $comment]
                    }
                } msg]} {
                        ::log::log error "\tError processing {$msg} for [$element asXML]"
                }
            }
            if {!$elementsFound} {
                return







|







2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
                        }
                    } else {
                        set partMax [$element getAttribute maxOccurs 1]
                    }
                    if {[string equal $partMax 1]} {
                        lappend partList $partName [list type $partType comment $comment]
                    } else {
                        lappend partList $partName [list type [string trimright ${partType} {()}]() comment $comment]
                    }
                } msg]} {
                        ::log::log error "\tError processing {$msg} for [$element asXML]"
                }
            }
            if {!$elementsFound} {
                return
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
                            set ref $attr
                        }
                        catch {set attrArr($name) [$element getAttribute $ref]}
                    }
                    set partName item
                    set partType [lindex [split $attrArr(arrayType) {:}] end]
                    set partType [string map {{[]} {()}} $partType]
                    set partList [list $partName [list type [string trim ${partType} {()}]() comment {}]]
                }
                extension {
                    set extension [$node selectNodes -namespaces $nsList s:extension]
                    set partList [partList $mode $extension $serviceName results $tns]
                }
            }
        }







|







2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
                            set ref $attr
                        }
                        catch {set attrArr($name) [$element getAttribute $ref]}
                    }
                    set partName item
                    set partType [lindex [split $attrArr(arrayType) {:}] end]
                    set partType [string map {{[]} {()}} $partType]
                    set partList [list $partName [list type [string trimright ${partType} {()}]() comment {}]]
                }
                extension {
                    set extension [$node selectNodes -namespaces $nsList s:extension]
                    set partList [partList $mode $extension $serviceName results $tns]
                }
            }
        }
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
        }
        set partMax [$element getAttribute maxOccurs 1]
        ::log::log debug "\t\t part is {$partName} {$partType} {$partMax}"

        if {[string equal $partMax 1]} {
            lappend partList $partName [list type $partType comment {}]
        } else {
            lappend partList $partName [list type [string trim ${partType} {()}]() comment {}]
        }
    }
    if {[llength $elements] == 0} {
        #
        # Validate this is not really a complex type
        #
        if {[$node hasChildNodes]} {







|







2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
        }
        set partMax [$element getAttribute maxOccurs 1]
        ::log::log debug "\t\t part is {$partName} {$partType} {$partMax}"

        if {[string equal $partMax 1]} {
            lappend partList $partName [list type $partType comment {}]
        } else {
            lappend partList $partName [list type [string trimright ${partType} {()}]() comment {}]
        }
    }
    if {[llength $elements] == 0} {
        #
        # Validate this is not really a complex type
        #
        if {[$node hasChildNodes]} {
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
            if {([lindex [TypeInfo $mode $serviceName $partType] 0] == 0) &&
                [string equal $typeName $partType]} {
                return
            } else {
                lappend partList $typeName [list type $partType comment {}]
            }
        } else {
            lappend partList $typeName [list type [string trim ${partType} {()}]() comment {}]
        }
    }
    if {[llength $partList]} {
        dict set results types $typeName $partList
        ::WS::Utils::ServiceTypeDef $mode $serviceName $typeName $partList $tns
    } else {
        if {![dict exists $results types $typeName]} {







|







2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
            if {([lindex [TypeInfo $mode $serviceName $partType] 0] == 0) &&
                [string equal $typeName $partType]} {
                return
            } else {
                lappend partList $typeName [list type $partType comment {}]
            }
        } else {
            lappend partList $typeName [list type [string trimright ${partType} {()}]() comment {}]
        }
    }
    if {[llength $partList]} {
        dict set results types $typeName $partList
        ::WS::Utils::ServiceTypeDef $mode $serviceName $typeName $partList $tns
    } else {
        if {![dict exists $results types $typeName]} {