Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlauzond2005-03-24 00:07:43 +0000
committerlauzond2005-03-24 00:07:43 +0000
commitd9b0b7e43ca9b1969d9048ea3016f9b1b5731526 (patch)
treea1d46398dc1a74f18267e9e7a92bef9c81700837 /bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile
parenta9f84a9ac6885a60e65300c78512703f1fc78b8a (diff)
downloadwebtools.webservices-d9b0b7e43ca9b1969d9048ea3016f9b1b5731526.tar.gz
webtools.webservices-d9b0b7e43ca9b1969d9048ea3016f9b1b5731526.tar.xz
webtools.webservices-d9b0b7e43ca9b1969d9048ea3016f9b1b5731526.zip
[Bug 88955] Check in initial WSI contribution
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile')
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/EntryTypeList.java82
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/Profile.java24
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileArtifact.java86
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertions.java123
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertionsReader.java44
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/TestAssertion.java176
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/EntryTypeListImpl.java94
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileArtifactImpl.java123
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsImpl.java194
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsReaderImpl.java515
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/TestAssertionImpl.java256
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/BaseValidator.java51
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EntryContext.java223
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EnvelopeValidator.java52
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/MessageValidator.java68
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/ProfileValidatorFactory.java96
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/UDDIValidator.java54
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/WSDLValidator.java55
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcess.java66
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcessVisitor.java157
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseMessageValidator.java1839
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseValidatorImpl.java714
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/ProfileValidatorFactoryImpl.java75
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1920.java118
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1928.java426
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1005.java167
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1007.java64
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1008.java277
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1009.java315
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1011.java203
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1012.java102
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1013.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1031.java108
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1032.java152
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1033.java126
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1100.java103
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1107.java277
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1201.java77
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1202.java104
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1203.java147
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1204.java302
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1208.java88
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1211.java147
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1212.java165
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1213.java141
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1214.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1301.java198
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1302.java181
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1305.java132
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1306.java114
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1307.java98
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1308.java97
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1309.java124
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1316.java113
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1318.java183
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1600.java267
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1601.java73
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1701.java111
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1755.java167
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4100.java226
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4101.java132
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4102.java114
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4109.java107
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/EnvelopeValidatorImpl.java56
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP1601.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP9704.java126
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1003.java59
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1902.java124
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1915.java136
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1917.java153
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1925.java136
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1926.java210
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1931.java91
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1932.java80
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1933.java257
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1934.java103
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1935.java348
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1936.java72
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1942.java264
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1945.java73
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1946.java64
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5100.java53
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5101.java51
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1001.java101
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1002.java137
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1004.java73
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1006.java69
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1010.java126
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1101.java86
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1103.java80
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1104.java93
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1116.java150
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4103.java126
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4104.java87
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4105.java95
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4106.java77
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4107.java66
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/MessageValidatorImpl.java57
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP1003.java228
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5100.java80
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5101.java67
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1001.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1002.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1003.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1004.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1005.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1006.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1007.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1008.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1009.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1010.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1011.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1012.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1013.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1031.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1100.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1101.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1102.java150
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1103.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1104.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1105.java110
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1107.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1108.java415
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1109.java103
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1110.java104
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1111.java111
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1116.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1121.java162
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1201.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1202.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1203.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1204.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1208.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1211.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1301.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1302.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1305.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1306.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1307.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1308.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1309.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1311.java204
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1316.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1318.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1601.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1701.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4100.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4101.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4102.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4103.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4104.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4105.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4106.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4107.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3001.java160
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3002.java81
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3003.java84
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/UDDIValidatorImpl.java594
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3001.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3002.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3003.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3004.java290
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3005_OBSOLETE.java119
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3006.java165
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3007.java157
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3021.java115
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2901.java146
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2903.java241
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2904.java50
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2906.java216
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2907.java52
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2908.java297
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2909.java215
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2910.java230
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2911.java228
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2930.java136
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2940.java450
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2941.java341
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2944.java234
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2946.java194
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2010.java119
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2011.java343
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2012.java123
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2013.java91
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2014.java286
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2017.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2018.java195
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2019.java124
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2020.java162
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2021.java112
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2022.java82
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2023.java85
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2032.java86
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2034.java94
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2098.java69
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2101.java118
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2102.java203
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2103.java130
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2104.java100
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2105.java232
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2107.java202
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2108.java94
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2110.java98
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2111.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2112.java204
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2113.java159
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2114.java278
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2115.java97
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2116.java88
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2117.java183
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2118.java98
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2119.java165
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2120.java247
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2121.java174
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2122.java109
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2123.java357
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2201.java189
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2202.java423
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2208.java72
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2402.java69
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2404.java76
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2406.java166
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2416.java209
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2417.java160
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2700.java82
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2701.java89
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2703.java111
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2803.java87
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4200.java162
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4201.java144
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4202.java135
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2209.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2402.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2403.java191
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSDLValidatorImpl.java2319
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2010.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2011.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2012.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2013.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2014.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2017.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2018.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2019.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2020.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2021.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2022.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2032.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2098.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2099.java157
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2100.java171
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2101.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2102.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2103.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2104.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2105.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2107.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2108.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2110.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2111.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2112.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2113.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2114.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2115.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2116.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2117.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2118.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2119.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2120.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2122.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2123.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2201.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2202.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2208.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2402.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2403.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2404.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2406.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2416.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2417.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2700.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2701.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2703.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4200.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4201.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4202.java26
285 files changed, 35095 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/EntryTypeList.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/EntryTypeList.java
new file mode 100644
index 000000000..6f4dbebde
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/EntryTypeList.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile;
+
+import org.eclipse.wst.wsi.internal.document.DocumentElement;
+
+/**
+ * This interface is used to maintain a profile EntryTypeList.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface EntryTypeList extends DocumentElement
+{
+ /**
+ * Log input.
+ */
+ public static final String LOG_INPUT_NONE = "none";
+ public static final String LOG_INPUT_REQUEST = "request";
+ public static final String LOG_INPUT_RESPONSE = "response";
+
+ /**
+ * WSDL input.
+ */
+ public static final String WSDL_INPUT_NONE = "none";
+
+ /**
+ * UDDI input.
+ */
+ public static final String UDDI_INPUT_NONE = "none";
+
+ /**
+ * Get log input.
+ * @return log input.
+ * @see #setLogInput
+ */
+ public String getLogInput();
+
+ /**
+ * Set log input.
+ * @param logInput log input.
+ * @see #getLogInput
+ */
+ public void setLogInput(String logInput);
+
+ /**
+ * Get WSDL input.
+ * @return WSDL input.
+ * @see #setWSDLInput
+ */
+ public String getWSDLInput();
+
+ /**
+ * Set WSDL input.
+ * @param wsdlInput WSDL input.
+ * @see #getWSDLInput
+ */
+ public void setWSDLInput(String wsdlInput);
+
+ /**
+ * Get UDDI input.
+ * @return UDDI input.
+ * @see #setUDDIInput
+ */
+ public String getUDDIInput();
+
+ /**
+ * Set UDDI input.
+ * @param uddiInput UDDI input.
+ * @see #getUDDIInput
+ */
+ public void setUDDIInput(String uddiInput);
+
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/Profile.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/Profile.java
new file mode 100644
index 000000000..d45fe59dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/Profile.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile;
+
+import org.eclipse.wst.wsi.internal.document.DocumentElement;
+
+/**
+ * This interface is used to maintain Profile information.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface Profile extends DocumentElement
+{
+
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileArtifact.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileArtifact.java
new file mode 100644
index 000000000..73c9bcb90
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileArtifact.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.document.DocumentElement;
+import org.eclipse.wst.wsi.internal.util.ArtifactType;
+
+import javax.xml.namespace.QName;
+
+import java.util.*;
+
+/**
+ * An artifact contains a set of related test assertions.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface ProfileArtifact extends DocumentElement
+{
+ /**
+ * Element name.
+ */
+ public static final String ELEM_NAME = WSIConstants.ELEM_ARTIFACT;
+
+ /**
+ * QName.
+ */
+ public static final QName QNAME =
+ new QName(WSIConstants.NS_URI_WSI_ASSERTIONS, ELEM_NAME);
+
+ /**
+ * Get type.
+ * @return artifact type.
+ * @see #setType
+ */
+ public ArtifactType getType();
+
+ /**
+ * Set type.
+ * @param type an artifact type.
+ * @see #getType
+ */
+ public void setType(ArtifactType type);
+
+ /**
+ * Get specification list.
+ * @return specification list.
+ * @see #setSpecificationList
+ */
+ public Vector getSpecificationList();
+
+ /**
+ * Set specification list.
+ * @param specificationList specification list.
+ * @see #getSpecificationList
+ */
+ public void setSpecificationList(Vector specificationList);
+
+ /**
+ * Get test assertion list.
+ * @return test assertion list.
+ */
+ public LinkedList getTestAssertionList();
+
+ /**
+ * Get test assertion.
+ * @param id test assertion id.
+ * @return test assertion.
+ */
+ public TestAssertion getTestAssertion(String id);
+
+ /**
+ * Add test assertion.
+ * @param testAssertion test assertion.
+ */
+ public void addTestAssertion(TestAssertion testAssertion);
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertions.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertions.java
new file mode 100644
index 000000000..e38b4be19
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertions.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.document.WSIDocument;
+
+import javax.xml.namespace.QName;
+
+import java.util.TreeMap;
+import java.util.Vector;
+
+/**
+ * This interface maintains profile assertions.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface ProfileAssertions extends WSIDocument
+{
+ /**
+ * Element name.
+ */
+ public static final String ELEM_NAME = WSIConstants.ELEM_PROFILE_ASSERTIONS;
+
+ /**
+ * QName.
+ */
+ public static final QName QNAME =
+ new QName(WSIConstants.NS_URI_WSI_ASSERTIONS, ELEM_NAME);
+
+ /**
+ * Get list of profiles.
+ * @return list of profiles.
+ * @see #setProfileList
+ */
+ public Vector getProfileList();
+
+ /**
+ * Set list of profiles.
+ * @param profileList list of profiles.
+ * @see #getProfileList
+ */
+ public void setProfileList(Vector profileList);
+
+ /**
+ * Add profile.
+ * @param profile profile.
+ */
+ public void addProfile(Profile profile);
+
+ /**
+ * Get list of artifacts.
+ * @return list of artifacts.
+ * @see #setArtifactList
+ */
+ public TreeMap getArtifactList();
+
+ /**
+ * Get artifact.
+ * @param type an artifact type.
+ * @return a profile artifact based on the given type.
+ */
+ public ProfileArtifact getArtifact(String type);
+
+ /**
+ * Set list of artifacts.
+ * @param artifactList a list pf profile artifiacts.
+ * @see #getArtifactList
+ */
+ public void setArtifactList(TreeMap artifactList);
+
+ /**
+ * Add artifact.
+ * @param artifact profile artifact.
+ */
+ public void addArtifact(ProfileArtifact artifact);
+
+ /**
+ * Get test assertion.
+ * @param id test assertion id.
+ * @return test assertion.
+ */
+ public TestAssertion getTestAssertion(String id);
+
+ /**
+ * Create artifact.
+ * @return newly created profile artifact.
+ */
+ public ProfileArtifact createArtifact();
+
+ /**
+ * Returns the name of the profile test assertion document.
+ * @return the name of the document.
+ */
+ public String getTADName();
+
+ /**
+ * Set the name of the profile test assertion document.
+ * @param documentName the name of the document.
+ */
+ public void setTADName(String documentName);
+
+ /**
+ * Returns the version of the profile test assertion document.
+ * @return the version of the document.
+ */
+ public String getTADVersion();
+
+ /**
+ * Set the version of the profile test assertion document.
+ * @param documentVersion the version of the document.
+ */
+ public void setTADVersion(String documentVersion);
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertionsReader.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertionsReader.java
new file mode 100644
index 000000000..66f05f30b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/ProfileAssertionsReader.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.document.DocumentReader;
+import org.eclipse.wst.wsi.internal.profile.ProfileAssertions;
+
+import java.io.Reader;
+
+/**
+ * Defines the interface used to read a profile assertions documents.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface ProfileAssertionsReader extends DocumentReader
+{
+ /**
+ * Read the profile assertions file.
+ * @param assertionsURI he profile assertions file location.
+ * @return the ProfileAssertions object.
+ * @throws WSIException if problem occur while reading the file.
+ */
+ public ProfileAssertions readProfileAssertions(String assertionsURI)
+ throws WSIException;
+
+ /**
+ * Read the profile assertions file.
+ * @param reader a Reader object.
+ * @return the ProfileAssertions object.
+ * @throws WSIException if problem occur while reading the file.
+ */
+ public ProfileAssertions readProfileAssertions(Reader reader)
+ throws WSIException;
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/TestAssertion.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/TestAssertion.java
new file mode 100644
index 000000000..fed688ce1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/TestAssertion.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile;
+
+import java.util.*;
+
+/**
+ * A test assertion is one assertion in a profile definition.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface TestAssertion
+{
+ public static final String TYPE_INFORMATIONAL = "informational";
+
+ /**
+ * Get test assertion id.
+ * @return test assertion id.
+ * @see #setId
+ */
+ public String getId();
+
+ /**
+ * Set test assertion id.
+ * @param id test assertion id.
+ * @see #getId
+ */
+ public void setId(String id);
+
+ /**
+ * Get test assertion type.
+ * @return test assertion type.
+ * @see #setType
+ */
+ public String getType();
+
+ /**
+ * Set test assertion type.
+ * @param type test assertion type.
+ * @see #getType
+ */
+ public void setType(String type);
+
+ /**
+ * Get test assertion primary entry type name.
+ * @return test assertion primary entry type name.
+ * @see #setEntryTypeName
+ */
+ public String getEntryTypeName();
+
+ /**
+ * Set test assertion primary entry type name.
+ * @param entryTypeName test assertion primary entry type name.
+ * @see #getEntryTypeName
+ */
+ public void setEntryTypeName(String entryTypeName);
+
+ /**
+ * Get enabled indicator.
+ * @return enabled indicator.
+ * @see #setEnabled
+ */
+ public boolean isEnabled();
+
+ /**
+ * Set enabled indicator.
+ * @param enabled enabled indicator.
+ * @see #isEnabled
+ */
+ public void setEnabled(boolean enabled);
+
+ /**
+ * Get context.
+ * @return context.
+ * @see #setContext
+ */
+ public String getContext();
+
+ /**
+ * Set context.
+ * @param context context.
+ * @see #getContext
+ */
+ public void setContext(String context);
+
+ /**
+ * Get assertion description.
+ * @return assertion description.
+ * @see #setAssertionDescription
+ */
+ public String getAssertionDescription();
+
+ /**
+ * Set assertion description.
+ * @param assertionDescription assertion description.
+ * @see #getAssertionDescription
+ */
+ public void setAssertionDescription(String assertionDescription);
+
+ /**
+ * Get failure message.
+ * @return failure message.
+ * @see #setFailureMessage
+ */
+ public String getFailureMessage();
+
+ /**
+ * Set failure message.
+ * @param failureMessage failure message.
+ * @see #getFailureMessage
+ */
+ public void setFailureMessage(String failureMessage);
+
+ /**
+ * Get failure detail description.
+ * @return failure detail description.
+ * @see #setFailureDetailDescription
+ */
+ public String getFailureDetailDescription();
+
+ /**
+ * Set failure detail description.
+ * @param failureDetailDescription failure detail description.
+ * @see #getFailureDetailDescription
+ */
+ public void setFailureDetailDescription(String failureDetailDescription);
+
+ /**
+ * Get detail description.
+ * @return detail description.
+ * @see #setDetailDescription
+ */
+ public String getDetailDescription();
+
+ /**
+ * Set detail description.
+ * @param detailDescription detail description.
+ * @see #getDetailDescription
+ */
+ public void setDetailDescription(String detailDescription);
+
+ /**
+ * Get additional entry type list.
+ * @return additional entry type list.
+ * @see #setAdditionalEntryTypeList
+ */
+ public EntryTypeList getAdditionalEntryTypeList();
+
+ /**
+ * Set additional entry type list.
+ * @param entryTypeList additional entry type list.
+ * @see #getAdditionalEntryTypeList
+ */
+ public void setAdditionalEntryTypeList(EntryTypeList entryTypeList);
+
+ /**
+ * Get list of prereq ids.
+ * @return list of prereq ids.
+ */
+ public Vector getPrereqIdList();
+
+ /**
+ * Add prereq test assertion id.
+ * @param prereqId prereq test assertion id.
+ */
+ public void addPrereqId(String prereqId);
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/EntryTypeListImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/EntryTypeListImpl.java
new file mode 100644
index 000000000..3a50077a5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/EntryTypeListImpl.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.impl;
+
+import org.eclipse.wst.wsi.internal.profile.EntryTypeList;
+
+/**
+ * This implementation is used to maintain a profile EntryTypeList.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public class EntryTypeListImpl implements EntryTypeList
+{
+ /**
+ * Log input.
+ */
+ protected String logInput = null;
+
+ /**
+ * WSDL input.
+ */
+ protected String wsdlInput = null;
+
+ /**
+ * UDDI input.
+ */
+ protected String uddiInput = null;
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.EntryTypeList#getLogInput()
+ */
+ public String getLogInput()
+ {
+ return this.logInput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.EntryTypeList#setLogInput(String)
+ */
+ public void setLogInput(String logInput)
+ {
+ this.logInput = logInput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.EntryTypeList#getWSDLInput()
+ */
+ public String getWSDLInput()
+ {
+ return this.wsdlInput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.EntryTypeList#setWSDLInput(String)
+ */
+ public void setWSDLInput(String wsdlInput)
+ {
+ this.wsdlInput = wsdlInput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.EntryTypeList#getUDDIInput()
+ */
+ public String getUDDIInput()
+ {
+ return this.uddiInput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.EntryTypeList#setUDDIInput(String)
+ */
+ public void setUDDIInput(String uddiInput)
+ {
+ this.uddiInput = uddiInput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.DocumentElement#toXMLString(String)
+ */
+ public String toXMLString(String namespaceName)
+ {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileArtifactImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileArtifactImpl.java
new file mode 100644
index 000000000..4c27dd757
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileArtifactImpl.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.impl;
+
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.util.ArtifactType;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import java.util.Vector;
+
+/**
+ * An artifact contains a set of related test assertions.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public class ProfileArtifactImpl implements ProfileArtifact
+{
+ /**
+ * Artifact type.
+ */
+ protected ArtifactType type;
+
+ /**
+ * Test assertion map.
+ */
+ protected TreeMap testAssertionMap = new TreeMap();
+
+ /**
+ * Test assertion list.
+ */
+ protected LinkedList testAssertionList = new LinkedList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#getType()
+ */
+ public ArtifactType getType()
+ {
+ return this.type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#setType(ArtifactType)
+ */
+ public void setType(ArtifactType type)
+ {
+ this.type = type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#getSpecificationList()
+ */
+ public Vector getSpecificationList()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#setSpecificationList(Vector)
+ */
+ public void setSpecificationList(Vector specificationList)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#getTestAssertionList()
+ */
+ public LinkedList getTestAssertionList()
+ {
+ return this.testAssertionList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#getTestAssertion(String)
+ */
+ public TestAssertion getTestAssertion(String id)
+ {
+ return (TestAssertion) this.testAssertionMap.get(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ReportArtifact#addTestAssertion(TestAssertion)
+ */
+ public void addTestAssertion(TestAssertion testAssertion)
+ {
+ // ADD: Need to merge the list and map
+ this.testAssertionMap.put(testAssertion.getId(), testAssertion);
+ this.testAssertionList.add(testAssertion);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.DocumentElement#toXMLString(String)
+ */
+ public String toXMLString(String namespaceName)
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+
+ String nsName = namespaceName;
+ if ((!nsName.equals("") && (!nsName.endsWith(":"))))
+ nsName += ":";
+
+ // ReportArtifact
+ pw.println(" <" + nsName + ELEM_NAME + ">");
+
+ pw.println(" </" + nsName + ELEM_NAME + ">");
+
+ return sw.toString();
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsImpl.java
new file mode 100644
index 000000000..8453dc20c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsImpl.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.impl;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.profile.Profile;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.ProfileAssertions;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+
+import java.util.Iterator;
+import java.util.TreeMap;
+
+/**
+ * This class ...
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public class ProfileAssertionsImpl implements ProfileAssertions
+{
+ /**
+ * Location of the profile definition.
+ */
+ protected String documentURI;
+
+ /**
+ * Name of the profile test assertion document.
+ */
+ protected String documentName;
+
+ /**
+ * Version of the profile test assertion document.
+ */
+ protected String documentVersion;
+
+ // ADD: A profile definition should also have a description.
+
+ /**
+ * List of profiles.
+ */
+ Vector profileList = new Vector();
+
+ /**
+ * List of artifacts.
+ */
+ TreeMap artifactList = new TreeMap();
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#getProfileList()
+ */
+ public Vector getProfileList()
+ {
+ return this.profileList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#setProfileList(Vector)
+ */
+ public void setProfileList(Vector profileList)
+ {
+ this.profileList = profileList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#addProfile(Profile)
+ */
+ public void addProfile(Profile profile)
+ {
+ this.profileList.add(profile);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#getArtifactList()
+ */
+ public TreeMap getArtifactList()
+ {
+ return this.artifactList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#getArtifact(java.lang.String)
+ */
+ public ProfileArtifact getArtifact(String type)
+ {
+ return (ProfileArtifact) this.artifactList.get(type);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#setArtifactList(TreeMap)
+ */
+ public void setArtifactList(TreeMap artifactList)
+ {
+ this.artifactList = artifactList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#addArtifact(ReportArtifact)
+ */
+ public void addArtifact(ProfileArtifact artifact)
+ {
+ this.artifactList.put(artifact.getType(), artifact);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#getTestAssertion(String)
+ */
+ public TestAssertion getTestAssertion(String id)
+ {
+ TestAssertion testAssertion = null;
+
+ // Go through the list of artifacts and find the test assertion
+ Iterator iterator = artifactList.values().iterator();
+ while ((iterator.hasNext()) && (testAssertion == null))
+ {
+ testAssertion = ((ProfileArtifact) iterator.next()).getTestAssertion(id);
+ }
+
+ return testAssertion;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertions#createArtifact()
+ */
+ public ProfileArtifact createArtifact()
+ {
+ return new ProfileArtifactImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.WSIDocument#getLocation()
+ */
+ public String getLocation()
+ {
+ return this.documentURI;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.WSIDocument#setLocation(String)
+ */
+ public void setLocation(String documentURI)
+ {
+ this.documentURI = documentURI;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.internal.profile.ProfileAssertions#getTADName()
+ */
+ public String getTADName()
+ {
+ return this.documentName;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.internal.profile.ProfileAssertions#setTADName(String)
+ */
+ public void setTADName(String documentName)
+ {
+ this.documentName = documentName;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.internal.profile.ProfileAssertions#getTADVersion()
+ */
+ public String getTADVersion()
+ {
+ return this.documentVersion;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.internal.profile.ProfileAssertions#setTADVersion(String)
+ */
+ public void setTADVersion(String documentVersion)
+ {
+ this.documentVersion = documentVersion;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.DocumentElement#toXMLString(String)
+ */
+ public String toXMLString(String namespaceName)
+ {
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsReaderImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsReaderImpl.java
new file mode 100644
index 000000000..e55fbd98d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/ProfileAssertionsReaderImpl.java
@@ -0,0 +1,515 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.impl;
+
+import java.io.Reader;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.EntryTypeList;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.ProfileAssertions;
+import org.eclipse.wst.wsi.internal.profile.ProfileAssertionsReader;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.util.ArtifactType;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * This class ...
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public class ProfileAssertionsReaderImpl implements ProfileAssertionsReader
+{
+ /**
+ * Profile assertions.
+ */
+ protected ProfileAssertions profileAssertions;
+
+ /**
+ * ReportArtifact list.
+ */
+ protected TreeMap artifactList = new TreeMap();
+
+ /**
+ * Create new reader.
+ */
+ public ProfileAssertionsReaderImpl()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertionsReader#readProfileAssertions(String)
+ */
+ public ProfileAssertions readProfileAssertions(String assertionsURI)
+ throws WSIException
+ {
+ return readProfileAssertions(new InputSource(assertionsURI));
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.ProfileAssertionsReader#readProfileAssertions(Reader)
+ */
+ public ProfileAssertions readProfileAssertions(Reader reader)
+ throws WSIException
+ {
+ return readProfileAssertions(new InputSource(reader));
+ }
+
+ /**
+ * Read profile assertions.
+ */
+ private ProfileAssertions readProfileAssertions(InputSource inputSource)
+ throws WSIException
+ {
+ // Create profile assertions
+ profileAssertions = new ProfileAssertionsImpl();
+
+ // Profile parts are put into a vector
+ artifactList = new TreeMap();
+
+ try
+ {
+ // Create xml reader
+ XMLReader reader = XMLUtils.getXMLReader();
+
+ // Set content handler to inner class
+ reader.setContentHandler(new ProfileAssertionsHandler());
+
+ // Parse profile definition file
+ reader.parse(inputSource);
+ }
+
+ catch (Exception e)
+ {
+ throw new WSIException("Could not read and parse profile definition.", e);
+ }
+ finally
+ {
+ //Check to see if the version of test asssertion document is supported
+ if (!Utils.isValidProfileTADVersion(profileAssertions))
+ {
+ throw new WSIException(
+ "\nVersion "
+ + profileAssertions.getTADVersion()
+ + " of the \""
+ + profileAssertions.getTADName()
+ + "\"\n"
+ + "document is not compatible with this version of"
+ + "\n"
+ + "the test tools.");
+ }
+ }
+
+ // The assertions from the TAD are reordered for purposes of processing. All
+ // assertions of an artifact are reordered such that prerequisites occur
+ // before the assertions they prereq. The assumption is that prerequisites do
+ // not cross artifact types.
+ //
+ Iterator it = artifactList.keySet().iterator();
+ // for each artifact type do reordering assertion
+ while (it.hasNext())
+ {
+ ProfileArtifact art = (ProfileArtifact) artifactList.get(it.next());
+ // result list of the reordering assertions
+ LinkedList res = new LinkedList();
+ Iterator it2 = art.getTestAssertionList().iterator();
+ // sort the artifact assertions into result list
+ while (it2.hasNext())
+ {
+ // call for each assertion ,
+ // if the assertion has the prereq, the prereq will added first into res list
+ sortTestAssertions(art, (TestAssertion) it2.next(), res);
+ }
+ // replace the original assertions list to the prereq reordering assertions list
+ art.getTestAssertionList().clear();
+ art.getTestAssertionList().addAll(res);
+ }
+ // Put the profile parts into the profile definition
+ profileAssertions.setArtifactList(artifactList);
+
+ return profileAssertions;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.DocumentReader#getLocation()
+ */
+ public String getLocation()
+ {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.document.DocumentReader#setLocation(String)
+ */
+ public void setLocation(String documentURI)
+ {
+ }
+
+ /**
+ * Recursive walk to order assertions so that assertions are
+ * processed following the ones that prereq them.
+ * If assertion has prereq, then add it to the result list first.
+ *
+ * @param art profile artifact for call @link ProfileArtifact#getTestAssertion(String)
+ * @param asrt test assertion
+ * @param list result list to sort
+ */
+ private void sortTestAssertions(ProfileArtifact art, TestAssertion asrt, List list)
+ {
+ // if assertion is null or does not exist, then exit
+ if((asrt == null) || list.contains(asrt))
+ return;
+
+ // if it has not prereq, add the asertion and exit
+ if(asrt.getPrereqIdList().isEmpty())
+ {
+ list.add(asrt);
+ return;
+ }
+ // get list prereq assertion and reqursive call sortTestAssertions this each
+ Iterator it = asrt.getPrereqIdList().iterator();
+ while(it.hasNext()) {
+ String id = (String) it.next();
+ sortTestAssertions(art, art.getTestAssertion(id), list);
+ }
+ list.add(asrt);
+ }
+
+ /**
+ * Inner class: ProfileAssertionsHandler
+ */
+ class ProfileAssertionsHandler extends DefaultHandler
+ {
+ private ProfileArtifact artifact = profileAssertions.createArtifact();
+ private String id;
+ private StringBuffer context = null;
+ private StringBuffer assertionDescription = null;
+ private StringBuffer failureMessage = null;
+ private StringBuffer failureDetailDescription = null;
+ private StringBuffer detailDescription = null;
+ private StringBuffer testAssertionId = null;
+ // private Vector prereqIdList = new Vector();
+ private TreeMap assertions = new TreeMap();
+ private String currentElement = null;
+ private TestAssertion testAssertion = null;
+ private StringBuffer logInput = null;
+ private StringBuffer wsdlInput = null;
+ private StringBuffer uddiInput = null;
+ private EntryTypeList entryTypeList = null;
+
+ // Process start element event
+ public void startElement(
+ String namespaceURI,
+ String localName,
+ String qName,
+ Attributes atts)
+ {
+ if (namespaceURI != null
+ && (namespaceURI.equals(WSIConstants.NS_URI_WSI_ASSERTIONS_2003)
+ || namespaceURI.equals(WSIConstants.NS_URI_WSI_ASSERTIONS)))
+ {
+ // Save element name
+ currentElement = localName;
+
+ // <artifact>
+ if (localName.equals(WSIConstants.ELEM_ARTIFACT))
+ {
+ // Create a new profile artifact object
+ artifact = profileAssertions.createArtifact();
+
+ // Set type
+ artifact.setType(
+ ArtifactType.newArtifactType(
+ atts.getValue(WSIConstants.ATTR_TYPE)));
+
+ // ADD: Get specification list
+
+ // Add artifact to list of artifact list
+ artifactList.put(artifact.getType().getTypeName(), artifact);
+ }
+
+ // <testAssertion>
+ else if (localName.equals(WSIConstants.ELEM_TEST_ASSERTION))
+ {
+ // Create test assertion
+ testAssertion = new TestAssertionImpl();
+
+ // Get attribute values
+ testAssertion.setId(atts.getValue("", WSIConstants.ATTR_ID));
+ testAssertion.setType(atts.getValue("", WSIConstants.ATTR_TYPE));
+ testAssertion.setEntryTypeName(
+ atts.getValue("", WSIConstants.ATTR_ENTRY_TYPE));
+ testAssertion.setEnabled(
+ Boolean
+ .valueOf(atts.getValue("", WSIConstants.ATTR_ENABLED))
+ .booleanValue());
+
+ // Add test assertion to artifact
+ artifact.addTestAssertion(testAssertion);
+ }
+
+ // <context>
+ else if (localName.equals(WSIConstants.ELEM_CONTEXT))
+ {
+ context = new StringBuffer();
+ }
+
+ // <assertionDescription>
+ else if (localName.equals(WSIConstants.ELEM_ASSERTION_DESCRIPTION))
+ {
+ assertionDescription = new StringBuffer();
+ }
+
+ // <failureMessage>
+ else if (localName.equals(WSIConstants.ELEM_FAILURE_MESSAGE))
+ {
+ failureMessage = new StringBuffer();
+ }
+
+ // <failureDetailDescription>
+ else if (localName.equals(WSIConstants.ELEM_FAILURE_DETAIL_DESCRIPTION))
+ {
+ failureDetailDescription = new StringBuffer();
+ }
+
+ // <detailDescription>
+ else if (localName.equals(WSIConstants.ELEM_DETAIL_DESCRIPTION))
+ {
+ detailDescription = new StringBuffer();
+ }
+
+ // <testAssertionID>
+ else if (localName.equals(WSIConstants.ELEM_TEST_ASSERTION_ID))
+ {
+ testAssertionId = new StringBuffer();
+ }
+
+ // <additionalEntryTypeList>
+ else if (
+ localName.equals(WSIConstants.ELEM_ADDITIONAL_ENTRY_TYPE_LIST))
+ {
+ // Create entry type list
+ entryTypeList = new EntryTypeListImpl();
+ }
+
+ // <messageInput>
+ else if (localName.equals(WSIConstants.ELEM_MESSAGE_INPUT))
+ {
+ logInput = new StringBuffer();
+ }
+
+ // <wsdlInput>
+ else if (localName.equals(WSIConstants.ELEM_WSDL_INPUT))
+ {
+ wsdlInput = new StringBuffer();
+ }
+ // <profileAssertions>
+ else if (localName.equals(WSIConstants.ELEM_PROFILE_ASSERTIONS))
+ {
+ profileAssertions.setTADName(
+ atts.getValue("", WSIConstants.ATTR_NAME));
+ profileAssertions.setTADVersion(
+ atts.getValue("", WSIConstants.ATTR_VERSION));
+ }
+
+ /* REMOVE:
+ // <uddiInput>
+ else if (localName.equals(WSIConstants.ELEM_UDDI_INPUT)) {
+ uddiInput = new StringBuffer();
+ }
+ */
+ }
+ } // END startElement
+
+ public void endElement(String namespaceURI, String localName, String qname)
+ {
+ // If this is the profile namespace, then check for and process selected elements
+ if (namespaceURI != null
+ && (namespaceURI.equals(WSIConstants.NS_URI_WSI_ASSERTIONS_2003)
+ || namespaceURI.equals(WSIConstants.NS_URI_WSI_ASSERTIONS)))
+ {
+ // <context>
+ if (localName.equals(WSIConstants.ELEM_CONTEXT))
+ {
+ // Set context in test assertion
+ testAssertion.setContext(context.toString());
+ context = null;
+ }
+
+ // <assertionDescription>
+ else if (localName.equals(WSIConstants.ELEM_ASSERTION_DESCRIPTION))
+ {
+ // Set assertion description in test assertion
+ testAssertion.setAssertionDescription(
+ assertionDescription.toString());
+ assertionDescription = null;
+ }
+
+ // <failureMessage>
+ else if (localName.equals(WSIConstants.ELEM_FAILURE_MESSAGE))
+ {
+ // Set failure message in test assertion
+ testAssertion.setFailureMessage(failureMessage.toString());
+ failureMessage = null;
+ }
+
+ // <failureDetailDescription>
+ else if (localName.equals(WSIConstants.ELEM_FAILURE_DETAIL_DESCRIPTION))
+ {
+ // Set failure detail description in test assertion
+ testAssertion.setFailureDetailDescription(
+ failureDetailDescription.toString());
+ failureDetailDescription = null;
+ }
+
+ // <detailDescription>
+ else if (localName.equals(WSIConstants.ELEM_DETAIL_DESCRIPTION))
+ {
+ // Set detail description in test assertion
+ testAssertion.setDetailDescription(detailDescription.toString());
+ detailDescription = null;
+ }
+
+ // <testAssertionID>
+ else if (localName.equals(WSIConstants.ELEM_TEST_ASSERTION_ID))
+ {
+ // Set test assertion id in prereq list
+ testAssertion.addPrereqId(testAssertionId.toString());
+ testAssertionId = null;
+ }
+
+ // <addtionalEntryTypeList>
+ else if (
+ localName.equals(WSIConstants.ELEM_ADDITIONAL_ENTRY_TYPE_LIST))
+ {
+ // Set target list
+ testAssertion.setAdditionalEntryTypeList(entryTypeList);
+ entryTypeList = null;
+ }
+
+ // <messageInput>
+ else if (localName.equals(WSIConstants.ELEM_MESSAGE_INPUT))
+ {
+ // Set test assertion id in prereq list
+ entryTypeList.setLogInput(logInput.toString());
+ logInput = null;
+ }
+
+ // <wsdlInput>
+ else if (localName.equals(WSIConstants.ELEM_WSDL_INPUT))
+ {
+ // Set test assertion id in prereq list
+ entryTypeList.setWSDLInput(wsdlInput.toString());
+ wsdlInput = null;
+ }
+
+ // <profileAssertions>
+ else if (localName.equals(WSIConstants.ELEM_PROFILE_ASSERTIONS))
+ {
+ // a no-op
+ }
+
+ /* REMOVE:
+ // <uddiInput>
+ else if (localName.equals(WSIConstants.ELEM_UDDI_INPUT)) {
+ // Set test assertion id in prereq list
+ entryTypeList.setUDDIInput(uddiInput.toString());
+ uddiInput = null;
+ }
+ */
+ }
+ } // END endElement
+
+ public void characters(char[] ch, int start, int length)
+ {
+ // <context>
+ if ((context != null)
+ && (currentElement.equals(WSIConstants.ELEM_CONTEXT)))
+ {
+ context.append(ch, start, length);
+ }
+
+ // <assertionDescription>
+ else if (
+ (assertionDescription != null)
+ && (currentElement.equals(WSIConstants.ELEM_ASSERTION_DESCRIPTION)))
+ {
+ assertionDescription.append(ch, start, length);
+ }
+
+ // <failureMessage>
+ else if (
+ (failureMessage != null)
+ && (currentElement.equals(WSIConstants.ELEM_FAILURE_MESSAGE)))
+ {
+ failureMessage.append(ch, start, length);
+ }
+
+ // <failureDetailDescription>
+ else if (
+ (failureDetailDescription != null) && (
+ currentElement.equals(WSIConstants.ELEM_FAILURE_DETAIL_DESCRIPTION)))
+ {
+ failureDetailDescription.append(ch, start, length);
+ }
+
+ // <detailDescription>
+ else if (
+ (detailDescription != null)
+ && (currentElement.equals(WSIConstants.ELEM_DETAIL_DESCRIPTION)))
+ {
+ detailDescription.append(ch, start, length);
+ }
+
+ // <testAssertionID>
+ else if (
+ (testAssertionId != null)
+ && (currentElement.equals(WSIConstants.ELEM_TEST_ASSERTION_ID)))
+ {
+ testAssertionId.append(ch, start, length);
+ }
+
+ // <messageInput>
+ else if (
+ (logInput != null)
+ && (currentElement.equals(WSIConstants.ELEM_MESSAGE_INPUT)))
+ {
+ logInput.append(ch, start, length);
+ }
+
+ // <wsdlInput>
+ else if (
+ (wsdlInput != null)
+ && (currentElement.equals(WSIConstants.ELEM_WSDL_INPUT)))
+ {
+ wsdlInput.append(ch, start, length);
+ }
+
+ /* REMOVE:
+ // <uddiInput>
+ else if ((uddiInput != null) && (currentElement.equals(WSIConstants.ELEM_UDDI_INPUT))) {
+ uddiInput.append(ch, start, length);
+ }
+ */
+ }
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/TestAssertionImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/TestAssertionImpl.java
new file mode 100644
index 000000000..c60fc3cfd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/impl/TestAssertionImpl.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.impl;
+
+import org.eclipse.wst.wsi.internal.profile.EntryTypeList;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+
+import java.util.Vector;
+
+/**
+ * This class ...
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public class TestAssertionImpl implements TestAssertion
+{
+ /**
+ * Test assertion id.
+ */
+ protected String id = null;
+
+ /**
+ * Test assertion type.
+ */
+ protected String type = null;
+
+ /**
+ * Test assertion primary entry type name.
+ */
+ protected String entryTypeName = null;
+
+ /**
+ * Test assertion enabled indicator.
+ */
+ protected boolean enabled = true;
+
+ /**
+ * Context.
+ */
+ protected String context = null;
+
+ /**
+ * Assertion description.
+ */
+ protected String assertionDescription = null;
+
+ /**
+ * Failure message.
+ */
+ protected String failureMessage = null;
+
+ /**
+ * Failure detail description.
+ */
+ protected String failureDetailDescription = null;
+
+ /**
+ * Detail description.
+ */
+ protected String detailDescription = null;
+
+ /**
+ * Addtional entry type list.
+ */
+ protected EntryTypeList entryTypeList = null;
+
+ /**
+ * Prereq ID list.
+ */
+ protected Vector prereqIdList = new Vector();
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getId()
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setId(String)
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getType()
+ */
+ public String getType()
+ {
+ return this.type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setType(String)
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getEntryTypeName()
+ */
+ public String getEntryTypeName()
+ {
+ return this.entryTypeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setEntryTypeName(String)
+ */
+ public void setEntryTypeName(String entryTypeName)
+ {
+ this.entryTypeName = entryTypeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#isEnabled()
+ */
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setEnabled(boolean)
+ */
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getContext()
+ */
+ public String getContext()
+ {
+ return context;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setContext(String)
+ */
+ public void setContext(String context)
+ {
+ this.context = context;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getAssertionDescription()
+ */
+ public String getAssertionDescription()
+ {
+ return this.assertionDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setAssertionDescription(String)
+ */
+ public void setAssertionDescription(String assertionDescription)
+ {
+ this.assertionDescription = assertionDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getFailureMessage()
+ */
+ public String getFailureMessage()
+ {
+ return this.failureMessage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setFailureMessage(String)
+ */
+ public void setFailureMessage(String failureMessage)
+ {
+ this.failureMessage = failureMessage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getFailureDetailDescription()
+ */
+ public String getFailureDetailDescription()
+ {
+ return this.failureDetailDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setFailureDetailDescription(String)
+ */
+ public void setFailureDetailDescription(String failureDetailDescription)
+ {
+ this.failureDetailDescription = failureDetailDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getDetailDescription()
+ */
+ public String getDetailDescription()
+ {
+ return this.detailDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setDetailDescription(String)
+ */
+ public void setDetailDescription(String detailDescription)
+ {
+ this.detailDescription = detailDescription;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getAdditionalEntryTypeList()
+ */
+ public EntryTypeList getAdditionalEntryTypeList()
+ {
+ return this.entryTypeList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#setAdditionalEntryTypeList(org.wsi.test.profile.EntryTypeList)
+ */
+ public void setAdditionalEntryTypeList(EntryTypeList entryTypeList)
+ {
+ this.entryTypeList = entryTypeList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#getPrereqIdList()
+ */
+ public Vector getPrereqIdList()
+ {
+ return prereqIdList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.TestAssertion#addPrereqId(String)
+ */
+ public void addPrereqId(String prereqId)
+ {
+ this.prereqIdList.add(prereqId);
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/BaseValidator.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/BaseValidator.java
new file mode 100644
index 000000000..dbb73379e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/BaseValidator.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+
+import org.w3c.dom.Document;
+
+/**
+ * The base interface for the profile validator.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public interface BaseValidator
+{
+ /**
+ * Set all test assertions for an artifact to missingInput.
+ * @throws WSIException if there is any problems while processing.
+ */
+ public void setAllMissingInput() throws WSIException;
+
+ /**
+ * Cleanup after processing all of the test assertions for an artifact.
+ * @throws WSIException if there is any problems during cleanup.
+ */
+ public void cleanup() throws WSIException;
+
+ /**
+ * Parse XML document and validate with a schema document.
+ * @param urlString XML document location.
+ * @param baseURI a base url to assist in locating the XML document.
+ * @param schema the related XML schema.
+ * @return XML document.
+ * @throws WSIException if there are any problems while parsing or
+ * validating the XML document.
+ */
+ public Document parseXMLDocumentURL(
+ String urlString,
+ String baseURI,
+ String schema)
+ throws WSIException;
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EntryContext.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EntryContext.java
new file mode 100644
index 000000000..a760b82e7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EntryContext.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.report.Entry;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+
+import org.w3c.dom.Document;
+
+/**
+ * This class contains the target information needed by a test assertion.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ * @author Graham Turrell (gturrell@uk.ibm.com)
+ */
+public class EntryContext
+{
+ protected Entry entry = null;
+
+ protected MessageEntry request = null;
+ protected MessageEntry response = null;
+ protected MessageEntry messageEntry = null;
+
+ protected Document requestDocument = null;
+ protected Document responseDocument = null;
+ protected Document messageEntryDocument = null;
+
+ protected WSDLDocument wsdlDocument = null;
+
+ protected AnalyzerContext analyzerContext = null;
+
+ /**
+ * Create entry context.
+ * @param entry a message entry.
+ * @param request the request.
+ * @param response the response.
+ */
+ public EntryContext(Entry entry, MessageEntry request, MessageEntry response)
+ {
+ this(entry, request, response, null);
+ }
+
+ /**
+ * Create entry context.
+ * @param entry a message entry.
+ * @param request the request.
+ * @param response the response.
+ * @param analyzerContext the analyzerContext.
+ */
+ public EntryContext(
+ Entry entry,
+ MessageEntry request,
+ MessageEntry response,
+ AnalyzerContext analyzerContext)
+ {
+ this.entry = entry;
+ this.request = request;
+ this.response = response;
+ this.analyzerContext = analyzerContext;
+
+ try
+ {
+ // Parse all documents
+ if(request.isMimeContent())
+ {
+ MimePart part = request.getMimeParts().getRootPart();
+ if ((part != null) && (part.getContent().length() > 0))
+ requestDocument = XMLUtils.parseXML(part.getContent());
+ }
+ else
+ {
+ if (request.getMessage().length() > 0)
+ requestDocument = XMLUtils.parseXML(request.getMessage());
+ }
+
+ if(response.isMimeContent())
+ {
+ MimePart part = response.getMimeParts().getRootPart();
+ if ((part != null) && (part.getContent().length() > 0))
+ responseDocument = XMLUtils.parseXML(part.getContent());
+ }
+ else
+ {
+ if (response.getMessage().length() > 0)
+ responseDocument = XMLUtils.parseXML(response.getMessage());
+ }
+ }
+
+ catch (WSIException we)
+ {
+ }
+
+ // need some exception handling in here and more careful checking
+ if (entry.getEntryType().equals(EntryType.ENTRY_TYPE_REQUEST))
+ {
+ this.messageEntry = request;
+ this.messageEntryDocument = requestDocument;
+ }
+ else
+ {
+ this.messageEntry = response;
+ this.messageEntryDocument = responseDocument;
+ }
+ }
+
+ /**
+ * Create entry context.
+ * @param entry a message entry.
+ * @param wsdlDocument a WSDL document.
+ */
+ public EntryContext(Entry entry, WSDLDocument wsdlDocument)
+ {
+ this.entry = entry;
+ this.wsdlDocument = wsdlDocument;
+ }
+
+ /**
+ * Create entry context.
+ * @param entry a message entry.
+ * @param analyzerContext the analyzerContext.
+ */
+ public EntryContext(Entry entry, AnalyzerContext analyzerContext)
+ {
+ this.entry = entry;
+ this.analyzerContext = analyzerContext;
+ }
+
+ /**
+ * Returns the entry.
+ * @return the entry.
+ */
+ public Entry getEntry()
+ {
+ return this.entry;
+ }
+
+ /**
+ * Returns the request.
+ * @return the request.
+ */
+ public MessageEntry getRequest()
+ {
+ return request;
+ }
+
+ /**
+ * Returns the response.
+ * @return the response.
+ */
+ public MessageEntry getResponse()
+ {
+ return response;
+ }
+
+ /**
+ * Returns the log entry which is not null.
+ * @return the log entry.
+ */
+ public MessageEntry getMessageEntry()
+ {
+ return messageEntry;
+ }
+
+ /**
+ * Returns the request.
+ * @return MessageEntry
+ */
+ public Document getRequestDocument()
+ {
+ return requestDocument;
+ }
+
+ /**
+ * Returns the response.
+ * @return the response.
+ */
+ public Document getResponseDocument()
+ {
+ return responseDocument;
+ }
+
+ /**
+ * Returns the log entry which is not null.
+ * @return the log entry.
+ */
+ public Document getMessageEntryDocument()
+ {
+ return messageEntryDocument;
+ }
+
+ /**
+ * Returns the WSDL document.
+ * @return the WSDL document.
+ */
+ public WSDLDocument getWSDLDocument()
+ {
+ return wsdlDocument;
+ }
+
+ /**
+ * Returns analyzerContext.
+ * @return analyzerContext
+ */
+ public AnalyzerContext getAnalyzerContext()
+ {
+ return this.analyzerContext;
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EnvelopeValidator.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EnvelopeValidator.java
new file mode 100644
index 000000000..70ecf72fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/EnvelopeValidator.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+
+/**
+ * Interface definition for envelope validation test procedure.
+ *
+ * @version 1.0
+ */
+public interface EnvelopeValidator extends BaseValidator
+{
+
+ /**
+ * Initiailize validation test procedure.
+ * @param analyzerContext the analyzerContext.
+ * @param artifact an profile artifact.
+ * @param reportArtifact the report artifact.
+ * @param wsdlDocument the Web service definition
+ * @param reporter the reporter which is used to add errors to the conformance report
+ * @throws WSIException if message validator could not be initialized.
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact artifact,
+ ReportArtifact reportArtifact,
+ WSDLDocument wsdlDocument,
+ Reporter reporter)
+ throws WSIException;
+
+ /**
+ * Validate the envelope located by the log entry.
+ * @param entryContext a log entry locating an envelope.
+ * @throws WSIException if an unexpected error occurred while
+ * processing the log entry.
+ */
+ public void validate(EntryContext entryContext) throws WSIException;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/MessageValidator.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/MessageValidator.java
new file mode 100644
index 000000000..0bf970f76
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/MessageValidator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+
+/**
+ * Interface definition for message validation test procedure.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham
+ * @author Graham Turrell (gturrell@uk.ibm.com)
+ */
+public interface MessageValidator extends BaseValidator
+{
+ /**
+ * HTTP 1.0 version indicator.
+ */
+ public static final String HTTP_VERSION_1_0 = "HTTP/1.0";
+
+ /**
+ * HTTP 1.1 version indicator.
+ */
+ public static final String HTTP_VERSION_1_1 = "HTTP/1.1";
+
+ /**
+ * HTTP POST message indicator.
+ */
+ public static final String HTTP_POST = "POST";
+
+ /**
+ * Initiailize validation test procedure.
+ * @param analyzerContext the analyzerContext.
+ * @param artifact an profile artifact.
+ * @param reportArtifact the report artifact.
+ * @param wsdlDocument the Web service definition
+ * @param reporter the reporter which is used to add errors to the conformance report
+ * @throws WSIException if message validator could not be initialized.
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact artifact,
+ ReportArtifact reportArtifact,
+ WSDLDocument wsdlDocument,
+ Reporter reporter)
+ throws WSIException;
+
+ /**
+ * Validate the message located by the log entry.
+ * @param entryContext a log entry locating a message.
+ * @throws WSIException if an unexpected error occurred while
+ * processing the log entry.
+ */
+ public void validate(EntryContext entryContext) throws WSIException;
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/ProfileValidatorFactory.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/ProfileValidatorFactory.java
new file mode 100644
index 000000000..ebac27455
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/ProfileValidatorFactory.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.util.WSIProperties;
+
+/**
+* This class is used to access an implementation of a ProfileValidatorFactory abstract class.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham
+ */
+public abstract class ProfileValidatorFactory
+{
+ /**
+ * Create a new instance of a UDDI validator.
+ * @return an object that implements the WSDLValidator interface.
+ * @throws WSIException if UDDI validator cannot be instantiated.
+ */
+ public abstract UDDIValidator newUDDIValidator() throws WSIException;
+
+ /**
+ * Create a new instance of a WSDL validator.
+ * @return an object that implements the WSDLValidator interface.
+ * @throws WSIException if WSDL validator cannot be instantiated.
+ */
+ public abstract WSDLValidator newWSDLValidator() throws WSIException;
+
+ /**
+ * Create a new instance of a message validator.
+ * NOTE: Do we need to differentiate between the tranport and SOAP
+ * message validator?
+ *
+ * @return an object that implements the MessageValidator interface.
+ * @throws WSIException if message validatorcannot be instantiated.
+ */
+ public abstract MessageValidator newMessageValidator() throws WSIException;
+
+ /**
+ * Create a new instance of an envelope validator.
+ * @return an object that implements the EnvelopeValidator interface.
+ * @throws WSIException if message validator cannot be instantiated.
+ */
+ public abstract EnvelopeValidator newEnvelopeValidator() throws WSIException;
+
+ /**
+ * Instantiate the implementation of the ProfileValidatorFactory class.
+ * The implementation class for this interface is specified in the following
+ * Java system property:
+ * <UL>
+ * <LI>wsi.profile.validator.factory
+ * </UL>
+ *
+ * @return the ProfileValidatorFactory object.
+ * @throws WSIException if factory class cannot be instantiated.
+ */
+ public static ProfileValidatorFactory newInstance() throws WSIException
+ {
+ ProfileValidatorFactory factory = null;
+ String factoryClassName = null;
+
+ try
+ {
+ // Get factory class name
+ factoryClassName =
+ WSIProperties.getProperty(
+ WSIProperties.PROP_VALIDATOR_FACTORY,
+ WSIProperties.DEF_VALIDATOR_FACTORY);
+
+ // Create the factory class
+ Class factoryClass = Class.forName(factoryClassName);
+
+ // Instantiate the factory
+ factory = (ProfileValidatorFactory) factoryClass.newInstance();
+ }
+
+ catch (Exception e)
+ {
+ throw new WSIException(
+ "Could not instantiate factory class: " + factoryClassName + ".",
+ e);
+ }
+
+ // Return factory
+ return factory;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/UDDIValidator.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/UDDIValidator.java
new file mode 100644
index 000000000..f92fb2f0f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/UDDIValidator.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.analyzer.config.UDDIReference;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+
+/**
+ * The WSDL validator will verify that the WSDL and associated XML schema definitions
+ * are in conformance with the profile.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham
+ */
+public interface UDDIValidator extends BaseValidator
+{
+ /**
+ * Initiailize validation test procedure.
+ * @param analyzerContext the analyzerContext.
+ * @param artifact an profile artifact.
+ * @param reportArtifact the report artifact.
+ * @param uddiReference a UDDI reference.
+ * @param reporter a Reporter object.
+ * @throws WSIException if UDDI validator could not be initialized.
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact artifact,
+ ReportArtifact reportArtifact,
+ UDDIReference uddiReference,
+ Reporter reporter)
+ throws WSIException;
+
+ /**
+ * Validate the UDDI based service description.
+ * @return If the UDDI entries are valid, then the value returned
+ * is the URL for the WSDL document.
+ * @throws WSIException WSIException if an unexpected error occurred
+ * while processing the UDDIentries.
+ */
+ public String validate() throws WSIException;
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/WSDLValidator.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/WSDLValidator.java
new file mode 100644
index 000000000..8c1cf20f7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/WSDLValidator.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+
+/**
+ * The WSDL validator will verify that the WSDL and associated XML schema definitions
+ * are in conformance with the profile.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham
+ */
+public interface WSDLValidator extends BaseValidator
+{
+ /**
+ * Initiailize validation test procedure.
+ * @param analyzerContext the analyzerContext.
+ * @param artifact the profile artifact.
+ * @param reportArtifact the report artifact.
+ * @param wsdlURL the WSDL document location.
+ * @param wsdlDocument the WSDL document.
+ * @param reporter a Reporter object.
+ * @throws WSIException if WSDL validator could not be initialized.
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact artifact,
+ ReportArtifact reportArtifact,
+ String wsdlURL,
+ WSDLDocument wsdlDocument,
+ Reporter reporter)
+ throws WSIException;
+
+ /**
+ * Validate the WSDL based service description.
+ * @return the WSDL document.
+ * @throws WSIException if an unexpected error occurred
+ * while validating he WSDL based service description.
+ */
+ public WSDLDocument validate() throws WSIException;
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcess.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcess.java
new file mode 100644
index 000000000..d4b868035
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcess.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.report.FailureDetail;
+
+
+/**
+ * Process assertion.
+ */
+public abstract class AssertionProcess
+{
+ protected String result;
+ protected String failureDetailMessage;
+ protected FailureDetail failureDetail;
+ private final BaseValidatorImpl base_validator;
+
+ /**
+ * @param BaseValidatorImpl
+ */
+ public AssertionProcess(BaseValidatorImpl impl)
+ {
+ this.base_validator = impl;
+ }
+
+ /**
+ * Create assertion result.
+ */
+ void reset()
+ {
+ result = AssertionResult.RESULT_PASSED;
+ failureDetailMessage = null;
+ failureDetail = null;
+ }
+
+ /**
+ * Validate assertion.
+ */
+ public abstract AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext targetContext)
+ throws WSIException;
+
+ /**
+ * Verbose output.
+ */
+ public void debug(String message)
+ {
+ if ((base_validator != null) && base_validator.verboseOption)
+ {
+ System.err.println(message);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcessVisitor.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcessVisitor.java
new file mode 100644
index 000000000..5b95c83b0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/AssertionProcessVisitor.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLVisitor;
+import org.w3c.dom.Element;
+
+
+/**
+ * Process assertion using WSDLVisitor interface.
+ */
+public abstract class AssertionProcessVisitor
+ extends AssertionProcess
+ implements WSDLVisitor
+{
+ private final BaseValidatorImpl base_validator;
+
+ /**
+ * @param BaseValidatorImpl
+ */
+ public AssertionProcessVisitor(BaseValidatorImpl impl)
+ {
+ super(impl);
+ this.base_validator = impl;
+ }
+
+ public void visit(Part obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Service obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Types obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Operation obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Input obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Output obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Fault obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Binding obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ BindingOperation obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ BindingInput obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ BindingOutput obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ BindingFault obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Import obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Element obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Message obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Port obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(PortType obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(Definition obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ ExtensibilityElement obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(SOAPBinding obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(SOAPBody obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(SOAPHeader obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ SOAPHeaderFault obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(SOAPFault obj, Object parent, WSDLTraversalContext ctx)
+ {
+ }
+ public void visit(
+ SOAPOperation obj,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseMessageValidator.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseMessageValidator.java
new file mode 100644
index 000000000..a89843d31
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseMessageValidator.java
@@ -0,0 +1,1839 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2003 IBM Corporation, Parasoft and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Parasoft - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.util.URI;
+import org.apache.xerces.xs.XSConstants;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.analyzer.CandidateInfo;
+import org.eclipse.wst.wsi.internal.analyzer.ServiceReference;
+import org.eclipse.wst.wsi.internal.analyzer.config.AnalyzerConfig;
+import org.eclipse.wst.wsi.internal.log.Log;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseValidatorImpl;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl.*;
+import org.eclipse.wst.wsi.internal.report.FailureDetail;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLUtils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.ibm.wsdl.Constants;
+import com.ibm.wsdl.util.xml.DOM2Writer;
+import com.ibm.wsdl.util.xml.DOMUtils;
+
+/**
+ * The WSDL validator will verify that the WSDL and associated XML schema definitions
+ * are in conformance with the profile.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ * @author Jim Clune
+ * @author Graham Turrell (gturrell@uk.ibm.com)
+ * @author Neil Delima (nddelima@ca.ibm.com)
+ */
+public abstract class BaseMessageValidator
+ extends BaseValidatorImpl
+{
+ /**
+ * WSDL document.
+ */
+ private WSDLDocument wsdlDocument;
+
+ /**
+ * Log entry.
+ */
+ protected MessageEntry logEntry;
+ protected Log log;
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.MessageValidator#init(org.wsi.test.analyzer.AnalyzerContext, org.wsi.test.profile.ProfileArtifact, org.wsi.test.report.ReportArtifact, org.wsi.wsdl.WSDLDocument, org.wsi.test.report.Reporter)
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact profileArtifact,
+ ReportArtifact reportArtifact,
+ WSDLDocument wsdlDocument,
+ Reporter reporter)
+ throws WSIException
+ {
+ // BaseValidatorImpl
+ super.init(analyzerContext, profileArtifact, reportArtifact, reporter);
+
+ // Save input references
+ this.wsdlDocument = wsdlDocument;
+ }
+
+ /**
+ * Returns wsdlDocument
+ * @return wsdlDocument
+ */
+ public WSDLDocument getWSDLDocument()
+ {
+ return wsdlDocument;
+ }
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.MessageValidator#validate(org.wsi.test.profile.validator.EntryContext)
+ */
+ public void validate(EntryContext entryContext) throws WSIException
+ {
+ //Entry entry = null;
+
+ // Save log entry to be referenced by other methods
+ this.logEntry = entryContext.getMessageEntry();
+
+ // Get reference to the analyzer config object
+ AnalyzerConfig analyzerConfig =
+ reporter.getReport().getReportContext().getAnalyzer().getAnalyzerConfig();
+
+ /* If Service Description (WSDL/UDDI) NOT supplied in analyzer config OR
+ * Service Description IS supplied and the current message correlates to it...
+ */
+ if ((wsdlDocument == null)
+ || messageCorrelatesToService(
+ entryContext,
+ analyzerConfig.getCorrelationType()))
+ {
+ // now inner classes moved out from the validator
+ //String classPrefix = this.getClass().getName() + "$";
+ String classPrefix = this.getClass().getPackage().getName()+".";
+
+ // Process assertions for this artifact against the target context
+ processAssertions(classPrefix, entryContext);
+ }
+ }
+
+ /**
+ * Check whether the message correlates to the service under test.
+ * Use the request part of the request-response pair, from which the correlation of the response is implied.
+ * Entities from the Service under test are determined once for all.
+ * @param entryContext an entry context.
+ * @param correlationType a correlation type.
+ * @return true if the message correlates to the service under test.
+ * @throws WSIException if correlation type is not appropriate.
+ */
+ private boolean messageCorrelatesToService(
+ EntryContext entryContext,
+ String correlationType)
+ throws WSIException
+ {
+
+ URI[] endpoints = null;
+ boolean correlation = false;
+
+ /* TEMP: Get it from analyzer config passed in on init method
+ CandidateInfo candidate = entryContext
+ .getAnalyzerContext()
+ .getCandidateInfo();
+ */
+ CandidateInfo candidate = analyzerContext.getCandidateInfo();
+
+ // Service reference
+ ServiceReference serviceReference = analyzerContext.getServiceReference();
+
+ // Get the definition element
+ Definition definition = candidate.getWsdlDocument().getDefinitions();
+
+ Binding binding = null;
+ if (serviceReference.getWSDLElement().isPort())
+ {
+ // Get service
+ Service service =
+ definition.getService(
+ serviceReference.getWSDLElement().getParentElementQName());
+
+ // Get port
+ Port port = service.getPort(serviceReference.getWSDLElement().getName());
+
+ // Get binding
+ binding = port.getBinding();
+ }
+ else if (serviceReference.getWSDLElement().isBinding())
+ {
+ // Get binding
+ binding =
+ definition.getBinding(serviceReference.getWSDLElement().getQName());
+ }
+
+ if (binding == null)
+ {
+ return false;
+ }
+
+ if ((endpoints = hostAndPortCorrelation(entryContext)) != null
+ && urlPathCorrelation(entryContext, endpoints))
+ {
+
+ /* If correlation type is "endpoint", this is all the correlation that can be done.
+ * (Note - this is incomplete correlation since >1 service could be associated with the endpoint.
+ * Therefore , if messages for different services on the same endpoint appear in the log file
+ * and correlation type is "endpoint", all those messages will be analyzed).
+ */
+ if (correlationType
+ .equals(WSIConstants.ATTRVAL_CORRELATION_TYPE_ENDPOINT))
+ {
+ correlation = true;
+ }
+ else
+ {
+ // always allow GET requests right through if they've passed Endpoint Correlation
+ String requestType = getHttpRequestType(entryContext);
+ if ((requestType != null) && requestType.equalsIgnoreCase("GET"))
+ {
+ correlation = true;
+ }
+ else
+ {
+ // The correlationType is not "endpoint" so continue on to processing for at least
+ // "namespace" correlation...
+
+ // get the operation signature (input & output) from request & response messages...
+ // and do a quick DOM parse
+ Document requestMessage = entryContext.getRequestDocument();
+
+ // Check if namespace is found in request message only
+ if (namespaceCorrelation(binding, requestMessage))
+ {
+ // If namespace found and the correlation type is namespace, then process messages
+ if (correlationType
+ .equals(WSIConstants.ATTRVAL_CORRELATION_TYPE_NAMESPACE))
+ {
+ correlation = true;
+ }
+
+ // If operation is found and correlation type is operation, then process messages
+ else if (
+ (operationCorrelation(binding, requestMessage))
+ && (correlationType
+ .equals(WSIConstants.ATTRVAL_CORRELATION_TYPE_OPERATION)))
+ {
+ correlation = true;
+ }
+ else
+ {
+ // this should never happen if config schema was followed correctly
+ throw new WSIException(
+ "Bad correlation type found in config: " + correlationType);
+ }
+ }
+ }
+ }
+ }
+
+ return correlation;
+ }
+
+ /**
+ * Correlation Check 1: Service Description endpoint vs HTTP Header (test 1)
+ * Check if receiverHostAndPort from request message log matches host & port from WSDL SOAP binding for
+ * the Service under test.
+ * If it does not, stop processing this message pair.
+ * @param entryContext an entry context.
+ * @return if receiverHostAndPort from request message log matches
+ * host & port from WSDL SOAP binding for the Service.
+ * @throws WSIException if problem occurs during correlation check.
+ */
+ private URI[] hostAndPortCorrelation(EntryContext entryContext)
+ throws WSIException
+ {
+
+ // get <receiverHostAndPort> from request message
+ String httpHostAndPort = entryContext.getRequest().getReceiverHostAndPort();
+ // Search endpoint list for a match with <receiverHostAndPort>
+
+ /* TEMP: Get it from analyzer config passed in on init method
+ return entryContext.getAnalyzerContext()
+ .getCandidateInfo()
+ .getEndPoints(httpHostAndPort);
+ */
+ return analyzerContext.getCandidateInfo().getEndPoints(httpHostAndPort);
+ }
+
+ /**
+ * Correlation Check 2: Service Description endpoint vs HTTP Header (test 2)
+ *
+ * Use analyzer config host & port, plus URL path (from request message header HTTP POST)
+ * to look for the corresponding endpoint in the Service Definition.
+ * If it does not, stop processing this message pair.
+ * @param entryContext an entry context.
+ * @param endpoints an array of endpoints.
+ * @return true if corresponding endpoints are found in the Service Definition.
+ * @throws WSIException if problem occurs during correlation check.
+ */
+ private boolean urlPathCorrelation(
+ EntryContext entryContext,
+ URI[] endpoints)
+ throws WSIException
+ {
+
+ // compares: protocol (must be http for POST), host, port and path.
+
+ // get POST URI path from message using Tokenizer
+ Vector requestLine =
+ getHttpRequest(entryContext.getRequest().getHTTPHeaders());
+ if (requestLine == null)
+ {
+ return false; // an unexpected HTTP request type !
+ }
+
+ String requestPath = (String) requestLine.get(1);
+ // Path immediately follows POST
+
+ // compare path with those in the previous generated URI list
+ Vector filteredEndpoints = new Vector();
+ for (int i = 0; i < endpoints.length; i++)
+ {
+ if (endpoints[i].toString().endsWith(requestPath))
+ {
+ filteredEndpoints.add(endpoints[i]);
+ }
+ }
+
+ if (filteredEndpoints.size() == 0)
+ return false;
+
+ // this URI should be unique in the WSDL - there should be at most one match
+ // but if we have at least one, that's sufficient to accept the message
+
+ return true;
+ }
+
+ /**
+ * Correlation Check 3: Service Description namespace.
+ *
+ * Determine if the Service Description declares the namespace that appears in the (request?) message soap body.
+ * Location of relevent namespace :
+ * Operation type - Message Namespace: (compare with) Service Definition Namespace:
+ * (from message? endpoint? where?)
+ * rpc-literal &lt;soap:Body&gt; child namespace. &lt;soapbind:body&gt; namespace.
+ * doc-literal &lt;soap:Body&gt; child namespace. targetNameSpace of schema that
+ * defines &lt;soap:body&gt; child.
+ * If it doesn't match, stop processing this message pair.
+ * @param binding a binding.
+ * @param request a request.
+ * @return true if description declared in the description are the
+ * same as those that appear in the message soap body.
+ * @throws WSIException if problem occurs during correlationcheck.
+ */
+ private boolean namespaceCorrelation(Binding binding, Document request)
+ throws WSIException
+ {
+ boolean namespaceFound = false;
+ String bindingStyle = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+
+ // Get operation namespace from the request soap message
+ String soapOpNS = getSoapBodyChild(request).getNamespaceURI();
+
+ // Get soapbind:binding
+ SOAPBinding soapBinding = null;
+ if ((soapBinding = WSDLUtils.getSoapBinding(binding)) != null)
+ {
+ bindingStyle = soapBinding.getStyle();
+ }
+
+ // Go through each operation in the binding and check for namespace match
+ Iterator operations = binding.getBindingOperations().iterator();
+ while (operations.hasNext() && !(namespaceFound))
+ {
+ BindingOperation bindingOperation = (BindingOperation) operations.next();
+
+ // If rpc-literal, then look at namespace attribute on soapbind:body
+ if (WSDLUtils.isRpcLiteral(bindingStyle, bindingOperation))
+ {
+ // Get soapbind:body element
+ SOAPBody soapBody = WSDLUtils.getInputSoapBody(bindingOperation);
+
+ if ((soapBody.getNamespaceURI() != null)
+ && (soapBody.getNamespaceURI().equals(soapOpNS)))
+ {
+ namespaceFound = true;
+ }
+ }
+
+ // If doc-literal, then check namespace
+ else if (WSDLUtils.isDocLiteral(bindingStyle, bindingOperation))
+ {
+ int partCount;
+ Iterator partsIterator = null;
+
+ // Get first part name from soapbind:body element parts attribute
+ String partName = getFirstPartName(bindingOperation);
+
+ // Get the list of parts from the message
+ Map partsMap = null;
+ if ((partsMap =
+ bindingOperation.getOperation().getInput().getMessage().getParts())
+ != null)
+ {
+ partsIterator = partsMap.values().iterator();
+
+ // If the part name wasn't specified on the soapbind:body element, then process just the first one
+ if (partName == null)
+ partCount = 1;
+ else
+ partCount = partsMap.size();
+
+ for (int i = 0; i < partCount && !namespaceFound; i++)
+ {
+ // Get next part
+ Part part = (Part) partsIterator.next();
+
+ // If part name matches or there is no part name, then check namespace
+ if ((partName == null)
+ || ((partName != null) && (part.getName().equals(partName))))
+ {
+ if ((part.getElementName().getNamespaceURI() != null)
+ && (part.getElementName().getNamespaceURI().equals(soapOpNS)))
+ {
+ namespaceFound = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return namespaceFound;
+ }
+
+ /**
+ * Correlation Check 4 : Service Description "operation"
+ *
+ * Check if the message content matches any of the candidate operation definitions
+ * for request and response in the Service Description.
+ *
+ * For both request and response, look for the soap body child element name
+ * in the list of candidate operation names.
+ * @param binding a binding.
+ * @param requestMessage a request message.
+ * @return true if the message content matches any of the candidate
+ * operation definitions for request and response in the
+ * Service Description.
+ * @throws WSIException if problem occurs during correlationcheck.
+ */
+ private boolean operationCorrelation(
+ Binding binding,
+ Document requestMessage)
+ throws WSIException
+ {
+ boolean operationFound = false;
+
+ String bindingStyle = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+
+ // Get soapbind:binding
+ SOAPBinding soapBinding = null;
+ if ((soapBinding = WSDLUtils.getSoapBinding(binding)) != null)
+ {
+ bindingStyle = soapBinding.getStyle();
+ }
+
+ // Get the first child element from the soap body
+ Element soapBodyChild = getSoapBodyChild(requestMessage);
+
+ // If there is a child element, then check it
+ if (soapBodyChild != null)
+ {
+ // Get operation name from the soap:body
+ String operationName = soapBodyChild.getLocalName();
+
+ // Get operation QName
+ QName operationQName =
+ new QName(soapBodyChild.getNamespaceURI(), operationName);
+
+ // Go through each operation in the binding and check for namespace match
+ Iterator operations = binding.getBindingOperations().iterator();
+ while (operations.hasNext() && !(operationFound))
+ {
+ BindingOperation bindingOperation =
+ (BindingOperation) operations.next();
+
+ // If rpc-literal, then look at namespace attribute on soapbind:body
+ if (WSDLUtils.isRpcLiteral(bindingStyle, bindingOperation))
+ {
+ // Get soapbind:body element
+ if (bindingOperation.getName().equals(operationName))
+ operationFound = true;
+ }
+
+ // If doc-literal, then check namespace
+ else if (WSDLUtils.isDocLiteral(bindingStyle, bindingOperation))
+ {
+ int partCount;
+ Iterator partsIterator = null;
+
+ // Get first part name from soapbind:body element parts attribute
+ String partName = getFirstPartName(bindingOperation);
+
+ // Get the list of parts from the message
+ Map partsMap = null;
+ if ((partsMap =
+ bindingOperation.getOperation().getInput().getMessage().getParts())
+ != null)
+ {
+ partsIterator = partsMap.values().iterator();
+
+ // If the part name wasn't specified on the soapbind:body element, then process just the first one
+ if (partName == null)
+ partCount = 1;
+ else
+ partCount = partsMap.size();
+
+ for (int i = 0; i < partCount && !operationFound; i++)
+ {
+ // Get next part
+ Part part = (Part) partsIterator.next();
+
+ // If part name matches or there is no part name, then check namespace
+ if ((partName == null)
+ || ((partName != null) && (part.getName().equals(partName))))
+ {
+ if ((part.getElementName() != null)
+ && (part.getElementName().equals(operationQName)))
+ {
+ operationFound = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Go through each operation to find a match
+ return operationFound;
+ }
+
+ /**
+ * Create failure detail.
+ * @param message a message.
+ * @param entryContext an entry context.
+ * @return failure detail.
+ */
+ public FailureDetail createFailureDetail(
+ String message,
+ EntryContext entryContext)
+ {
+ FailureDetail failureDetail = reporter.createFailureDetail();
+ failureDetail.setFailureMessage(message);
+ failureDetail.setElementLocation(
+ entryContext.getMessageEntry().getElementLocation());
+ return failureDetail;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isNotApplicable(org.wsi.test.profile.TestAssertion)
+ */
+ protected boolean isNotApplicable(TestAssertion testAssertion)
+ {
+ boolean notApplicable = false;
+
+ // If the additional entry is not available, then set notApplicable
+ if (testAssertion.getAdditionalEntryTypeList().getWSDLInput() != null
+ && !testAssertion.getAdditionalEntryTypeList().getWSDLInput().equals("none")
+ && analyzerContext.getServiceReference().getWSDLLocation() == null)
+ {
+ notApplicable = true;
+ }
+
+ return notApplicable;
+ }
+
+
+ /**
+ * Get POST request.
+ * @param httpHeader an HTTP
+ * @return POST request.
+ */
+ public Vector getPostRequest(String httpHeader)
+ {
+ //Request-Line = Method SP Request-URI SP HTTP-Version CRLF
+ Vector requestLine = new Vector();
+ String startLine = null;
+
+ StringTokenizer httpMessageTokenizer =
+ new StringTokenizer(httpHeader, "\n\r\f");
+
+ if (httpMessageTokenizer.hasMoreTokens())
+ {
+ startLine = httpMessageTokenizer.nextToken();
+ }
+
+ if (startLine.startsWith("POST"))
+ {
+ StringTokenizer startLineTokenizer =
+ new StringTokenizer(startLine, "\u0020");
+ while (startLineTokenizer.hasMoreTokens())
+ {
+ requestLine.add(startLineTokenizer.nextToken());
+ }
+ }
+ return requestLine;
+ }
+
+ /**
+ * Get HTTP request.
+ * @param httpHeader an HTTP
+ * @return HTTP request.
+ */
+ private Vector getHttpRequest(String httpHeader)
+ {
+ //Request-Line = Method SP Request-URI SP HTTP-Version CRLF
+ Vector requestLine = new Vector();
+ String startLine = null;
+
+ StringTokenizer httpMessageTokenizer =
+ new StringTokenizer(httpHeader, "\n\r\f");
+
+ if (httpMessageTokenizer.hasMoreTokens())
+ {
+ startLine = httpMessageTokenizer.nextToken();
+ }
+
+ if (startLine.startsWith("POST") || startLine.startsWith("GET"))
+ {
+ StringTokenizer startLineTokenizer =
+ new StringTokenizer(startLine, "\u0020");
+ while (startLineTokenizer.hasMoreTokens())
+ {
+ requestLine.add(startLineTokenizer.nextToken());
+ }
+ }
+ else
+ {
+ requestLine = null; // signify not POST or GET
+ }
+
+ return requestLine;
+ }
+
+ /**
+ * Get HTTP request type.
+ * @param entryContext an entry context.
+ * @return HTTP request type.
+ */
+ private String getHttpRequestType(EntryContext entryContext)
+ {
+ //Request-Line = Method SP Request-URI SP HTTP-Version CRLF
+
+ String httpHeader = entryContext.getRequest().getHTTPHeaders();
+ String httpRequestType = null;
+ String startLine = null;
+
+ StringTokenizer httpMessageTokenizer =
+ new StringTokenizer(httpHeader, "\n\r\f");
+
+ if (httpMessageTokenizer.hasMoreTokens())
+ {
+ startLine = httpMessageTokenizer.nextToken();
+ StringTokenizer startLineTokenizer =
+ new StringTokenizer(startLine, "\u0020");
+ if (startLineTokenizer.hasMoreTokens())
+ {
+ httpRequestType = startLineTokenizer.nextToken();
+ }
+ }
+ return httpRequestType;
+ }
+
+ /**
+ * Determine if the message is a response for a one-way operation.
+ * @param entryContext an entry context.
+ * @return true if the message is a response for a one-way operation.
+ */
+ public boolean isOneWayResponse(EntryContext entryContext)
+ {
+ boolean oneway = false;
+
+ // TEMP: If this is a response message and there is no content, then set one-way to true
+ // TEMP: Need to find a way to determine if the response is for a one-way message
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equalsIgnoreCase(MessageEntry.TYPE_RESPONSE)
+ && entryContext.getMessageEntry().getMessage().length() == 0)
+ {
+ oneway = true;
+ }
+
+ return oneway;
+ }
+
+ /**
+ * messageIsDocLitSchemaValid.
+ *
+ * Validates the doc-lit messages against the schema found in a candidate wsdl document.
+ *
+ * Identify (or be given) a reference in the wsdl to elements (found in &lt;wsdl:types&gt;&lt;schema&gt;...)
+ * that are immediate children elements in the soap body.
+ * @param entryContext an entry context.
+ * @return true if the document literal message is compliant to the
+ * schema found in a candidate WSDL document.
+ * @throws WSIException if there is a parsing problem during validation.
+ */
+ public boolean messageIsDocLitSchemaValid(EntryContext entryContext)
+ throws WSIException
+ {
+
+ // This method should use a validating parser that is capable of acceppting multiple schema references
+ // programmatically. Then, every schema in candidate wsdl can be passed in to the validator. This avoids the
+ // need to pinpoint a particular schema element from all candidate wsdl:types, corresponding to the
+ // wsdl:operation being used. The pinpointing is an incomplete workaround for parsers not capable
+ // of accepting arrays of scehma references
+ // [ i.e. the DOM factory.setAttribute(JAXP_SCHEMA SOURCE, Object[] {...}) ]
+ // get all xs:schema from all candidate wsdl:types
+ // add each <schema> to an array and pass this array to the validating parser
+ // when validating the/each soap body child.
+
+ // use the referenced WSDL file and its imported files to find schemas
+ List schemaWSDLs = new ArrayList();
+ List inlineSchemas = new ArrayList();
+ List schemaStrings = new ArrayList();
+
+ Definition[] allDefs =
+ analyzerContext.getCandidateInfo().getDefinitions();
+ for (int thisDef = 0; thisDef < allDefs.length; thisDef++)
+ {
+ schemaWSDLs.add(allDefs[thisDef].getDocumentBaseURI());
+ }
+ Iterator fileIterator = schemaWSDLs.iterator();
+ while (fileIterator.hasNext())
+ {
+ // parse file if possible
+ Document wsdlDoc = null;
+ String wsdlURI = (String) fileIterator.next();
+ try
+ {
+ wsdlDoc = XMLUtils.parseXMLDocumentURL(wsdlURI, null);
+ }
+ catch (Exception e)
+ {
+ continue;
+ }
+ Element root = wsdlDoc.getDocumentElement();
+ // find the schema
+ NodeList schemaElements = root.getElementsByTagNameNS(
+ WSITag.ELEM_XSD_SCHEMA.getNamespaceURI(),
+ WSITag.ELEM_XSD_SCHEMA.getLocalPart());
+
+ for (int elem = 0; elem < schemaElements.getLength(); elem++)
+ {
+ Element schema = (Element) schemaElements.item(elem);
+ // copying all the NS declarations from wsdl:definitions wsdl:types
+ copyNSDeclarations(root, schema);
+ copyNSDeclarations((Element) schema.getParentNode(), schema);
+ // Replacing all relative schemaLocation URIs with absolute ones
+ replaceRelativeURIs(schema, wsdlURI);
+ inlineSchemas.add(schema);
+ }
+ }
+
+ // Note that the Xerces parser ONLY accepts an array
+ // of schemas with unique namespaces.
+ if (!duplicateNamespacesDetected(inlineSchemas))
+ {
+ // Serialize the schema elements inside the Types, then use this as
+ // the schema string for the validation
+ Iterator i = inlineSchemas.iterator();
+ while (i.hasNext())
+ {
+ Element schema = (Element)i.next();
+ String schemaString = DOM2Writer.nodeToString(schema);
+ schemaStrings.add(schemaString);
+ }
+
+ NodeList elementList = entryContext.getMessageEntryDocument()
+ .getElementsByTagNameNS(WSITag.ELEM_SOAP_BODY.getNamespaceURI(),
+ WSITag.ELEM_SOAP_BODY.getLocalPart());
+ if (elementList == null || elementList.getLength() != 1)
+ {
+ // should only be a single soap body !
+ return false; // probably an error condition though
+ }
+
+ NodeList soapBodyChildList = ((Element)elementList.item(0)).getChildNodes();
+ for (int child = 0; child < soapBodyChildList.getLength(); child++)
+ {
+ Node soapBodyChild = soapBodyChildList.item(child);
+ if (soapBodyChild.getNodeType() == Node.ELEMENT_NODE)
+ {
+ // do all for now
+ try
+ {
+ // Write out element tree to String
+ String messageContent = DOM2Writer.nodeToString(soapBodyChild);
+ // parse the child element, validating against the schema
+ XMLUtils.parseXML(messageContent, schemaStrings);
+ }
+ catch (WSIException e)
+ {
+ if (e.getTargetException() instanceof SAXException)
+ {
+ // validation failed
+ throw new WSIException(e.getTargetException().getMessage());
+ }
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new WSIException("Validating Parsing problem", e);
+ // Bad things have happened
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Copy the namespace declarations.
+ * @param parent a message.
+ * @param child a stripped message.
+ */
+ private void copyNSDeclarations(Element parent, Element child)
+ {
+ NamedNodeMap nodeMap = parent.getAttributes();
+ for (int nodeId = 0; nodeId < nodeMap.getLength(); nodeId++)
+ {
+ Node node = nodeMap.item(nodeId);
+
+ if ((node.getNodeType() == Node.ATTRIBUTE_NODE)
+ && (node.getNodeName().startsWith("xmlns:")))
+ {
+ String nodeName = node.getNodeName();
+ // If an NS being copied is not the same as the child element has, copy it
+ if (!child.getNodeName().startsWith(
+ nodeName.substring(nodeName.indexOf(":") + 1) + ":"))
+ {
+ String nodeValue = node.getNodeValue();
+ child.setAttribute(node.getNodeName(), node.getNodeValue());
+ }
+ }
+ }
+ }
+
+ /**
+ * Replaces all relative URIs for schemaLocation attributes.
+ * @param schema an xsd:schema element.
+ * @param wsdlURI an URI of WSDL that contains xsd:schema being processed.
+ */
+ private void replaceRelativeURIs(Element schema, String wsdlURI)
+ {
+ // Retrieving all xsd:import elements
+ NodeList imports = schema.getElementsByTagNameNS(
+ WSITag.ELEM_XSD_IMPORT.getNamespaceURI(),
+ WSITag.ELEM_XSD_IMPORT.getLocalPart());
+ // Going through the elements
+ for (int i = 0; i < imports.getLength(); i++)
+ {
+ Element imp = (Element) imports.item(i);
+ // Getting the schemaLocation attribute
+ Attr schemaLocation =
+ XMLUtils.getAttribute(imp, WSITag.ATTR_XSD_SCHEMALOCATION);
+ // If the attribute is present
+ if (schemaLocation != null)
+ {
+ // Trying to create an URI object using attribute's value
+ URI uri = null;
+ try
+ {
+ uri = new URI(schemaLocation.getValue());
+ }
+ catch (Exception e) {}
+ // If the value is not an absolute URI (the URI constructor throws the
+ // MalformedURIException), creating the absolute URI using wsdlURI
+ if (uri == null)
+ {
+ String newURI = wsdlURI.substring(0, wsdlURI.lastIndexOf("/") + 1)
+ + schemaLocation.getValue();
+ try
+ {
+ uri = new URI(newURI);
+ // Setting a new URI as a value for the schemaLocation attribute
+ schemaLocation.setValue(uri.toString());
+ }
+ catch (Exception e) {}
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns binding operation matched for SOAP message.
+ * @param entryType message entry type.
+ * @param doc a message.
+ * @return any binding operation matched, null if it is not found.
+ */
+ public BindingOperation getOperationMatch(EntryType entryType, Document doc)
+ {
+ BindingOperation bindingOperation = null;
+ try
+ {
+ // Getting the name of the first SOAP Body child element
+ QName operation = getOperationFromMessage(doc);
+ if (operation != null)
+ {
+ // Retrieving all the RPC binding operations from wsdl:binding
+ BindingOperation[] rpcBindingOps = getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ analyzerContext.getCandidateInfo().getBindings());
+ // Retrieving binding operation by the given operation name
+ bindingOperation = getOperationMatch(
+ entryType, operation, rpcBindingOps);
+ // If no one RPC operation matched
+ if(bindingOperation == null)
+ {
+ // Retrieving all the document binding operations from wsdl:binding
+ BindingOperation[] docBindingOperations = getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
+ analyzerContext.getCandidateInfo().getBindings());
+ // Retrieving binding operation by given element name
+ BindingOperation[] potentialDocLitOps =
+ getDocLitOperations(entryType, operation, docBindingOperations);
+ // If there is exactly one operation matched
+ if (potentialDocLitOps.length == 1)
+ bindingOperation = potentialDocLitOps[0];
+ }
+ }
+ }
+ catch (Exception e) {}
+
+ return bindingOperation;
+ }
+
+ /**
+ * Match either Input or Output.
+ * @param messageEntryType message entry type.
+ * @param soapMessage soap message.
+ * @param op binding operations.
+ * @return matched operation.
+ */
+ public BindingOperation getOperationMatch(
+ EntryType messageEntryType,
+ Document soapMessage,
+ BindingOperation[] op)
+ {
+ // Get operation from message
+ QName operation = getOperationFromMessage(soapMessage);
+ // list of QNames
+
+ return getOperationMatch(messageEntryType, operation, op);
+ }
+
+ /**
+ * Match either Input or Output.
+ * @param messageEntryType message entry type.
+ * @param operation SOAP operation name.
+ * @param op binding operations.
+ * @return matched operation.
+ */
+ public BindingOperation getOperationMatch(
+ EntryType messageEntryType,
+ QName operation,
+ BindingOperation[] op)
+ {
+ QName checkOperation;
+
+ // Look for a candidate operation in the wsdl that matches this signature.
+ for (int k = 0; k < op.length; k++)
+ {
+ String name = null;
+ List extensibles = null;
+ BindingOperation bindingOp = op[k];
+
+ if (messageEntryType.isType(EntryType.TYPE_MESSAGE_REQUEST)
+ && (bindingOp.getOperation().getInput() != null))
+ {
+ name = bindingOp.getOperation().getName();
+ extensibles = bindingOp.getBindingInput().getExtensibilityElements();
+ }
+ else if (
+ messageEntryType.isType(EntryType.TYPE_MESSAGE_RESPONSE)
+ && (bindingOp.getOperation().getOutput() != null))
+ {
+ name = bindingOp.getOperation().getName() + "Response";
+ extensibles = bindingOp.getBindingOutput().getExtensibilityElements();
+ }
+
+ // Get soap:body
+ SOAPBody soapBody = getSoapBody(extensibles);
+ if (soapBody == null)
+ checkOperation = new QName(name);
+ else
+ checkOperation = new QName(soapBody.getNamespaceURI(), name);
+
+ if (operation != null && operation.equals(checkOperation))
+ {
+ return (bindingOp);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Match either Input or Output.
+ * @param messageEntryType a message entry type.
+ * @param soapMessage a soap message.
+ * @param op binsing operations.
+ * @return matched operation.
+ */
+ public BindingOperation getOperationPartsMatch(
+ EntryType messageEntryType,
+ Document soapMessage,
+ BindingOperation[] op)
+ {
+ Map parts = getPartListFromMessage(soapMessage); // list of QNames
+
+ // Look for a candidate operation in the wsdl that matches this signature.
+ for (int k = 0; k < op.length; k++)
+ {
+
+ Message wsdlMessage = null;
+ List extensibles = null;
+ BindingOperation bindingOp = op[k];
+
+ if (messageEntryType.isType(EntryType.TYPE_MESSAGE_REQUEST)
+ && (bindingOp.getOperation().getInput() != null))
+ {
+ wsdlMessage = bindingOp.getOperation().getInput().getMessage();
+ extensibles = bindingOp.getBindingInput().getExtensibilityElements();
+ }
+ else if (
+ messageEntryType.isType(EntryType.TYPE_MESSAGE_RESPONSE)
+ && (bindingOp.getOperation().getOutput() != null))
+ {
+ wsdlMessage = bindingOp.getOperation().getOutput().getMessage();
+ extensibles = bindingOp.getBindingOutput().getExtensibilityElements();
+ }
+ //wsdlFaultParts = op[k].getFaults();
+ // ADD: check for case when response message is a fault
+
+ if (sameParts(parts, wsdlMessage, getSoapHeader(extensibles)))
+ {
+ return (bindingOp);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * BindingOperation getOperationPartsMatch(..).
+ *
+ * Find one or more matching binding operations from the WSDL corresponding to the
+ * given request-response signature.
+ *
+ * This overloaded version is intended for possible Correlation only (not assertions),
+ * since it checks for an operation signature on a request-response pair.
+ * Assertions now check request & response messages independently.
+ * @param requestMessage a request message.
+ * @param responseMessage a response message.
+ * @param op binding operations.
+ * @return matched operation.
+ */
+ private BindingOperation getOperationPartsMatch(
+ Document requestMessage,
+ Document responseMessage,
+ BindingOperation[] op)
+ {
+ Map inParts = getPartListFromMessage(requestMessage); // list of QNames
+ Map outParts = getPartListFromMessage(responseMessage);
+ // list of QNames
+
+ // Look for a candidate operation in the wsdl that matches this signature.
+ for (int k = 0; k < op.length; k++)
+ {
+
+ //Map wsdlFaultParts = null;
+ Message wsdlInMessage = null;
+ Message wsdlOutMessage = null;
+
+ BindingOperation bindingOp = op[k];
+ if (bindingOp.getOperation().getInput() != null)
+ {
+ wsdlInMessage = bindingOp.getOperation().getInput().getMessage();
+ }
+
+ if (bindingOp.getOperation().getOutput() != null)
+ {
+ wsdlOutMessage = bindingOp.getOperation().getOutput().getMessage();
+ }
+ //wsdlFaultParts = op[k].getFaults();
+ // ADD: check for case when response message is a fault
+
+ if (sameParts(inParts,
+ wsdlInMessage,
+ getSoapHeader(bindingOp.getBindingInput().getExtensibilityElements())))
+ {
+ // match on the request - now check response if its not a fault
+ if (responseMessage != null && isFault(responseMessage))
+ {
+ return (bindingOp);
+ }
+ else if (
+ sameParts(
+ outParts,
+ wsdlOutMessage,
+ getSoapHeader(
+ bindingOp.getBindingOutput().getExtensibilityElements())))
+ {
+ // It does match so treat this as a relevant message pair.
+ // Let the message through for validation.
+ //ADD: could pass the operations list back to the entryContext for the message.
+ return (bindingOp);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the soap:body from a List of extensibility elements.
+ * @param extElems a list of extensibility elements.
+ * @return the soap:body from a List of extensibility elements.
+ */
+ private SOAPBody getSoapBody(List extElems)
+ {
+ // Find the soap body
+ if (extElems != null)
+ {
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ if (extElem.getElementType().equals(WSITag.WSDL_SOAP_BODY))
+ {
+ return (SOAPBody) extElem;
+ }
+ // If the element is mime:multipartRelated
+ else if (extElem.getElementType().equals(WSITag.WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ SOAPBody soapBody = getSoapBody(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ if (soapBody != null)
+ return soapBody;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the SOAPHeader from a List of extensibility elements.
+ * @param extensibles a list of extensibility elements.
+ * @return the SOAPHeader from a List of extensibility elements.
+ */
+ private SOAPHeader getSoapHeader(List extensibles)
+ {
+ SOAPHeader soapHeader = null;
+
+ // find the soap header
+ if (extensibles != null)
+ {
+ Iterator i = extensibles.iterator();
+ while (i.hasNext() && soapHeader == null)
+ {
+ try
+ {
+ soapHeader = (SOAPHeader) i.next();
+ }
+ catch (ClassCastException c)
+ {
+ }
+ }
+ }
+ return soapHeader;
+ }
+
+ /**
+ * Get first part name from soapbind:body element.
+ */
+ private String getFirstPartName(BindingOperation bindingOperation)
+ {
+ String partName = null;
+ List extList = null;
+ Iterator partsIterator = null;
+
+ // Determine if there is a list of parts by finding the soapbind:body element
+ if ((extList =
+ bindingOperation.getBindingInput().getExtensibilityElements())
+ != null)
+ {
+ List partsList = null;
+ Iterator extIterator = extList.iterator();
+ while (extIterator.hasNext() && (partName == null))
+ {
+ Object extElement = extIterator.next();
+ if (extElement instanceof SOAPBody)
+ {
+ if ((partsList = ((SOAPBody) extElement).getParts()) != null)
+ {
+ partsIterator = partsList.iterator();
+
+ // Since this is a doc literal binding there should be only one part name
+ if (partsIterator.hasNext())
+ partName = (String) partsIterator.next();
+ }
+ }
+ }
+ }
+
+ return partName;
+ }
+
+ public BindingOperation[] getDocLitOperations(
+ EntryType messageType,
+ QName partElementQName,
+ BindingOperation[] wsdlOperations)
+ {
+
+ if (messageType.isType(EntryType.ENTRY_TYPE_REQUEST))
+ {
+ return getInputDocLitOperations(partElementQName, wsdlOperations);
+ }
+ else if (messageType.isType(EntryType.ENTRY_TYPE_RESPONSE))
+ {
+ return getOutputDocLitOperations(partElementQName, wsdlOperations);
+ }
+ else
+ {
+ return null; // should be one or the other
+ }
+ }
+
+ private BindingOperation[] getInputDocLitOperations(
+ QName partElementQName,
+ BindingOperation[] wsdlOperations)
+ {
+
+ Vector potentialOps = new Vector();
+
+ for (int i = 0; i < wsdlOperations.length; i++)
+ {
+ if (wsdlOperations[i].getOperation().getInput() != null)
+ {
+ Message message = wsdlOperations[i].getOperation().getInput().getMessage();
+ // If SOAP Body child element is not present and wsdl:message does not have any wsdl:parts, that is the match
+ if (partElementQName == null)
+ {
+ if (message.getParts().isEmpty())
+ potentialOps.add(wsdlOperations[i]);
+ continue;
+ }
+
+ Iterator partsIt = message.getParts().values().iterator();
+ while (partsIt.hasNext())
+ {
+ Part nextPart = (Part) partsIt.next();
+ if (partElementQName.equals(nextPart.getElementName()))
+ {
+ // matching part found (doc-lit) - add to list of possible operation matches
+ potentialOps.add(wsdlOperations[i]);
+ break;
+ }
+ }
+ }
+ }
+ return (BindingOperation[]) potentialOps.toArray(new BindingOperation[0]);
+ }
+
+ private BindingOperation[] getOutputDocLitOperations(
+ QName partElementQName,
+ BindingOperation[] wsdlOperations)
+ {
+
+ Vector potentialOps = new Vector();
+
+ for (int i = 0; i < wsdlOperations.length; i++)
+ {
+ if (wsdlOperations[i].getOperation().getOutput() != null)
+ {
+ Message message = wsdlOperations[i].getOperation().getOutput().getMessage();
+ // If SOAP Body child element is not present and wsdl:message does not have any wsdl:parts, that is the match
+ if (partElementQName == null)
+ {
+ if (message.getParts().isEmpty())
+ potentialOps.add(wsdlOperations[i]);
+ continue;
+ }
+
+ Iterator partsIt = message.getParts().values().iterator();
+ while (partsIt.hasNext())
+ {
+ Part nextPart = (Part) partsIt.next();
+ if (partElementQName.equals(nextPart.getElementName()))
+ {
+ // matching part found (doc-lit) - add to list of possible operation matches
+ potentialOps.add(wsdlOperations[i]);
+ break;
+ }
+ }
+ }
+ }
+ return (BindingOperation[]) potentialOps.toArray(new BindingOperation[0]);
+ }
+
+ /**
+ * Compare soap message element part names with Parts from specified wsdl Operation
+ */
+ private boolean sameParts(HashSet messageParts, Map wsdlParts)
+ {
+
+ // look for the soap-message operation signature
+ Iterator i = wsdlParts.values().iterator();
+ // build a set of Part names
+ HashSet h = new HashSet();
+ while (i.hasNext())
+ {
+ Part p = (Part) i.next();
+ h.add(p.getName());
+ }
+
+ // compare with the parts list from the message (unordered)
+ return (h.equals(messageParts));
+ }
+
+ /**
+ * Compare soap message element part names with Parts from specified wsdl Operation
+ */
+ private boolean sameParts(
+ Map messageParts,
+ Message wsdlMessage,
+ SOAPHeader soapHeader)
+ {
+
+ String soapHeaderPart = null;
+ if (soapHeader != null)
+ soapHeaderPart = soapHeader.getPart();
+
+ // check null conditions
+ if (messageParts == null && wsdlMessage == null)
+ {
+ return true; // simple equality test
+ }
+ else if (messageParts == null || wsdlMessage == null)
+ {
+ return false;
+ }
+
+ Vector v = new Vector();
+ //List wsdlParts = wsdlMessage.getOrderedParts(null);
+ Map wsdlParts = null;
+ if (wsdlMessage.getParts() != null)
+ {
+ wsdlParts = wsdlMessage.getParts();
+ // look for the soap-message operation signature
+ Iterator i = wsdlParts.values().iterator();
+ // build a set of Part names
+ while (i.hasNext())
+ {
+ Part p = (Part) i.next();
+ // do not include the part for the soap:header (if any)
+ if (!p.getName().equals(soapHeaderPart))
+ {
+ // check that the part is associated with the soap:body
+ v.add(new QName(p.getName()));
+ }
+ }
+ // if one of the parts is associated with a soap:header in the binding
+ // (by <soap:header part="{partname}">), remove this from the set
+
+ }
+
+ // compare with the parts list from the message (ordered)
+ if (v.isEmpty() && messageParts.isEmpty())
+ {
+ return true;
+ }
+
+ // PB: Changed to containsAll() since equals() fails when using JRE 1.4
+ if (v.containsAll(messageParts.keySet())
+ && (v.size() == messageParts.size()))
+ {
+ // Check for xsi:type mismatch
+ Iterator parts = messageParts.keySet().iterator();
+ QName partName, xsiType;
+ while (parts.hasNext())
+ {
+ partName = (QName) parts.next();
+
+ // Get xsi:type QName
+ if ((xsiType = (QName) messageParts.get(partName)) != null
+ && wsdlParts != null)
+ {
+ // Get the WSDL part definition
+ Part part = (Part) wsdlParts.get(partName.getLocalPart());
+
+ // If xsiType is NOT derived from the type of the corresponding WSDL part
+ if (!isDerivedType(xsiType, part.getTypeName()))
+ {
+ // return false
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+ else
+ return false;
+ //return (v.equals(messageParts));
+ }
+
+ /**
+ * Checks whether one schema type is derived from another.
+ * @param extType an assumed derived type.
+ * @param type an assumed base type.
+ * @return true if extType is derived from type, false otherwise
+ */
+ public boolean isDerivedType(QName extType, QName type)
+ {
+ // If either of types is null, return false
+ if (extType == null || type == null)
+ return false;
+ // If the types are equal, return true
+ if (extType.equals(type))
+ return true;
+
+ // Going through all schemas
+ Iterator i = wsdlDocument.getSchemas().values().iterator();
+ while (i.hasNext())
+ {
+ XSModel xsModel = (XSModel) i.next();
+ // Retrieving the derived type definition
+ XSTypeDefinition xsType = xsModel.getTypeDefinition(
+ extType.getLocalPart(), extType.getNamespaceURI());
+ // If it is found and derived from the base type, return true
+ if (xsType != null && xsType.derivedFrom(type.getNamespaceURI(),
+ type.getLocalPart(), XSConstants.DERIVATION_NONE))
+ {
+ return true;
+ }
+ }
+ // extType is not derived from type, return false
+ return false;
+ }
+
+ /**
+ * Get a list of QNames of parts from the soap body of the specified message
+ */
+ public Element getSoapBodyChild(Document doc)
+ {
+
+ Element opElem = null;
+ if (doc != null)
+ {
+ Element root = doc.getDocumentElement();
+ NodeList bodies =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Body");
+ // Get the list of soap:body child element names from the request message
+ if (bodies != null && bodies.getLength() > 0)
+ {
+ Element body = (Element) bodies.item(0);
+ NodeList children = body.getChildNodes();
+ for (int i = 0; i < children.getLength() && opElem == null; ++i)
+ {
+ Node n = children.item(i);
+ if (n instanceof Element)
+ {
+ opElem = (Element) n;
+ }
+ }
+ }
+ }
+ return opElem;
+ }
+
+ /** Check whether this message is a soap fault
+ */
+ public boolean isFault(Document doc)
+ {
+ boolean isFault = false;
+
+ if (doc != null)
+ {
+ Element root = doc.getDocumentElement();
+ isFault =
+ (root
+ .getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Fault")
+ .getLength()
+ > 0);
+ }
+
+ return isFault;
+ }
+
+ /**
+ * Check whether this message has a soap body with a child element.
+ */
+ public boolean containsSoapBodyWithChild(Document doc)
+ {
+ boolean contains = false;
+
+ if (doc != null)
+ {
+ contains = ((getSoapBodyChild(doc) == null) ? false : true);
+ }
+
+ return contains;
+ }
+
+ /**
+ * Get SOAPAction value from the HTTP headers.
+ * @param headers HTTP headers
+ * @return SOAPAction value
+ */
+ public String getSoapAction(String headers) throws WSIException
+ {
+ // get SOAPAction
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+ return action;
+ }
+
+ /**
+ * Get a list of QNames of parts from the soap body of the specified message.
+ * This method assumes RPC style message content
+ */
+ private QName getOperationFromMessage(Document doc)
+ {
+ QName operation = null;
+ if (doc != null)
+ {
+ Element root = doc.getDocumentElement();
+ NodeList bodies =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Body");
+ if (bodies != null && bodies.getLength() > 0)
+ {
+ Element body = (Element) bodies.item(0);
+ NodeList children = body.getChildNodes();
+ for (int i = 0; i < children.getLength(); ++i)
+ {
+ Node n = children.item(i);
+ // If element, then this is the operation name
+ if (n instanceof Element)
+ {
+ operation = new QName(n.getNamespaceURI(), n.getLocalName());
+ }
+ }
+ }
+ }
+
+ return operation;
+ }
+
+ /**
+ * Get a list of QNames of parts from the soap body of the specified message.
+ * This method assumes RPC style message content
+ */
+ private Map getPartListFromMessage(Document doc)
+ {
+ Map parts = new HashMap();
+ if (doc != null)
+ {
+ Element root = doc.getDocumentElement();
+ NodeList bodies =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Body");
+ // Get the list of soap:body grand-child element names from the request message
+ // (immediate child is the message name)
+ if (bodies != null && bodies.getLength() > 0)
+ {
+ Element body = (Element) bodies.item(0);
+ NodeList children = body.getChildNodes();
+ for (int i = 0; i < children.getLength(); ++i)
+ {
+ Node n = children.item(i);
+ if (n instanceof Element)
+ {
+ // this is the operation name. Its children are the parts
+ NodeList grandChildren = n.getChildNodes();
+ for (int j = 0; j < grandChildren.getLength(); j++)
+ {
+ Node m = grandChildren.item(j);
+ if (m instanceof Element)
+ {
+ // Determine if the part has an xsi:type
+ Attr attr =
+ XMLUtils.getAttribute(
+ (Element) m,
+ new QName(WSIConstants.NS_URI_XSI, "type"));
+
+ QName xsiType = null;
+
+ // If there is an xsi:type attribute, then get the value as a QName
+ try
+ {
+ if (attr != null)
+ xsiType =
+ DOMUtils.getQName(attr.getNodeValue(), (Element) m);
+ }
+ catch (javax.wsdl.WSDLException we)
+ {
+ }
+
+ // add to the child element list
+ parts.put(
+ new QName(m.getNamespaceURI(), m.getLocalName()),
+ xsiType);
+ }
+ }
+ }
+ }
+ }
+ }
+ return parts;
+ }
+
+ public BindingOperation[] getMatchingBindingOps(
+ String bindingStyle,
+ Binding[] bindings)
+ throws WSIException
+ {
+
+ HashSet bindingOperationsSet = new HashSet();
+
+ // whizz through the bindings, checking for a bindingOperation matching the message
+ for (int i = 0; i < bindings.length; i++)
+ {
+
+ Binding tryBinding = bindings[i];
+ List bindingOps = tryBinding.getBindingOperations();
+
+ if (bindingOps != null)
+ {
+
+ // search through binding Operations
+ Iterator bindingOpIt = tryBinding.getBindingOperations().iterator();
+ while (bindingOpIt.hasNext())
+ {
+
+ BindingOperation bindingOp = (BindingOperation) bindingOpIt.next();
+ // check depends on which binding style is declared in the wsdl
+ SOAPOperation soapOp = WSDLValidatorImpl.getSoapOperation(bindingOp);
+ //GT: move this method to utils
+
+ String style;
+ if ((soapOp == null) || (style = soapOp.getStyle()) == null)
+ {
+ // use the style of the parent bindingOp
+
+ SOAPBinding soapBind = WSDLValidatorImpl.getSoapBinding(tryBinding);
+ //GT: move this method to utils
+ if ((style = soapBind.getStyle()) == null)
+ {
+ style = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ //default
+ }
+ }
+ if (style.equals(bindingStyle))
+ {
+
+ bindingOperationsSet.add(bindingOp);
+
+ }
+ }
+ } // current binding has no bindingOperations, ignore
+ }
+ return (BindingOperation[]) bindingOperationsSet.toArray(
+ new BindingOperation[0]);
+ }
+
+ /**
+ * Checks whether soap:body element is literal.
+ * @param extElements extensibility elements of wsdl:input or wsdl:output
+ * of a binding
+ */
+ public boolean isLiteral(List extElems)
+ {
+ SOAPBody soapBody = getSOAPBody(extElems);
+ if (soapBody != null
+ && soapBody.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * Orders wsdl:part names keeping in mind the "parts" attribute of WSDL soap:body
+ * @param messageParts a list of wsdl:partS
+ * @param extElems extensibility elements in the binding
+ * @return the ordered list of part names
+ */
+ public List orderPartNames(List messageParts, List extElems)
+ {
+ List orderedPartNames = new ArrayList();
+ List bodyParts = null;
+
+ SOAPBody soapBody = getSOAPBody(extElems);
+ if (soapBody != null)
+ bodyParts = soapBody.getParts();
+
+ Iterator i = messageParts.iterator();
+ while (i.hasNext())
+ {
+ String partName = ((Part) i.next()).getName();
+ // If the parts attribute is not specified or contains
+ // the wsdl:part name, then adding part name to the ordered list
+ if (bodyParts == null || bodyParts.contains(partName))
+ orderedPartNames.add(partName);
+ }
+
+ return orderedPartNames;
+ }
+
+ /**
+ * Retrieves the SOAPBody object from a list of extensibility elments in binding
+ * @param extElems extensibility elements
+ * @return the SOAPBody element
+ */
+ public SOAPBody getSOAPBody(List extElems)
+ {
+ if (extElems == null)
+ return null;
+ for (Iterator i = extElems.iterator(); i.hasNext();)
+ {
+ Object obj = i.next();
+ if (obj instanceof SOAPBody)
+ return (SOAPBody) obj;
+ }
+
+ return null;
+ }
+
+ public List resolveSameNamespaces(List schemaElements)
+ {
+ List namespaces = new ArrayList();
+ List result = new ArrayList();
+ Iterator i = schemaElements.iterator();
+ while (i.hasNext())
+ {
+ Element schema = (Element) i.next();
+ String targetNamespace = schema.getAttribute(Constants.ATTR_TARGET_NAMESPACE);
+ if (!namespaces.contains(targetNamespace))
+ {
+ namespaces.add(targetNamespace);
+ List schemas = getSchemasWithSameNamespace(schemaElements, targetNamespace);
+ if (schemas.size() == 1)
+ {
+ result.add(schema);
+ }
+ else
+ {
+ // copying all the NS declarations from wsdl:definitions wsdl:types
+ //copyNSDeclarations(root, schema);
+ copyNSDeclarations((Element) schema.getParentNode(), schema);
+ // Replacing all relative schemaLocation URIs with absolute ones
+ //replaceRelativeURIs(schema, wsdlURI);
+ // Serialize the schema elements inside the Types, then use this as
+ // the schema string for the validation
+ String schemaString =
+ DOM2Writer.nodeToString(schema);
+ // schemaStrings.add(schemaString);
+ }
+ }
+ }
+ return null;
+ }
+
+ public List getSchemasWithSameNamespace(List schemaElements, String targetNamespace)
+ {
+ List result = new ArrayList();
+ Iterator i = schemaElements.iterator();
+ while (i.hasNext())
+ {
+ Element schema = (Element)i.next();
+ String schemaTargetNamespace = schema.getAttribute(Constants.ATTR_TARGET_NAMESPACE);
+ if (schemaTargetNamespace == null)
+ schemaTargetNamespace = "";
+
+ if (schemaTargetNamespace.equals(targetNamespace))
+ {
+ result.add(schema);
+ }
+ }
+ return result;
+ }
+
+ public boolean duplicateNamespacesDetected(List schemaElements)
+ {
+ boolean result = false;
+ List namespaces = new ArrayList();
+ Iterator i = schemaElements.iterator();
+ while (i.hasNext())
+ {
+ Element schema = (Element)i.next();
+ String targetNamespace = schema.getAttribute(Constants.ATTR_TARGET_NAMESPACE);
+ if (targetNamespace == null)
+ targetNamespace = "";
+
+ if (namespaces.contains(targetNamespace))
+ {
+ result = true;
+ break;
+ }
+ else
+ {
+ namespaces.add(targetNamespace);
+ }
+ }
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseValidatorImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseValidatorImpl.java
new file mode 100644
index 000000000..d16933beb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/BaseValidatorImpl.java
@@ -0,0 +1,714 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.TreeMap;
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.BaseValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.EnvelopeValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.report.Entry;
+import org.eclipse.wst.wsi.internal.report.FailureDetail;
+import org.eclipse.wst.wsi.internal.report.PrereqFailedList;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.report.impl.PrereqFailedListImpl;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+import org.eclipse.wst.wsi.internal.xml.XMLDocumentCacheUser;
+import org.eclipse.wst.wsi.internal.xml.dom.ElementLocation;
+
+/**
+ * The WSDL validator will verify that the WSDL and associated XML schema definitions
+ * are in conformance with the profile.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ * @author Graham Turrell (gturrell@uk.ibm.com)
+ */
+public abstract class BaseValidatorImpl
+ extends XMLDocumentCacheUser
+ implements BaseValidator
+{
+
+ /**
+ * A hashtable that maps assertion results to their priorities, 0 is lowest
+ */
+ private static final Hashtable resultPriority = new Hashtable(6);
+ static {
+ resultPriority.put(AssertionResult.RESULT_PASSED, new Integer(0));
+ resultPriority.put(AssertionResult.RESULT_NOT_APPLICABLE, new Integer(1));
+ resultPriority.put(AssertionResult.RESULT_MISSING_INPUT, new Integer(2));
+ resultPriority.put(AssertionResult.RESULT_WARNING, new Integer(3));
+ resultPriority.put(AssertionResult.RESULT_PREREQ_FAILED, new Integer(4));
+ resultPriority.put(AssertionResult.RESULT_FAILED, new Integer(5));
+ }
+
+ /**
+ * The highest priority value being passed when processing pre-requisites
+ */
+ private static final int MAX_VALID_PRIORITY = 1;
+
+ /**
+ * Analyzer context.
+ */
+ public AnalyzerContext analyzerContext;
+
+ /**
+ * Profile artifact.
+ */
+ protected ProfileArtifact profileArtifact;
+
+ /**
+ * Reporter.
+ */
+ protected Reporter reporter;
+
+ /**
+ * Entry.
+ */
+ // protected Entry entry;
+
+ /**
+ * Report artifact.
+ */
+ protected ReportArtifact reportArtifact;
+
+ /**
+ * Verbose option.
+ */
+ public boolean verboseOption = false;
+
+ /**
+ * Test assertion processed count.
+ */
+ protected int assertionCount = 0;
+
+ /**
+ * Constructor.
+ */
+ public BaseValidatorImpl()
+ {
+ }
+
+ /**
+ * Initiailize validation test procedure.
+ * @param analyzerContext the analyzerContext.
+ * @param profileArtifact the profile artifiact.
+ * @param reportArtifact the report artifact.
+ * @param reporter a Reporter object.
+ * @throws WSIException if validator could not be initialized.
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact profileArtifact,
+ ReportArtifact reportArtifact,
+ Reporter reporter)
+ throws WSIException
+ {
+ // Save input references
+ this.analyzerContext = analyzerContext;
+ this.profileArtifact = profileArtifact;
+ this.reportArtifact = reportArtifact;
+ this.reporter = reporter;
+
+ // Make sure that the XML document cache is updated in the analyzer context
+ this.documentList = this.analyzerContext.getDocumentList();
+
+ // Get verbose option
+ verboseOption =
+ reporter
+ .getReport()
+ .getReportContext()
+ .getAnalyzer()
+ .getAnalyzerConfig()
+ .getVerboseOption();
+ }
+
+ /**
+ * Process all of the test assertions for one entry.
+ * @param classPrefix a class prefix.
+ * @param entryContext an entry context.
+ * @throws WSIException if serious problems occur while processing
+ * all of the test assertions for an entry.
+ */
+ protected void processAssertions(
+ String classPrefix,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ long startTime = 0;
+
+ HashMap processList = new HashMap();
+ TestAssertion testAssertion = null;
+ AssertionProcess assertionProcess;
+ AssertionResult assertionResult;
+
+ TreeMap preReqResults;
+ PrereqFailedList prereqFailedList;
+ String preReqId;
+
+ Class[] paramTypes = new Class[1];
+ // If this is an instance of MessageValidator or EnvelopeValidator
+ // then use BaseMessageValidator as a param type of assertions constructor
+ paramTypes[0] = this instanceof BaseMessageValidator ?
+ BaseMessageValidator.class : this.getClass();
+
+ Object[] params = new Object[1];
+ params[0] = this;
+
+ // Get entry from context
+ Entry entry = entryContext.getEntry();
+
+ // Add entry to artifact
+ this.reportArtifact.addEntry(entry);
+
+ // Add entry to report
+ if (this instanceof EnvelopeValidator)
+ this.reporter.setCurrentEnvelopeEntry(entry);
+ else this.reporter.setCurrentEntry(entry);
+
+ try
+ {
+ // Go through the list of test assertions for the artifact
+ Iterator iterator = profileArtifact.getTestAssertionList().iterator();
+ while (iterator.hasNext())
+ {
+ // Get next test assertion
+ testAssertion = (TestAssertion) iterator.next();
+
+ // Reset variables
+ assertionResult = null;
+
+ // If the test assertion is enabled, then continue
+ // if ((testAssertion.isEnabled()) &&
+ // testAssertion.getEntryTypeName().equals(targetContext.getEntry().getEntryType().getTypeName())) {
+ if (testAssertion.isEnabled()
+ && isPrimaryEntryTypeMatch(testAssertion, entryContext))
+ {
+ try
+ {
+ // Add 1 to assertion processed count
+ assertionCount++;
+
+ // If the assertion process hasn't been created yet, then create it
+ if ((assertionProcess =
+ (AssertionProcess) processList.get(testAssertion.getId()))
+ == null)
+ {
+
+ // Create a new assertion process
+ Class assertionClass =
+ Class.forName(classPrefix + testAssertion.getId());
+
+ assertionProcess =
+ (AssertionProcess) assertionClass.getConstructor(
+ paramTypes).newInstance(
+ params);
+
+ // Add it to the list
+ processList.put(testAssertion.getId(), assertionProcess);
+ }
+
+ // Check whether entry is null
+ if (entry.getEntryDetail() == null)
+ {
+ assertionResult =
+ createAssertionResult(
+ testAssertion,
+ AssertionResult.RESULT_MISSING_INPUT,
+ (String) null);
+ }
+
+ // Check to see if the test assertion should be run
+ //if (isNotApplicable(testAssertion, entryContext)) {
+ else if (isNotApplicable(testAssertion))
+ {
+ assertionResult =
+ createAssertionResult(
+ testAssertion,
+ AssertionResult.RESULT_NOT_APPLICABLE,
+ (String) null);
+ }
+ else
+ {
+ // Processing all the assertion pre-requisites
+
+ preReqResults = null;
+ prereqFailedList = null;
+ // Get list of pre-reqs for specified assertion
+ Iterator i = testAssertion.getPrereqIdList().iterator();
+ while (i.hasNext())
+ {
+ if (preReqResults == null)
+ preReqResults = new TreeMap();
+ // Get next id
+ preReqId = (String) i.next();
+ // Get the prereq result
+ AssertionResult preReqResult = reporter.getAssertionResult(preReqId);
+
+ // Adding a result priority value to preReqResults
+ preReqResults.put(
+ resultPriority.get(preReqResult.getResult()),
+ preReqResult.getResult());
+
+ // If the prereq failed, then add it to the list
+ if (((Integer)resultPriority.get(preReqResult.getResult())).intValue()
+ > MAX_VALID_PRIORITY)
+ {
+ // Adding failed prereq ID to the list
+ if (prereqFailedList == null)
+ prereqFailedList = new PrereqFailedListImpl();
+ prereqFailedList.addTestAssertionID(preReqId);
+ }
+ }
+
+ if (prereqFailedList != null) {
+ // Getting the highest pre-requisites' result
+ Integer maxRes = (Integer)preReqResults.lastKey();
+ String resString = (String)preReqResults.get(maxRes);
+ if (resString.equals(AssertionResult.RESULT_FAILED)
+ ||resString.equals(AssertionResult.RESULT_WARNING)) {
+ resString = AssertionResult.RESULT_PREREQ_FAILED;
+ }
+ // Create assertion result based on pre-requisites which are not passed
+ assertionResult = createAssertionResult(testAssertion, resString, prereqFailedList);
+ }
+
+ // Pre-requisites are passed, validate current assertion
+ else {
+
+ // Reset test assertion
+ assertionProcess.reset();
+
+ // VERBOSE
+ if (verboseOption)
+ {
+ System.err.println(
+ " Processing "
+ + testAssertion.getId()
+ + " for entry reference ID ["
+ + entry.getReferenceID()
+ + "] ...");
+ startTime = System.currentTimeMillis();
+ }
+
+ // Validate the target
+ assertionResult =
+ assertionProcess.validate(testAssertion, entryContext);
+
+ // Make sure that the XML document cache is updated in the analyzer context
+ this.analyzerContext.setDocumentList(documentList);
+
+ // VERBOSE
+ if (verboseOption)
+ {
+ System.err.println(
+ " Elapsed time: "
+ + (System.currentTimeMillis() - startTime)
+ + "ms");
+ }
+ }
+ }
+
+ // Add result to the report
+ reporter.addAssertionResult(assertionResult);
+ }
+
+ catch (ClassNotFoundException cnfe)
+ {
+ // DEBUG:
+ if (testAssertion != null)
+ {
+ reporter
+ .getReport()
+ .getReportContext()
+ .getAnalyzer()
+ .printMessage(
+ "WARNING: "
+ + testAssertion.getId()
+ + " is not supported currently.");
+ }
+ }
+ }
+ }
+ }
+
+ catch (Exception e)
+ {
+ System.err.println("EXECEPTION: " + e.getMessage());
+ if (verboseOption)
+ e.printStackTrace();
+
+ if (e instanceof WSIException)
+ throw (WSIException) e;
+ else
+ throw new WSIException(e.getMessage(), e);
+ }
+
+ finally
+ {
+ // Indicate that we are done with this assertion target
+ this.reporter.endCurrentEntry();
+ }
+ }
+
+ /**
+ * Determine if the test assertion should be processed for the current entry.
+ * @param testAssertion a test assertion.
+ * @param entryContext the entry context.
+ * @return true if the test assertion should be processed for the current entry.
+ */
+ protected abstract boolean isPrimaryEntryTypeMatch(
+ TestAssertion testAssertion,
+ EntryContext entryContext);
+
+ /**
+ * Determine if the test assertion should be processed for the current entry.
+ * @param testAssertion a test assertion.
+ * @param entry an Entry object
+ * @return true if the test assertion should be processed for the current entry.
+ */
+ protected boolean isPrimaryEntryTypeMatch(
+ TestAssertion testAssertion,
+ Entry entry)
+ {
+ boolean match = false;
+
+ // If the test assertion entry type matches the target context entry type, then contine
+ if (testAssertion
+ .getEntryTypeName()
+ .equals(entry.getEntryType().getTypeName()))
+ {
+ match = true;
+ }
+
+ return match;
+ }
+
+ /**
+ * Determine if the test assertion is not applicable.
+ * @param testAssertion a test assertion.
+ * @return true if the test assertion is not applicable.
+ */
+ protected abstract boolean isNotApplicable(TestAssertion testAssertion);
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.BaseValidator#cleanup()
+ */
+ public void cleanup() throws WSIException
+ {
+ // If no assertions were processed, then set all missingInput
+ if (assertionCount == 0)
+ setAllMissingInput();
+
+ // Set cached document list in case it was updated
+ this.analyzerContext.setDocumentList(this.documentList);
+ }
+
+ /**
+ * Create assertion result.
+ * @param testAssertion a test assertion.
+ * @param result a String object.
+ * @param failureDetail a FailureDetail object.
+ * @return newly created test result.
+ */
+ public AssertionResult createAssertionResult(
+ TestAssertion testAssertion,
+ String result,
+ FailureDetail failureDetail)
+ {
+ Vector failureDetailList = null;
+
+ // Create failure detail list
+ if (failureDetail != null)
+ {
+ failureDetailList = new Vector();
+ failureDetailList.add(failureDetail);
+ }
+
+ return createAssertionResult(testAssertion, result, failureDetailList);
+ }
+
+ /**
+ * Create assertion result.
+ * @param testAssertion a test assertion.
+ * @param result a String object.
+ * @param failureDetailMessage a failure detail message.
+ * @return newly created test result.
+ */
+ public AssertionResult createAssertionResult(
+ TestAssertion testAssertion,
+ String result,
+ String failureDetailMessage)
+ {
+ return createAssertionResult(
+ testAssertion,
+ result,
+ failureDetailMessage,
+ null);
+ }
+
+ /**
+ * Create assertion result.
+ * @param testAssertion a test assertion.
+ * @param result a String object.
+ * @param failureDetailMessage a failure detail message.
+ * @param elementLocation element location.
+ * @return newly created test result.
+ */
+ public AssertionResult createAssertionResult(
+ TestAssertion testAssertion,
+ String result,
+ String failureDetailMessage,
+ ElementLocation elementLocation)
+ {
+ // Create failure detail list
+ Vector failureDetailList = null;
+ if (failureDetailMessage != null)
+ {
+ failureDetailList = new Vector();
+ FailureDetail failureDetail = reporter.createFailureDetail();
+ failureDetail.setFailureMessage(failureDetailMessage);
+ failureDetail.setElementLocation(elementLocation);
+ failureDetailList.add(failureDetail);
+ }
+
+ return createAssertionResult(testAssertion, result, failureDetailList);
+ }
+
+ /**
+ * Create assertion result.
+ * @param testAssertion a test assertion.
+ * @param result a String object.
+ * @param failureDetailList a failure detail list.
+ * @return newly created test result.
+ */
+ public AssertionResult createAssertionResult(
+ TestAssertion testAssertion,
+ String result,
+ Vector failureDetailList)
+ {
+ // Create assertion result
+ AssertionResult assertionResult = reporter.createAssertionResult();
+
+ // Set values in assertion result
+ assertionResult.setAssertion(testAssertion);
+ assertionResult.setResult(result);
+ assertionResult.setEntry(reporter.getReport().getCurrentEntry());
+
+ // Set failure detail list
+ assertionResult.setFailureDetailList(failureDetailList);
+
+ return assertionResult;
+ }
+
+ /**
+ * Create assertion result.
+ * @param testAssertion a test assertion.
+ * @param result a String object.
+ * @param prereqFailedList a list failed pre-requisite assertions.
+ * @return newly created test result.
+ */
+ public AssertionResult createAssertionResult(
+ TestAssertion testAssertion,
+ String result,
+ PrereqFailedList prereqFailedList)
+ {
+ // Create assertion result
+ AssertionResult assertionResult = reporter.createAssertionResult();
+
+ // Set values in assertion result
+ assertionResult.setAssertion(testAssertion);
+ assertionResult.setResult(result);
+ assertionResult.setEntry(reporter.getReport().getCurrentEntry());
+ assertionResult.setPrereqFailedList(prereqFailedList);
+
+ return assertionResult;
+ }
+
+ /**
+ * Add assertion result to report.
+ * @param assertionId assertion id.
+ * @param result assertion result.
+ * @throws WSIException if the assertion result cannot be added to the report.
+ */
+ protected void addAssertionResult(String assertionId, String result)
+ throws WSIException
+ {
+ // Create test assertion result
+ AssertionResult assertionResult = reporter.createAssertionResult();
+
+ // Set assertion, result and target
+ assertionResult.setAssertion(profileArtifact.getTestAssertion(assertionId));
+ assertionResult.setResult(result);
+ assertionResult.setEntry(reporter.getReport().getCurrentEntry());
+
+ // Add it to the report
+ reporter.addAssertionResult(assertionResult);
+ }
+
+ /**
+ * Add assertion result to report with an error detail message.
+ * @param assertionId assertion id.
+ * @param result assertion result.
+ * @param failureDetailMessage an error detail message.
+ * @throws WSIException if the assertion result cannot be added to the report.
+ */
+ protected void addAssertionResult(
+ String assertionId,
+ String result,
+ String failureDetailMessage)
+ throws WSIException
+ {
+ // Convert message to vector
+ Vector failureDetailList = null;
+ if (failureDetailMessage != null)
+ {
+ failureDetailList = new Vector();
+ FailureDetail failureDetail = reporter.createFailureDetail();
+ failureDetailList.add(failureDetail);
+ }
+
+ // Add assertion result
+ addAssertionResult(assertionId, result, failureDetailList);
+ }
+
+ /**
+ * Add assertion result to report.
+ * @param assertionId assertion id.
+ * @param result assertion result.
+ * @param failureDetailList a list of error detail messages.
+ * @throws WSIException if the assertion result cannot be added to the report.
+ */
+ protected void addAssertionResult(
+ String assertionId,
+ String result,
+ Vector failureDetailList)
+ throws WSIException
+ {
+ // Create test assertion result
+ AssertionResult assertionResult = reporter.createAssertionResult();
+
+ // Set assertion, result and target
+ assertionResult.setAssertion(profileArtifact.getTestAssertion(assertionId));
+ assertionResult.setResult(result);
+ assertionResult.setEntry(reporter.getReport().getCurrentEntry());
+ assertionResult.setFailureDetailList(failureDetailList);
+
+ // Add it to the report
+ reporter.addAssertionResult(assertionResult);
+ }
+
+ /**
+ * Add missingInput assertion result to report.
+ * @param testAssertion a test assertion.
+ * @throws WSIException if there is any problem adding missingInput
+ * assertion result to report.
+ */
+ protected void addMissingInputResult(TestAssertion testAssertion)
+ throws WSIException
+ {
+ // Create test assertion result
+ AssertionResult assertionResult = reporter.createAssertionResult();
+
+ // Set assertion, result and target
+ assertionResult.setAssertion(testAssertion);
+ assertionResult.setResult(AssertionResult.RESULT_MISSING_INPUT);
+ assertionResult.setEntry(reporter.getReport().getCurrentEntry());
+
+ // Add it to the report
+ reporter.addAssertionResult(assertionResult);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.BaseValidator#setAllMissingInput()
+ */
+ public void setAllMissingInput() throws WSIException
+ {
+ // If profile artifact is set
+ if (profileArtifact != null)
+ {
+ TestAssertion testAssertion;
+
+ // Create entry
+ Entry entry = this.reporter.getReport().createEntry();
+ entry.setArtifactName(this.reportArtifact.getType().getTypeName());
+
+ // Add entry to artifact
+ this.reportArtifact.addEntry(entry);
+
+ // Add entry to report
+ this.reporter.setCurrentEntry(entry);
+
+ // Go through the list of test assertions for the artifact
+ Iterator iterator = profileArtifact.getTestAssertionList().iterator();
+ while (iterator.hasNext())
+ {
+ // Get next test assertion
+ testAssertion = (TestAssertion) iterator.next();
+
+ // Add missingInput result
+ if (testAssertion.isEnabled())
+ addMissingInputResult(testAssertion);
+ }
+
+ // Indicate that we are done with this assertion target
+ this.reporter.endCurrentEntry();
+ }
+ }
+
+ /**
+ * Set all results for an entry type to missingInput.
+ * @param entryType an EntryType object.
+ * @throws WSIException if there is any problem while processing.
+ */
+ protected void setMissingInput(EntryType entryType) throws WSIException
+ {
+ TestAssertion testAssertion;
+
+ // Create entry
+ Entry entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(entryType);
+ entry.setReferenceID("[" + entryType.getTypeName() + "]");
+
+ // Add entry to artifact
+ this.reportArtifact.addEntry(entry);
+
+ // Add entry to report
+ this.reporter.setCurrentEntry(entry);
+
+ //try {
+ // Go through the list of test assertions for the artifact
+ Iterator iterator = profileArtifact.getTestAssertionList().iterator();
+ while (iterator.hasNext())
+ {
+ // Get next test assertion
+ testAssertion = (TestAssertion) iterator.next();
+ if (testAssertion.isEnabled()
+ && isPrimaryEntryTypeMatch(testAssertion, entry))
+ {
+ addMissingInputResult(testAssertion);
+ }
+ }
+
+ // Indicate that we are done with this entry
+ this.reporter.endCurrentEntry();
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/ProfileValidatorFactoryImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/ProfileValidatorFactoryImpl.java
new file mode 100644
index 000000000..14a147d09
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/ProfileValidatorFactoryImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.validator.EnvelopeValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.MessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.ProfileValidatorFactory;
+import org.eclipse.wst.wsi.internal.profile.validator.UDDIValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.WSDLValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.EnvelopeValidatorImpl;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.message.MessageValidatorImpl;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.uddi.UDDIValidatorImpl;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl.WSDLValidatorImpl;
+
+/**
+ * This class is an implementation of the WSILDocumentFactory.
+ *
+ * @version 1.0.1
+ * @author: Peter Brittenham
+ */
+public class ProfileValidatorFactoryImpl extends ProfileValidatorFactory
+{
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.ProfileValidatorFactory#newUDDIValidator()
+ */
+ public UDDIValidator newUDDIValidator() throws WSIException
+ {
+ // Create new UDDI validator
+ UDDIValidator uddiValidator = new UDDIValidatorImpl();
+ // Return validator
+ return uddiValidator;
+ }
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.ProfileValidatorFactory#newWSDLValidator()
+ */
+ public WSDLValidator newWSDLValidator() throws WSIException
+ {
+ // Create new WSDL validator
+ WSDLValidator wsdlValidator = new WSDLValidatorImpl();
+
+ // Return validator
+ return wsdlValidator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.ProfileValidatorFactory#newMessageValidator()
+ */
+ public MessageValidator newMessageValidator() throws WSIException
+ {
+ // Create new message validator
+ MessageValidator messageValidator = new MessageValidatorImpl();
+ // Return validator
+ return messageValidator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.ProfileValidatorFactory#newEnvelopeValidator()
+ */
+ public EnvelopeValidator newEnvelopeValidator() throws WSIException
+ {
+ // Create new envelope validator
+ EnvelopeValidator envelopeValidator = new EnvelopeValidatorImpl();
+ // Return validator
+ return envelopeValidator;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1920.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1920.java
new file mode 100644
index 000000000..7208b14ef
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1920.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+
+/**
+ * AP1920
+ *
+ * <context>For an envelope in a response message
+ * containing a soap:Fault element</context>
+ * <assertionDescription>In a description, if and only if, the wsdl:output
+ * element is described using WSDL MIME binding, then the envelope in the
+ * response message can contain faults with attachments.</assertionDescription>
+ */
+public class AP1920 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1920(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (!entryContext.getMessageEntry().isMimeContent())
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // check for a fault element within the message
+ if((entryContext.getMessageEntryDocument() == null) ||
+ entryContext.getMessageEntryDocument().
+ getElementsByTagNameNS(WSITag.ELEM_SOAP_FAULT.getNamespaceURI(),
+ WSITag.ELEM_SOAP_FAULT.getLocalPart()).getLength() != 1)
+ throw new AssertionNotApplicableException();
+
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ EntryType.getEntryType(EntryType.TYPE_MESSAGE_REQUEST),
+ entryContext.getRequestDocument());
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+ // If the envelope in a response message contains a fault with attachments
+ // and the corresponding wsdl:output element in the description is not
+ // described using the WSDL MIME binding, the assertion is failed
+ if ((entryContext.getMessageEntry().getMimeParts().count() > 1) &&
+ (getMultipartRelatedBindings(bindingOperation) == null))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ validator.createFailureDetail("The message contains \"" +
+ entryContext.getMessageEntry().getMimeParts().count() + "\" part(s)",
+ entryContext);
+ }
+ }
+ catch(AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Returns Multipart related bindings, if does not found, returns null.
+ * @param op binding operation
+ * @return Multipart related bindings, if does not found, returns null.
+ */
+ private MIMEMultipartRelated getMultipartRelatedBindings(
+ BindingOperation op)
+ {
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = op.getBindingOutput().getExtensibilityElements();
+ // check list on first element
+ if((extElems == null) || (extElems.size() == 0) ||
+ !(extElems.get(0) instanceof MIMEMultipartRelated))
+ return null;
+ return (MIMEMultipartRelated) extElems.get(0);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1928.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1928.java
new file mode 100644
index 000000000..7ebabf1c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/AP1928.java
@@ -0,0 +1,426 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.xs.XSComplexTypeDefinition;
+import org.apache.xerces.xs.XSConstants;
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSModelGroup;
+import org.apache.xerces.xs.XSObjectList;
+import org.apache.xerces.xs.XSParticle;
+import org.apache.xerces.xs.XSTerm;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.MIMEConstants;
+import org.eclipse.wst.wsi.internal.util.MIMEUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * AP1928
+ *
+ * <context>For a candidate envelope containing a URI reference
+ * that is typed using the ref:swaRef schema type</context>
+ * <assertionDescription>In an envelope, a URI reference that is typed using
+ * the ref:swaRef schema type resolves to a MIME part in the same message
+ * as the envelope.</assertionDescription>
+ */
+public class AP1928 extends AssertionProcess implements WSITag
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1928(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (!entryContext.getMessageEntry().isMimeContent())
+ {
+ throw new AssertionNotApplicableException();
+ }
+ // get the rrot part of a multipart/related message
+ Document root = entryContext.getMessageEntryDocument();
+ MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
+
+ // get an operation matched for the message
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(), root);
+
+ // if no one operation matches, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // get the corresponding extensibility elements and message
+ List extElems;
+ Message message;
+ if (MessageEntry.TYPE_REQUEST
+ .equals(entryContext.getEntry().getEntryType()))
+ {
+ extElems = bindingOperation.getBindingInput() == null ? null
+ : bindingOperation.getBindingInput().getExtensibilityElements();
+ message = bindingOperation.getOperation().getInput() == null ? null
+ : bindingOperation.getOperation().getInput().getMessage();
+ }
+ else
+ {
+ extElems = bindingOperation.getBindingOutput() == null ? null
+ : bindingOperation.getBindingOutput().getExtensibilityElements();
+ message = bindingOperation.getOperation().getOutput() == null ? null
+ : bindingOperation.getOperation().getOutput().getMessage();
+ }
+
+ // If there are no extensibility elements in the WSDL binding operation,
+ // the assertion is not applicable
+ if (extElems == null || extElems.size() < 1)
+ throw new AssertionNotApplicableException();
+
+ // Collecting the names of schema elements that are defined
+ // with the ref:swaRef schema type
+ List swaRefs = getSwaRefs((ExtensibilityElement)extElems.get(0), message);
+ // If such schema elements are not found, the assertion is not applicable
+ if (swaRefs.isEmpty())
+ throw new AssertionNotApplicableException();
+
+ // Going through all the schema element names
+ for (int i = 0; i < swaRefs.size(); i++)
+ {
+ QName elemName = (QName) swaRefs.get(i);
+ // Looking for such elements in the root MIME part
+ NodeList elems = root.getDocumentElement().getElementsByTagNameNS(
+ elemName.getNamespaceURI(), elemName.getLocalPart());
+ // Going through all the ref:swaRef references
+ for (int j = 0; j < elems.getLength(); j++)
+ {
+ Node elem = elems.item(j);
+ // Getting a value of this reference
+ String ref = elem.getFirstChild() == null ? null
+ : elem.getFirstChild().getNodeValue();
+ // If the value is invalid, the assertion failed
+ if (ref == null)
+ throw new AssertionFailException("The element " + elem.getNodeName()
+ + " of the ref:swaRef schema type is specified, but its vaule"
+ + " is invalid.");
+ // If the URI does not start with the "cid:" content-id prefix
+ // The assertion failed
+ if (!ref.startsWith("cid:"))
+ {
+ throw new AssertionFailException("The URI " + ref
+ + " of the ref:swaRef schema type must use the cid: prefix.");
+ }
+ boolean refFound = false;
+ Iterator iMimeParts = mimeParts.getParts().iterator();
+ // Going through all the MIME parts of the SOAP message
+ while (iMimeParts.hasNext())
+ {
+ MimePart mimePart = (MimePart)iMimeParts.next();
+ // Getting part's Content-ID header
+ String cid = MIMEUtils.getMimeHeaderAttribute(
+ mimePart.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);
+ if (cid != null)
+ {
+ // If the header value equals the reference URI,
+ // the corresponding MIME part is found
+ if (cid.equals('<' + ref.substring(4) + '>'))
+ {
+ refFound = true;
+ break;
+ }
+ }
+ }
+ // If the corresponding MIME part is not found
+ // the assertion failed
+ if (!refFound)
+ throw new AssertionFailException("The SOAP message does not contain"
+ + " a MIME part with the <" + ref.substring(4) + "> Content-ID.");
+ }
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Collects names of schema elements that are defined with the ref:swaRef
+ * schema type.
+ * @param extElem a list of extensibility elements
+ * @param message the corresponding message element.
+ * @return a list of such names found.
+ */
+ private List getSwaRefs(ExtensibilityElement extElem, Message message)
+ {
+ List swaRefs = new ArrayList();
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the root mime:part
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ if (mimeParts.size() > 0)
+ {
+ // Getting extensibility elements of the first mime:part
+ List elems = ((MIMEPart) mimeParts.get(0)).getExtensibilityElements();
+ List boundParts = new ArrayList();
+ // Going through all the MIME part's extensibility elements
+ for (int k = 0; k < elems.size(); k ++)
+ {
+ ExtensibilityElement elem = (ExtensibilityElement) elems.get(k);
+ // If that is a soap:body
+ if (elem.getElementType().equals(WSDL_SOAP_BODY) && message != null)
+ {
+ // Getting parts specified by the parts attribute
+ List bodyParts = ((SOAPBody) elem).getParts();
+ // Collecting all the message parts bound by this soapbind:body
+ Iterator i = message.getParts().values().iterator();
+ while (i.hasNext())
+ {
+ Part part = (Part) i.next();
+ if (bodyParts == null || bodyParts.contains(part.getName()))
+ {
+ boundParts.add(part);
+ }
+ }
+ }
+ // else if that is a soap:header
+ else if (elem.getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ QName msgName;
+ String partName;
+ if (elem instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader) elem;
+ // If the part is bound by this element
+ msgName = header.getMessage();
+ partName = header.getPart();
+ }
+ // WSDL4J 1.4 does not recognize soap:header elements that
+ // are enclosed in mime:multipartRelated, so using a workaround
+ else
+ {
+ Element header =
+ ((UnknownExtensibilityElement) elem).getElement();
+ // Getting the element's message attribute
+ String msgVal = header.getAttribute("message");
+ // finding the colon delimiter
+ int colonPos = msgVal.indexOf(":");
+ String ns = null;
+ // Getting a local part
+ String lp = colonPos > -1 ? msgVal.substring(colonPos + 1) : msgVal;
+ // If the delimiter is found
+ if (colonPos > -1)
+ {
+ // Retrieving a namespace URI
+ ns = validator.getWSDLDocument()
+ .getDefinitions().getNamespace(msgVal.substring(0, colonPos));
+ }
+ msgName = new QName(ns, lp);
+ partName = header.getAttribute("part");
+ }
+ // Getting a message referenced by this soapbind:header element
+ Message msg =
+ validator.getWSDLDocument().getDefinitions().getMessage(msgName);
+ if (msg != null)
+ {
+ // Adding the part to the list of bound parts
+ Part part = msg.getPart(partName);
+ if (part != null)
+ boundParts.add(part);
+ }
+ }
+ }
+
+ // All the bound parts from soapbind:body and soapbind:header
+ // are collected, finding swaRef references.
+ for (int i = 0; i < boundParts.size(); i++)
+ {
+ Part part = (Part) boundParts.get(i);
+ QName ref;
+ short type;
+ // Getting either part's element reference or type reference
+ if ((ref = part.getTypeName()) != null)
+ {
+ type = XSConstants.TYPE_DEFINITION;
+ }
+ else if ((ref = part.getElementName()) != null)
+ {
+ type = XSConstants.ELEMENT_DECLARATION;
+ }
+ // The part conatins neither element nor type attribute,
+ // proceeding with the next part
+ else
+ {
+ continue;
+ }
+ // Getting a list of schemas defined
+ Map schemas = validator.getWSDLDocument().getSchemas();
+ // Going through the schemas
+ Iterator it = schemas.values().iterator();
+ while (it.hasNext())
+ {
+ XSModel xsModel = (XSModel) it.next();
+ XSTypeDefinition xsType = null;
+ // Getting the corresponding part type
+ if (type == XSConstants.ELEMENT_DECLARATION)
+ {
+ // Getting schema element
+ XSElementDeclaration elem = xsModel.getElementDeclaration(
+ ref.getLocalPart(), ref.getNamespaceURI());
+ if (elem != null)
+ {
+ // Getting element's type
+ xsType = elem.getTypeDefinition();
+ // If it is ref:swaRef
+ if (WSIConstants.NS_URI_SWA_REF.equals(xsType.getName())
+ && WSIConstants.SCHEMA_TYPE_SWA_REF.equals(
+ xsType.getNamespace()))
+ {
+ // Adding the name of the element to the list
+ swaRefs.add(
+ new QName(elem.getNamespace(), elem.getName()));
+ }
+ }
+ }
+ else
+ {
+ xsType = xsModel.getTypeDefinition(
+ ref.getLocalPart(), ref.getNamespaceURI());
+ }
+ // Collecting all the element names,adding element names to the list
+ swaRefs.addAll(collectSwaRefs(xsType));
+ }
+ }
+ }
+ }
+ return swaRefs;
+ }
+
+ /**
+ * Collects names of schema elements that are defined with the ref:swaRef
+ * schema type.
+ * @param xsType a schema type.
+ * @return a list of names found.
+ */
+ private List collectSwaRefs(XSTypeDefinition xsType)
+ {
+ List swaRefs = new ArrayList();
+ if (xsType != null)
+ {
+ // If this is a complex type
+ if (xsType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
+ {
+ XSComplexTypeDefinition xsComplexType =
+ (XSComplexTypeDefinition) xsType;
+ // If it contains mixed context
+ if (xsComplexType.getParticle() != null)
+ {
+ // collecting element names
+ swaRefs.addAll(collectSwaRefs(xsComplexType.getParticle().getTerm()));
+ }
+ }
+ }
+ return swaRefs;
+ }
+
+ /**
+ * Collects names of schema elements that are defined with the ref:swaRef
+ * schema type.
+ * @param term a schema term.
+ * @return a list of names found.
+ */
+ private List collectSwaRefs(XSTerm term)
+ {
+ List swaRefs = new ArrayList();
+ // If a term is an element declaration
+ if (term.getType() == XSConstants.ELEMENT_DECLARATION)
+ {
+ XSElementDeclaration elem = (XSElementDeclaration) term;
+ XSTypeDefinition xsType = elem.getTypeDefinition();
+ // If element's type is ref:swaRef
+ if (WSIConstants.NS_URI_SWA_REF.equals(xsType.getNamespace())
+ && WSIConstants.SCHEMA_TYPE_SWA_REF.equals(xsType.getName()))
+ {
+ // Add element's name to the list
+ swaRefs.add(
+ new QName(elem.getNamespace(), elem.getName()));
+ }
+ else
+ {
+ // else collecting element names from element's type
+ swaRefs.addAll(collectSwaRefs(xsType));
+ }
+ }
+ // else if a term is a model group
+ else if(term.getType() == XSConstants.MODEL_GROUP)
+ {
+ // Getting a list of Particle schema components
+ XSObjectList list = ((XSModelGroup) term).getParticles();
+ for (int i = 0; i < list.getLength(); i++)
+ {
+ // Collecting element names
+ swaRefs.addAll(collectSwaRefs(((XSParticle) list.item(i)).getTerm()));
+ }
+ }
+ return swaRefs;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1005.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1005.java
new file mode 100644
index 000000000..ef793af3a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1005.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1005.
+ */
+public class BP1005 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1005(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Parse message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If this is a fault mesage, then it is not applicable
+ if (this.validator.isFault(doc))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Check if there is a soap body element
+ if (!this.validator.containsSoapBodyWithChild(doc))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Parse request message
+ Document docRequest = entryContext.getRequestDocument();
+
+ // get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+ if (match == null)
+ throw new AssertionNotApplicableException();
+
+ BindingOperation bindingOperation = match.getOperation();
+
+ // Is rpc style?
+ if (!WSIConstants
+ .ATTRVAL_SOAP_BIND_STYLE_RPC
+ .equals(match.getOperationStyle()))
+ throw new AssertionNotApplicableException();
+
+ List extElements = null;
+
+ if (bindingOperation.getBindingOutput() != null)
+ extElements =
+ bindingOperation.getBindingOutput().getExtensibilityElements();
+
+ // Is message RPC-literal?
+ if (!validator.isLiteral(extElements))
+ throw new AssertionNotApplicableException();
+
+ //Get message
+
+ // Gets body
+ NodeList soapBodyList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_BODY);
+ if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
+ {
+ // There is not a body or more than one bodies in the envlope.
+ throw new AssertionFailException();
+ }
+ Element soapBodyElem = (Element) soapBodyList.item(0);
+
+ // Find wrapper element in the body
+ Element wrapperElement = XMLUtils.getFirstChild(soapBodyElem);
+ if (wrapperElement == null)
+ {
+ throw new AssertionFailException();
+ }
+
+ if (wrapperElement
+ .getLocalName()
+ .equals(bindingOperation.getName() + "Response"))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1007.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1007.java
new file mode 100644
index 000000000..a958e02d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1007.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+
+
+/**
+ * BP1007
+ *
+ * <context>For a candidate message, in the message log file</context>
+ * <assertionDescription>DTDs relating to soap:header or soap:body documents, are not present in the message: no DOCTYPE element is present.</assertionDescription>
+ */
+public class BP1007 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1007(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Parse log message
+ Document doc = entryContext.getMessageEntryDocument();
+ if (doc == null)
+ {
+ // message is empty or invalid, the assertion is not applicable
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // else if the message contains a Document Type Declaration, the assertion failed
+ else if (doc.getDoctype() != null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getFailureDetailDescription(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1008.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1008.java
new file mode 100644
index 000000000..0eb666134
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1008.java
@@ -0,0 +1,277 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1008.
+ * Message has part accessor elements for parameters and return value, in no namespaces,
+ * but the children of these are namespace qualified with the same targetNamespace with which
+ * their types are defined.
+ */
+public class BP1008 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1008(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+
+ if (this.validator.isOneWayResponse(entryContext))
+ throw new AssertionFailException(
+ AssertionResult.RESULT_NOT_APPLICABLE);
+
+ // Parse message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If there is no message, then throw fail exception
+ if (doc == null)
+ throw new AssertionFailException();
+
+ if (this.validator.isFault(doc))
+ {
+ throw new AssertionFailException(
+ AssertionResult.RESULT_NOT_APPLICABLE);
+ }
+
+ // Check if there is a soap body element
+ if (!this.validator.containsSoapBodyWithChild(doc))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Parse request message
+ Document docRequest = entryContext.getRequestDocument();
+
+ // get SOAPAction
+ String action =
+ validator.getSoapAction(entryContext.getRequest().getHTTPHeaders());
+
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+ //Definition definition = entryContext.getAnalyzerContext().getCandidateInfo().getDefinitions()[0];
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+ if (match == null)
+ throw new AssertionNotApplicableException();
+
+ BindingOperation bindingOperation = match.getOperation();
+
+ // Is rpc style?
+ if (!WSIConstants
+ .ATTRVAL_SOAP_BIND_STYLE_RPC
+ .equals(match.getOperationStyle()))
+ throw new AssertionFailException(
+ AssertionResult.RESULT_NOT_APPLICABLE);
+
+ // Gets body
+ NodeList soapBodyList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_BODY);
+ if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
+ {
+ // There is not a body or more than one bodies in the envlope.
+ throw new AssertionFailException();
+ }
+ Element soapBodyElem = (Element) soapBodyList.item(0);
+
+ result = null;
+
+ // Find operation in the body
+ Element soapOperation = XMLUtils.getFirstChild(soapBodyElem);
+ if (soapOperation == null)
+ {
+ throw new AssertionFailException();
+ }
+
+ // Find operation message and ext. elements in the binding
+ Message operationMessage = null;
+ List extElements = null;
+ if (MessageEntry
+ .TYPE_REQUEST
+ .equals(entryContext.getMessageEntry().getType()))
+ {
+ operationMessage =
+ bindingOperation.getOperation().getInput().getMessage();
+ if (bindingOperation.getBindingInput() != null)
+ extElements =
+ bindingOperation.getBindingInput().getExtensibilityElements();
+ }
+ else
+ {
+ if (MessageEntry
+ .TYPE_RESPONSE
+ .equals(entryContext.getMessageEntry().getType()))
+ {
+ operationMessage =
+ bindingOperation.getOperation().getOutput().getMessage();
+ if (bindingOperation.getBindingOutput() != null)
+ extElements =
+ bindingOperation.getBindingOutput().getExtensibilityElements();
+ }
+ }
+
+ // Is message RPC-literal?
+ if (!validator.isLiteral(extElements))
+ throw new AssertionFailException(
+ AssertionResult.RESULT_NOT_APPLICABLE);
+
+ // gets first child of message
+ Element soapMessagePart = XMLUtils.getFirstChild(soapOperation);
+ if (soapMessagePart == null)
+ {
+ throw new AssertionPassException();
+ }
+
+ while (soapMessagePart != null)
+ {
+ // check whether part accessor or return are in no namespace
+
+ if (soapMessagePart.getNamespaceURI() != null
+ || "".equals(soapMessagePart.getNamespaceURI()))
+ {
+ throw new AssertionFailException();
+ }
+
+ // check whether children are namespace qualified
+ // with the same targetNamespace with which their types are defined
+ String typesTargetNS =
+ getTypeNS(operationMessage, soapMessagePart.getLocalName());
+
+ if (typesTargetNS == null)
+ throw new AssertionFailException();
+
+ if (!checkChildrenNamespace(soapMessagePart, typesTargetNS))
+ {
+ throw new AssertionFailException();
+ }
+
+ soapMessagePart = XMLUtils.getNextSibling(soapMessagePart);
+ }
+
+ result = AssertionResult.RESULT_PASSED;
+
+ }
+ catch (AssertionFailException e)
+ {
+ if (e.getMessage() != null && e.getMessage().length() > 0)
+ result = e.getMessage();
+ else
+ result = AssertionResult.RESULT_FAILED;
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ if (result == AssertionResult.RESULT_FAILED)
+ {
+ failureDetail = this.validator.createFailureDetail(null, entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Gets part type NS.
+ * @param message
+ * @param partName
+ * @return String
+ */
+ private String getTypeNS(Message message, String partName)
+ {
+ Part part = message.getPart(partName);
+ if (part == null)
+ return null;
+ else
+ return part.getTypeName().getNamespaceURI();
+ }
+
+ /**
+ * Checks children elements' namespace.
+ * @param node
+ * @param typesTargetNS
+ * @return boolean
+ */
+
+ private boolean checkChildrenNamespace(Element node, String typesTargetNS)
+ {
+ NodeList parts = node.getElementsByTagName("*");
+ for (int i = 0; i < parts.getLength(); i++)
+ {
+ Element part = (Element) parts.item(i);
+ if (!typesTargetNS.equals(part.getNamespaceURI()))
+ {
+ return false;
+ }
+ if (!checkChildrenNamespace(part, typesTargetNS))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1009.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1009.java
new file mode 100644
index 000000000..48be76a66
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1009.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.OperationType;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1009.
+ * Message includes all soapbind:headers specified in the wsdl:input
+ * (if request) or wsdl:output (if response) of the operation referred
+ * to by its wsdl:binding, and may also include headers that were not specified.
+ */
+public class BP1009 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1009(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Parse message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // Parse request message
+ Document docRequest = entryContext.getRequestDocument();
+
+ if (doc == null || docRequest == null)
+ throw new AssertionNotApplicableException();
+
+ // Check if there is a soap body element
+ if (!this.validator.containsSoapBodyWithChild(doc))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ if (this.validator.isFault(doc))
+ {
+ throw new AssertionFailException(
+ AssertionResult.RESULT_NOT_APPLICABLE);
+ }
+
+ // get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+
+ if (match == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ BindingOperation bindingOperation = match.getOperation();
+
+ // If this is a one-way operation and we are processing a response, then set result to notApplicable
+ if (bindingOperation
+ .getOperation()
+ .getStyle()
+ .equals(OperationType.ONE_WAY)
+ && (entryContext
+ .getMessageEntry()
+ .getType()
+ .equals(MessageEntry.TYPE_RESPONSE)))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // find body
+ NodeList soapBodyList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_BODY);
+ if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
+ {
+ // There is not a body or more than one bodies in the envlope.
+ throw new AssertionPassException();
+ }
+ Element soapBodyElem = (Element) soapBodyList.item(0);
+
+ // find headers
+ NodeList soapHeaders =
+ doc.getElementsByTagNameNS(
+ WSITag.ELEM_SOAP_HEADER.getNamespaceURI(),
+ WSITag.ELEM_SOAP_HEADER.getLocalPart());
+
+ //find all operation
+ //Element soapOperation = XMLUtils.getFirstChild(soapBodyElem);
+
+ // gets soapbind:headers
+ List bindingHeaders = null;
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equals(MessageEntry.TYPE_REQUEST))
+ {
+ if (bindingOperation.getBindingInput() != null)
+ bindingHeaders =
+ bindingOperation.getBindingInput().getExtensibilityElements();
+ else
+ throw new AssertionFailException();
+
+ }
+ else
+ {
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equals(MessageEntry.TYPE_RESPONSE))
+ {
+ if (bindingOperation.getBindingOutput() != null)
+ bindingHeaders =
+ bindingOperation.getBindingOutput().getExtensibilityElements();
+ else
+ throw new AssertionFailException();
+ }
+ }
+ if (bindingHeaders == null || bindingHeaders.size() == 0)
+ {
+ throw new AssertionPassException();
+ }
+
+ Iterator iterator = bindingHeaders.iterator();
+ while (iterator.hasNext())
+ {
+ Object bindingHeader = iterator.next();
+ if (bindingHeader instanceof SOAPHeader)
+ {
+ // find soapbind:header in SOAP message
+ if (!isBindingHeaderInSOAPMessage(entryContext,
+ soapHeaders,
+ (SOAPHeader) bindingHeader))
+ {
+ throw new AssertionFailException();
+ }
+ }
+ }
+
+ result = AssertionResult.RESULT_PASSED;
+
+ }
+ catch (AssertionFailException e)
+ {
+ if (e.getMessage() != null && e.getMessage().length() > 0)
+ result = e.getMessage();
+ else
+ result = AssertionResult.RESULT_FAILED;
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ if (result == AssertionResult.RESULT_FAILED)
+ {
+ failureDetail = this.validator.createFailureDetail(null, entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checks whether specified SOAPHeader is in the SOAPMessage.
+ * @param soapHeaderList
+ * @param SOAPHeader
+ * @return boolean
+ */
+ private boolean isBindingHeaderInSOAPMessage(
+ EntryContext entryContext,
+ NodeList soapHeaders,
+ SOAPHeader bindingHeader)
+ {
+
+ Message msg = getMessageByQName(entryContext, bindingHeader.getMessage());
+ if (msg == null)
+ return false;
+
+ Part part = msg.getPart(bindingHeader.getPart());
+ if (part == null)
+ return false;
+
+ QName partElementName = part.getElementName();
+ QName partTypeName = part.getTypeName();
+
+ if (partTypeName == null && partElementName == null)
+ return false;
+
+ if (soapHeaders == null || soapHeaders.getLength() == 0)
+ {
+ return false;
+ }
+ Vector headersList =
+ XMLUtils.getChildElements((Element) soapHeaders.item(0));
+
+ for (int indexHeader = 0;
+ indexHeader < headersList.size();
+ indexHeader++)
+ {
+ Element soapHeaderPart = (Element) headersList.get(indexHeader);
+ if (soapHeaderPart != null)
+ {
+ QName soapHeaderPartQName =
+ new QName(
+ soapHeaderPart.getNamespaceURI(),
+ soapHeaderPart.getLocalName());
+ if ((partTypeName != null
+ && partTypeName.equals(soapHeaderPartQName))
+ || (partElementName != null
+ && partElementName.equals(soapHeaderPartQName)))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Gets message by QName.
+ * @param entryContext
+ * @param messageName
+ * @return Message
+ */
+ private Message getMessageByQName(
+ EntryContext entryContext,
+ QName messageName)
+ {
+ Definition[] defs = validator.analyzerContext.getCandidateInfo().getDefinitions();
+ for (int i = 0; i < defs.length; i++)
+ {
+ Message msg = defs[i].getMessage(messageName);
+ if (msg != null)
+ return msg;
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1011.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1011.java
new file mode 100644
index 000000000..cc45bd7ea
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1011.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BP1011.
+ */
+public class BP1011 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1011(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // TODO need to handle soap with attachments
+ if (entryContext.getMessageEntry().isMimeContent())
+ throw new AssertionNotApplicableException();
+
+ Binding[] bindings = validator.analyzerContext.getCandidateInfo().getBindings();
+
+ // get soap message child name
+ // Get the DOM contents of the message soap:body (if non-empty)
+ Document messageDoc = null;
+
+ QName messagePartElementQName = null;
+
+ if (!entryContext.getMessageEntry().getMessage().equals(""))
+ {
+ messageDoc = entryContext.getMessageEntryDocument();
+ //messageDoc = XMLUtils.parseXML(entryContext.getMessageEntry().getMessage(),
+ // WSIProperties.DEF_SOAP_SCHEMA);
+ // get soap operation name from the soap:body
+
+ // NOTE: getSoapBodyChild() may return null, if the soap:body did not contain any child elements
+ Element soapMessageElement = validator.getSoapBodyChild(messageDoc);
+
+ // for doc-lit... find the wsdl:part from one of the specified operations that has
+ // the soap element used in the message.
+ // we are looking for a part with an element attrib val matching the soap message element
+ if (soapMessageElement != null)
+ {
+ messagePartElementQName =
+ new QName(
+ soapMessageElement.getNamespaceURI(),
+ soapMessageElement.getLocalName());
+ }
+ }
+
+ if ((messageDoc == null) || this.validator.isFault(messageDoc))
+ {
+ // empty messages and fault messages do not qualify for this TA
+ throw new AssertionNotApplicableException();
+ }
+
+ // look for match(s) in doc operations
+ // if found, we're done, else
+ // look for match(s) in rpc operations
+
+ /* Doc-lit
+ * get list of operations (from candidates) for which the first soap:body child QName is the
+ * <part element="..."> value of that operation's <wsdl:input> or <wsdl:output> element (depending
+ * on whether message is a request or a response).
+ */
+
+ BindingOperation[] docBindingOperations =
+ validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
+ bindings);
+ // list of operations that match the <wsdl:input> or <wsdl:output> (depending on entryType)
+ // for part element="..."
+ // (ISSUE: what about part type="..."?)
+ BindingOperation[] potentialDocLitOps =
+ validator.getDocLitOperations(
+ entryContext.getEntry().getEntryType(),
+ messagePartElementQName,
+ docBindingOperations);
+ if (potentialDocLitOps.length != 0)
+ {
+ // found at least one doc lit match
+
+ // *** Now we know it's document-literal, schema-validate the SOAP payload accordingly
+ try
+ {
+ boolean isSchemaValid = this.validator.messageIsDocLitSchemaValid(entryContext);
+ }
+ catch (Exception e)
+ {
+ throw new AssertionFailException(e.getMessage());
+ }
+ throw new AssertionPassException();
+ }
+
+ /* soap message is not doc-lit so try :
+ * Rpc-lit
+ */
+ BindingOperation[] rpcBindingOperations =
+ this.validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ bindings);
+
+ // Determine if there is an operation match
+ BindingOperation rcpOpMatch =
+ this.validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ messageDoc,
+ rpcBindingOperations);
+ if (rcpOpMatch != null)
+ {
+ // Determine if the parts match
+ rcpOpMatch =
+ this.validator.getOperationPartsMatch(
+ entryContext.getEntry().getEntryType(),
+ messageDoc,
+ rpcBindingOperations);
+ }
+
+ if (rcpOpMatch == null)
+ {
+ //not matched with rpc either. Prepare assertion failure.
+ StringBuffer rpcOperationList = new StringBuffer();
+ for (int i = 0; i < rpcBindingOperations.length; i++)
+ {
+ rpcOperationList.append(rpcBindingOperations[i].toString() + "\n");
+ }
+
+ StringBuffer docOperationList = new StringBuffer();
+ for (int i = 0; i < docBindingOperations.length; i++)
+ {
+ docOperationList.append(docBindingOperations[i].toString() + "\n");
+ }
+
+ throw new AssertionFailException(
+ "--MESSAGE:\n"
+ + entryContext.getMessageEntry().getMessage()
+ + "\n--CANDIDATE RPC STYLE OPERATIONS ("
+ + (rpcBindingOperations.length != 0
+ ? (rpcBindingOperations.length + "):\n" + rpcOperationList)
+ : "NONE)")
+ + "\n--CANDIDATE DOCUMENT STYLE OPERATIONS ("
+ + (docBindingOperations.length != 0
+ ? (docBindingOperations.length + "):\n" + docOperationList)
+ : "NONE)"));
+
+ }
+ }
+ catch (AssertionPassException e)
+ {
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1012.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1012.java
new file mode 100644
index 000000000..e81c59041
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1012.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1012.
+ */
+public class BP1012 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1012(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // look for <soap:Envelope> elements:
+ // (Note: since this is a Soap message we expect exactly one soap envelope, but we do not assume it).
+ Document requestDoc = entryContext.getRequestDocument();
+
+ // message is empty or invalid, the assertion is not applicable
+ if (requestDoc == null)
+ throw new AssertionNotApplicableException();
+
+ Element envElem = requestDoc.getDocumentElement();
+ //NodeList soapEnvList = requestDoc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Envelope");
+
+ // If the document element tag name is not Envelope
+ // or the namespace is http://schemas.xmlsoap.org/soap/envelope/
+ if (!envElem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE)
+ || envElem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP))
+ // Request contains proper soap Envelope element
+ throw new AssertionNotApplicableException();
+
+ // we expect a Soap Fault as a response
+ Document responseDoc =
+ XMLUtils.parseXML(entryContext.getResponse().getMessage());
+ NodeList soapFaultList =
+ responseDoc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ "Fault");
+ // ADD extra check here that the <soap:Fault> is a child of <soap:Envelope> ??
+ if ((soapFaultList == null) || (soapFaultList.getLength() == 0))
+ {
+ // No Soap fault found.
+ // Assertion failed (ADD highlight the child here ?)
+ throw new AssertionFailException(
+ "--- REQUEST:\n"
+ + entryContext.getRequest().getMessage()
+ + "\n--- RESPONSE:\n"
+ + entryContext.getResponse().getMessage());
+ }
+
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1013.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1013.java
new file mode 100644
index 000000000..df310bb15
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1013.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+
+
+/**
+ * BP1013.
+ */
+public class BP1013 extends BP1011
+{
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1013(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1031.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1031.java
new file mode 100644
index 000000000..40ba3a961
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1031.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+
+/**
+ * BP1031.
+ *
+ * @author: Graham Turrell, IBM UK
+ */
+public class BP1031 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1031(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ failureDetail = null;
+ try
+ {
+ Document doc;
+ // Check if this is one way response
+ // or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ if (!this.validator.isFault(doc))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ NodeList faultCodes = doc.getElementsByTagName("faultcode");
+ for (int i = 0; i < faultCodes.getLength(); i++)
+ {
+ NodeList faultCodeNodes = (faultCodes.item(i)).getChildNodes();
+ for (int j = 0; j < faultCodeNodes.getLength(); j++)
+ {
+ if (faultCodeNodes.item(j) instanceof Text)
+ {
+ Text faultCodeText = (Text) faultCodeNodes.item(j);
+ if (faultCodeText.getData().indexOf('.') > 0)
+ {
+ throw new AssertionFailException();
+ // dotted notation used.
+ }
+ }
+ }
+ }
+
+ throw new AssertionPassException();
+ // no dotted notation used in a faultcode element
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1032.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1032.java
new file mode 100644
index 000000000..0f91910bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1032.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+
+/**
+ * BP1032
+ *
+ * <context>For a candidate envelope</context>
+ * <assertionDescription>The soap:Envelope, soap:Header, and soap:Body elements do not have any attributes in the namespace "http://schemas.xmlsoap.org/soap/envelope/"</assertionDescription>
+ */
+public class BP1032 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1032(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ try
+ {
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ throw new AssertionNotApplicableException();
+
+ // Getting a root element
+ Element element = doc.getDocumentElement();
+
+ // Assuming that root element should be soap:Envelope
+ // If not, the assertion is not applicable
+ if (!element.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
+ throw new AssertionNotApplicableException();
+
+ // looking for any attribute of soap:Envelope in the namespace
+ // "http://schemas.xmlsoap.org/soap/envelope/"
+ // If at least one attribute is found, the assertion failed
+ Attr attr = getAttribute(element.getAttributes());
+ if (attr != null)
+ throw new AssertionFailException("soap:Envelope attribute name is "
+ + attr.getName());
+
+ // Getting the first child of soap:Envelope
+ element = XMLUtils.getFirstChild(element);
+
+ // If the child is soap:Header
+ if (element != null
+ && element.getLocalName().equals(XMLUtils.SOAP_ELEM_HEADER))
+ {
+ // looking for any attribute of soap:Header in the namespace
+ // "http://schemas.xmlsoap.org/soap/envelope/"
+ // If at least one attribute is found, the assertion failed
+ attr = getAttribute(element.getAttributes());
+ if (attr != null)
+ throw new AssertionFailException("soap:Header attribute name is "
+ + attr.getName());
+
+ // Moving to the next soap:Envelope child
+ element = XMLUtils.getNextSibling(element);
+ }
+
+ // If the child is soap:Body
+ if (element != null
+ && element.getLocalName().equals(XMLUtils.SOAP_ELEM_BODY))
+ {
+ // looking for any attribute of soap:Body in the namespace
+ // "http://schemas.xmlsoap.org/soap/envelope/"
+ // If at least one attribute is found, the assertion failed
+ attr = getAttribute(element.getAttributes());
+ if (attr != null)
+ throw new AssertionFailException("soap:Body attribute name is "
+ + attr.getName());
+ }
+
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for an attribute that is in the namespace
+ * http://schemas.xmlsoap.org/soap/envelope/
+ * @param attrs a collection of attributes
+ * @return an attribute in the specified namespace or null
+ */
+ private Attr getAttribute(NamedNodeMap attrs)
+ {
+ Attr ret = null;
+ if (attrs != null)
+ {
+ for(int i = 0; i < attrs.getLength(); i++)
+ {
+ Attr attr = (Attr) attrs.item(i);
+ if (attr.getNamespaceURI() != null
+ && attr.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP))
+ {
+ ret = attr;
+ break;
+ }
+ }
+ }
+
+ return ret;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1033.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1033.java
new file mode 100644
index 000000000..7df6ca16d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1033.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * BP1033
+ *
+ * <context>For a candidate envelope</context>
+ * <assertionDescription>The SOAP envelope does not contain the namespace declaration xmlns:xml="http://www.w3.org/XML/1998/namespace".</assertionDescription>
+ */
+public class BP1033 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1033(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting the root element
+ Element elem = doc.getDocumentElement();
+ // If it is not the soap:Envelope, the assertion is not applicable
+ if (!elem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP)
+ || !elem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // If the envelope contains the xmlns:xml namespace declaration,
+ // the assertion failed
+ String incorrectElementName = getIncorrectElementName(elem);
+ if (incorrectElementName != null)
+ {
+ throw new AssertionFailException("The name of an element containing "
+ + "such namespace declaration is \"" + incorrectElementName + "\".");
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for any element that contains the attribute xmlns:xml="http://www.w3.org/XML/1998/namespace".
+ * @param elem the root element.
+ * @return the name of an element found or null.
+ */
+ private String getIncorrectElementName(Element elem)
+ {
+ // Getting a value of the attribute xmlns:xml
+ String attrValue = elem.getAttributeNS(
+ WSIConstants.NS_URI_XMLNS, "xml");
+ // If it equals to "http://www.w3.org/XML/1998/namespace",
+ // return an element name;
+ if (WSIConstants.NS_URI_XML.equals(attrValue))
+ {
+ return elem.getNodeName();
+ }
+ // Going through element's children
+ Element child = XMLUtils.getFirstChild(elem);
+ while (child != null)
+ {
+ // If any of them has xmlns:xml attribute, return a value
+ String name = getIncorrectElementName(child);
+ if (name != null)
+ {
+ return name;
+ }
+ // Getting the next element's child
+ child = XMLUtils.getNextSibling(child);
+ }
+ // No xmlns:xml attributes found, return null
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1100.java
new file mode 100644
index 000000000..edbc70f13
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1100.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1100.
+ * A message that does not contain a SOAP fault SHOULD use a "200 OK"
+ * HTTP status code.
+ */
+public class BP1100 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1100(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // look for <soap:Fault> element:
+ Document doc = entryContext.getMessageEntryDocument();
+ if (doc == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ Element root = doc.getDocumentElement();
+ NodeList faultList =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Fault");
+
+ // If response does not contain a soap:Fault, then check it
+ if ((faultList == null) || (faultList.getLength() == 0))
+ {
+ // Response does not contain a soap:Fault
+ // check HTTP status code
+ String httpStatus =
+ Utils.getHTTPStatusCode(
+ entryContext.getMessageEntry().getHTTPHeaders());
+ if (!"200".equals(httpStatus))
+ {
+ result = AssertionResult.RESULT_WARNING;
+ //failureDetailMessage = entryContext.getMessageEntry().getMessage();
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nResponse message:\nHeaders:\n"
+ + entryContext.getMessageEntry().getHTTPHeaders()
+ + "\nMessage:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ }
+
+ // If it is a soap:Fault, then the result must be notApplicable
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1107.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1107.java
new file mode 100644
index 000000000..8937346c2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1107.java
@@ -0,0 +1,277 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.NullUtil;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BP1107.
+ * The contained soapbind:fault is defined in the wsdl:binding.
+ */
+public class BP1107 extends AssertionProcessVisitor
+{
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1107(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private OperationSignature responseSig = null;
+ private Vector faults = null;
+
+ /**
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(SOAPFault, Object, WSDLTraversalContext)
+ */
+ public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
+ {
+ String faultName = fault.getName();
+
+ if (faultName == null)
+ faultName = ctx.getBindingFault().getName();
+
+ Operation op = ctx.getBindingOperation().getOperation();
+ if (op == null /* || faultName == null*/
+ ) // may be it's possible to have legal fault with null name
+ return;
+
+ // we suppose that SOAPFault.getName() corresponds to the abstract operation's fault name
+ Fault f = op.getFault(faultName);
+ if (f == null)
+ return;
+
+ Message m = f.getMessage();
+ // message should have only one part
+ if (m == null || m.getParts() == null || m.getParts().size() != 1)
+ return;
+
+ //Part faultPart = WSDLUtil.getPart(m, faultName);
+ Part faultPart = (Part) m.getParts().values().iterator().next();
+
+ TypesRegistry tReg = (TypesRegistry) ctx.getParameter("TypesRegistry");
+ QName elemQName = faultPart.getElementName();
+ QName typeQName = faultPart.getTypeName();
+ if (typeQName == null)
+ typeQName = tReg.getType(faultPart.getElementName());
+ if (typeQName == null)
+ throw new IllegalArgumentException("Part type can not be null.");
+
+ // for all faults; if it presents in the definition remove it from list
+ for (int i = 0; i < faults.size();)
+ {
+ Element elem = (Element) faults.get(i);
+
+ // TODO: I don't understand why this is here. Only the element setting should be checked.
+ //boolean matchByType =
+ // elem.getLocalName().equals(typeQName.getLocalPart()) && NullUtil.equals(elem.getNamespaceURI(), typeQName.getNamespaceURI());
+
+ boolean matchByElement =
+ elemQName != null
+ && elem.getLocalName().equals(elemQName.getLocalPart())
+ && NullUtil.equals(
+ elem.getNamespaceURI(),
+ elemQName.getNamespaceURI());
+
+ //if (matchByType || matchByElement)
+ if (matchByElement)
+ faults.remove(i);
+ else
+ i++;
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // Parse request and response message
+ Document docRequest = entryContext.getRequestDocument();
+ Document docResponse = entryContext.getMessageEntryDocument();
+
+ if ((docRequest == null) || (docResponse == null))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else if (!this.validator.isFault(docResponse))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // create request signature
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ this.validator.getSoapAction(entryContext.getRequest().getHTTPHeaders()),
+ validator.analyzerContext.getCandidateInfo().getBindings()[0],
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator));
+
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ if (match != null)
+ {
+ // MOVED: Parse response message
+ //doc = entryContext.getMessageEntryDocument();
+
+ responseSig = new OperationSignature(docResponse);
+ if (WSIConstants
+ .ATTRVAL_SOAP_BIND_STYLE_RPC
+ .equals(match.getOperationStyle()))
+ responseSig.createRPCSignature();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPFault(true);
+ traversal.ignoreBindingInput();
+ traversal.ignoreBindingOutput();
+
+ if (responseSig == null || !responseSig.isFault())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else if (responseSig != null && responseSig.isFault())
+ {
+ // extract all faults and try find them in the definition
+ // extracts only faults with namespace
+ Element body =
+ XMLUtils.findChildElement(
+ docResponse.getDocumentElement(),
+ WSITag.ELEM_SOAP_BODY);
+ Element fault =
+ XMLUtils.findChildElement(body, WSITag.ELEM_SOAP_FAULT);
+ Element detail = XMLUtils.getElement("detail", fault);
+ if (detail == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ faults = XMLUtils.getChildElements(detail);
+
+ // REMOVE: Why do the faults have to be namespaced qualified?
+ //XMLUtils.removeAllElementsWithoutNS(faults);
+
+ // if faults exist try to validate it
+ if (faults.size() > 0)
+ {
+ Map m = new HashMap();
+ WSDLUtil.expandDefinition(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions());
+ m.put(
+ "definition",
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions());
+ TypesRegistry tReg =
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator);
+ m.put("TypesRegistry", tReg);
+ traversal.traverse(match.getOperation(), m);
+ if (faults.size() > 0)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ StringWriter sw = new StringWriter();
+ for (int i = 0; i < faults.size(); i++)
+ {
+ try
+ {
+ XMLUtils.serializeElement((Element) faults.get(i), sw);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ try
+ {
+ sw.close();
+ }
+ catch (Exception e)
+ {
+ }
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nFaults:\n" + sw.toString(),
+ entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1201.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1201.java
new file mode 100644
index 000000000..7aafb0e62
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1201.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BP1201.
+ * The namespace of the soap:Envelope in the message has value: http://schemas.xmlsoap.org/soap/envelope/.
+ */
+public class BP1201 extends AssertionProcess implements WSITag
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1201(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ Document doc;
+ // Check if this is one way response or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext) ||
+ (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ Element root = doc.getDocumentElement();
+ String ns = root.getNamespaceURI();
+ String local = root.getLocalName();
+ if (!ELEM_SOAP_ENVELOPE.getNamespaceURI().equals(ns))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "Root element has namespace: " + ns, entryContext);
+ }
+
+ else if (!ELEM_SOAP_ENVELOPE.getLocalPart().equals(local))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "Root element has local name: " + local, entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1202.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1202.java
new file mode 100644
index 000000000..e1d990416
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1202.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1202.
+ * Each child element (if any) of the soap:Body element is namespace qualified (not the grandchildren).
+ */
+public class BP1202 extends AssertionProcess implements WSITag
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1202(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Parse log message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ if (validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Check if there is a soap body element
+ else if (!validator.containsSoapBodyWithChild(doc))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // Get the root element
+ Element root = doc.getDocumentElement();
+
+ // Get a node list which should contain the soap:Body element
+ NodeList rootNodeList = root.getElementsByTagNameNS(
+ ELEM_SOAP_BODY.getNamespaceURI(), ELEM_SOAP_BODY.getLocalPart());
+
+ // If there is at least one soap:Body element,
+ // then make sure that each child is namespace qualified
+ if (rootNodeList.getLength() > 0)
+ {
+ // Get the soap:Body element
+ Element body = (Element) rootNodeList.item(0);
+
+ // Get the list of soap:Body child elements
+ NodeList children = body.getChildNodes();
+
+ // Make sure that each child element is namespace qualified
+ for (int i = 0;
+ i < children.getLength() && result == AssertionResult.RESULT_PASSED;
+ ++i)
+ {
+ Node n = children.item(i);
+ if (n instanceof Element)
+ {
+ String ns = n.getNamespaceURI();
+ if (ns == null || ns.length() == 0)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ entryContext.getMessageEntry().getMessage(), entryContext);
+ }
+ }
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1203.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1203.java
new file mode 100644
index 000000000..cfb1cd5f6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1203.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1203.
+ * The namespace of the detail element of a qualified attribute in the soap:Fault is a
+ * foreign namespace, different from "http://schemas.xmlsoap.org/soap/envelope/".
+ */
+public class BP1203 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1203(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ boolean qualifiedAttributes = false;
+
+ Document doc;
+ // Check if this is one way response or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // ADD: Need to determine if this check is required, since it should already be done
+ // Applicable to response messages only
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equalsIgnoreCase(MessageEntry.TYPE_RESPONSE))
+ {
+ // look for <soap:Fault> element:
+ NodeList faultList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_FAULT);
+ if ((faultList == null) || (faultList.getLength() == 0))
+ {
+ // Response does not contain a soap:Fault
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // we have a soap:Fault.
+ else
+ {
+ try
+ {
+ // look at each soap:Fault in turn
+ for (int i = 0; i < faultList.getLength(); i++)
+ {
+ Element soapFault = (Element) faultList.item(i);
+ // find the detail element(s) if any
+ NodeList detailList =
+ soapFault.getElementsByTagName(XMLUtils.SOAP_ELEM_FAULT_DETAIL);
+ if (detailList != null)
+ {
+ // for each detail element...
+ for (int j = 0; j < detailList.getLength(); j++)
+ {
+ NamedNodeMap detailAttribs =
+ detailList.item(j).getAttributes();
+ // check for any qualified attributes
+ if (detailAttribs != null)
+ {
+ for (int k = 0; k < detailAttribs.getLength(); k++)
+ {
+ Attr nextAttr = (Attr) (detailAttribs.item(k));
+ // for each qualified attribute, check that
+ // qname != http://schemas.xmlsoap.org/soap/envelope
+ if (nextAttr.getNamespaceURI() != null)
+ {
+ qualifiedAttributes = true;
+ if (nextAttr
+ .getNamespaceURI()
+ .equals(WSIConstants.NS_URI_SOAP))
+ {
+ // found unexpected qname
+ throw new AssertionFailException(
+ entryContext.getMessageEntry().getMessage());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (!qualifiedAttributes)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+ else
+ {
+ // target message is not a Response
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1204.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1204.java
new file mode 100644
index 000000000..438a29022
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1204.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1204.
+ * The serialized array form in the message does not contain the
+ * soapenc:arrayType attribute.
+ *
+ */
+public class BP1204 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1204(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+
+ if (this.validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Parse message
+ Document doc =
+ XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
+
+ if (this.validator.isFault(doc))
+ {
+ throw new AssertionPassException();
+ }
+
+ // Parse request message
+ Document docRequest =
+ XMLUtils.parseXML(entryContext.getRequest().getMessage());
+
+ // get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+
+ if (match == null)
+ throw new AssertionPassException();
+
+ BindingOperation bindingOperation = match.getOperation();
+
+ Message operationMessage = null;
+ if (MessageEntry
+ .TYPE_REQUEST
+ .equals(entryContext.getMessageEntry().getType())
+ && (bindingOperation.getOperation().getInput() != null))
+ {
+ operationMessage =
+ bindingOperation.getOperation().getInput().getMessage();
+ }
+ else
+ {
+ if (MessageEntry
+ .TYPE_RESPONSE
+ .equals(entryContext.getMessageEntry().getType())
+ && (bindingOperation.getOperation().getOutput() != null))
+ {
+ operationMessage =
+ bindingOperation.getOperation().getOutput().getMessage();
+ }
+ }
+
+ if (operationMessage == null)
+ throw new AssertionPassException();
+
+ boolean isContainArray = false;
+
+ Collection parts = operationMessage.getParts().values();
+ for (Iterator iter = parts.iterator(); iter.hasNext();)
+ {
+ Part part = (Part) iter.next();
+
+ QName type = null;
+
+ if (part.getTypeName() == null)
+ {
+ type = registry.getType(part.getElementName());
+ }
+ else
+ {
+ type = part.getTypeName();
+ }
+
+ isContainArray =
+ registry.isExtendsArray(type)
+ || registry.isUsesWSDLArrayType(type)
+ || isArrayType(type);
+ if (isContainArray)
+ break;
+ }
+
+ if (isContainArray)
+ {
+ // Gets body
+ NodeList soapBodyList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_BODY);
+ if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
+ {
+ throw new AssertionFailException();
+ }
+
+ Element soapBodyElem = (Element) soapBodyList.item(0);
+
+ NodeList soapBodyCildrenList =
+ soapBodyElem.getElementsByTagNameNS("*", "*");
+ for (int indexChild = 0;
+ indexChild < soapBodyCildrenList.getLength();
+ indexChild++)
+ {
+ Element elem = (Element) soapBodyCildrenList.item(indexChild);
+ if (elem
+ .hasAttributeNS(
+ WSIConstants.NS_URI_SOAP_ENCODING,
+ WSIConstants.ATTR_ARRAY_TYPE))
+ {
+ throw new AssertionFailException();
+ }
+ }
+
+ throw new AssertionPassException();
+ }
+ else
+ {
+ throw new AssertionPassException();
+ }
+
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checks whether type uses an array or not.
+ * @param type
+ * @return boolean
+ */
+ private boolean isArrayType(QName type)
+ {
+ boolean arrayType = false;
+
+ Element typeElement = getTypeElement(type);
+ if (typeElement != null)
+ {
+ NodeList list =
+ typeElement.getElementsByTagNameNS(
+ WSIConstants.NS_URI_XSD,
+ "sequence");
+ if (list.getLength() > 0)
+ arrayType = true;
+ }
+
+ return arrayType;
+ }
+
+ /**
+ * Gets XML element defining the type.
+ * @param type
+ * @return Element
+ */
+ private Element getTypeElement(QName type)
+ {
+ Types[] allTypes = validator.analyzerContext.getCandidateInfo().getTypes();
+ for (int i = 0; allTypes != null && i < allTypes.length; i++)
+ {
+ Element typesElement = null;
+ if (allTypes[i] != null)
+ {
+ typesElement = allTypes[i].getDocumentationElement();
+ if (typesElement == null)
+ {
+ List extList = allTypes[i].getExtensibilityElements();
+ for (Iterator iter = extList.iterator(); iter.hasNext();)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) iter.next();
+
+ if (extElem
+ .getElementType()
+ .equals(new QName(WSIConstants.NS_URI_XSD, "schema")))
+ {
+ typesElement =
+ ((UnknownExtensibilityElement) extElem).getElement();
+ break;
+ }
+ }
+ }
+ if (typesElement != null)
+ {
+ NodeList complexTypesList =
+ typesElement.getElementsByTagNameNS(
+ WSIConstants.NS_URI_XSD,
+ "complexType");
+ for (int j = 0; j < complexTypesList.getLength(); j++)
+ {
+ Element typeElem = (Element) complexTypesList.item(j);
+ if (type.getLocalPart().equals(typeElem.getAttribute("name")))
+ {
+ return typeElem;
+ }
+ }
+
+ }
+ }
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1208.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1208.java
new file mode 100644
index 000000000..748703c34
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1208.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLTraversal;
+import org.w3c.dom.Document;
+import org.w3c.dom.ProcessingInstruction;
+
+
+/**
+ * BP1208 NOT FULLY TESTED.
+ */
+public class BP1208 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1208(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Parse log message
+ Document doc = entryContext.getMessageEntryDocument();
+ if (doc == null) {
+ //message is empty or invalid, the assertion is not applicable
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ } else {
+
+ // Traverse document looking for processing instructions.
+ // ISSUE: this inner class needs ... revisiting/replacing
+ // EG. Do we want to list all processing instructions,
+ // or is the first sufficient?
+ XMLTraversal traversal = new XMLTraversal()
+ {
+ public void visit(ProcessingInstruction pi)
+ {
+ try
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "Target: " + pi.getTarget() + ", Data: " + pi.getData();
+ }
+ catch (Exception e)
+ {
+ // ADD: How should this exception be handled?
+ }
+
+ super.visit(pi);
+ }
+ };
+
+ traversal.visit(doc);
+
+ if (result == AssertionResult.RESULT_FAILED
+ && failureDetailMessage != null)
+ {
+ failureDetail = this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1211.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1211.java
new file mode 100644
index 000000000..6b846272e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1211.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLUtils;
+import org.eclipse.wst.wsi.internal.xml.XMLTags;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BP1211.
+ *
+ * Context:
+ * For a candidate message in the message log file, that is referred by a binding style RPC-literal
+ *
+ * Description:
+ * Part accessor elements in the message do not have an xsi:nil attribute with a value of "1" or "true".
+ */
+public class BP1211 extends AssertionProcess implements XMLTags
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1211(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Parse message
+ Document doc = entryContext.getMessageEntryDocument();
+ Document docRequest = entryContext.getRequestDocument();
+
+ Element soapOperation = null;
+ // If there is a Fault entry or no body entries,
+ // the assertion is not applicable
+ if (validator.isFault(doc)
+ || (soapOperation = validator.getSoapBodyChild(doc)) == null)
+ throw new AssertionNotApplicableException();
+
+ // Get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ // Get the binding that is being processed
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+
+ //Create the types registry
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+
+ // Find an operation match
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+ if (match == null)
+ throw new AssertionNotApplicableException();
+
+ // Get the binding operation based on the match
+ BindingOperation bindingOperation = match.getOperation();
+
+ // If this is not rpc-literal, then return notApplicable result
+ if (!WSDLUtils
+ .isRpcLiteral(match.getOperationStyle(), bindingOperation))
+ throw new AssertionNotApplicableException();
+
+ // Going through all the accessors
+ Element accessor = XMLUtils.getFirstChild(soapOperation);
+ while (accessor != null)
+ {
+ Attr attr = XMLUtils.getAttribute(accessor, ATTR_XSI_NIL);
+ // If there is xsi:nil attribute and its value is "1" or "true"
+ // the assertion failed
+ if (attr != null
+ && (attr.getValue().equals("1") || attr.getValue().equals("true")))
+ {
+ throw new AssertionFailException("The accessor name is "
+ + accessor.getNodeName());
+ }
+ // Getting the next accessor
+ accessor = XMLUtils.getNextSibling(accessor);
+ }
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1212.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1212.java
new file mode 100644
index 000000000..2be83d9dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1212.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * BP1212
+ *
+ * <context>For a candidate non-fault envelope containing a soap:body with at least one element</context>
+ * <assertionDescription>The envelope contains exactly one part accessor element for each of the wsdl:part elements bound to the envelope's corresponding soapbind:body element.</assertionDescription>
+ */
+public class BP1212 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1212(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ Element soapOperation = null;
+ // If there is a Fault entry or no body entries,
+ // the assertion is not applicable
+ if (validator.isFault(doc)
+ || (soapOperation = validator.getSoapBodyChild(doc)) == null)
+ throw new AssertionNotApplicableException();
+
+ // Creating a qualified name of potential SOAP operation
+ QName operationQName = new QName(
+ soapOperation.getNamespaceURI(), soapOperation.getLocalName());
+
+ // Retrieving all the RPC binding operations from wsdl:binding
+ BindingOperation[] rpcBindingOperations =
+ validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ validator.analyzerContext.getCandidateInfo().getBindings());
+
+ // Retrieving binding operation by given operation name
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ operationQName,
+ rpcBindingOperations);
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation message parts and extensibility elems
+ // in the binding depending on message type
+ List operationMessageParts = null;
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST))
+ {
+ operationMessageParts = bindingOperation.getOperation()
+ .getInput().getMessage().getOrderedParts(null);
+ if (bindingOperation.getBindingInput() != null)
+ extElems =
+ bindingOperation.getBindingInput().getExtensibilityElements();
+ }
+ else
+ {
+ operationMessageParts = bindingOperation.getOperation()
+ .getOutput().getMessage().getOrderedParts(null);
+ if (bindingOperation.getBindingOutput() != null)
+ extElems =
+ bindingOperation.getBindingOutput().getExtensibilityElements();
+ }
+
+ // Getting all the accessors of the operation element
+ List accessors = XMLUtils.getChildElements(soapOperation);
+ // Getting the ordered list of wsdl:part names
+ List orderedPartNames =
+ validator.orderPartNames(operationMessageParts, extElems);
+ // Going through all the wsdl:part names
+ Iterator i = orderedPartNames.iterator();
+ while (i.hasNext())
+ {
+ String partName = (String) i.next();
+ // If there is not exactly one accessor for the part specified,
+ // the assertion failed
+ if (getPartsCount(accessors, partName) != 1)
+ throw new AssertionFailException(
+ "The name of wsdl:part is " + partName);
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Counts the amount of accessors of a specific name
+ * @param accessors a list of accessors
+ * @param name the name of accessor elements to be counted
+ * @return
+ */
+ private int getPartsCount(List accessors, String name)
+ {
+ int count = 0;
+
+ for (int i = 0; i < accessors.size(); i++)
+ {
+ Element accessor = (Element) accessors.get(i);
+ if (accessor.getLocalName().equals(name))
+ count++;
+ }
+
+ return count;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1213.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1213.java
new file mode 100644
index 000000000..d472c5a43
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1213.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * BP1213
+ *
+ * <context>For a candidate non-fault envelope containing a soap:Body element, and is referred by a doc-literal binding</context>
+ * <assertionDescription>The envelope has no element content in the soap:Body element if the value of the parts attribute of the soapbind:body is an empty string in the corresponding doc-literal description.</assertionDescription>
+ */
+public class BP1213 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1213(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ Element messageElement = null;
+ // If the message is empty or invalid or there is a Fault entry
+ // or there is no body entries, the assertion is not applicable
+ if (doc == null
+ || validator.isFault(doc)
+ || (messageElement = validator.getSoapBodyChild(doc)) == null)
+ throw new AssertionNotApplicableException();
+
+ // Getting a qualified name of message element
+ QName messagePartElementQName = new QName(
+ messageElement.getNamespaceURI(), messageElement.getLocalName());
+
+ // Retrieving all the document binding operations from wsdl:binding
+ BindingOperation[] docBindingOperations =
+ validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
+ validator.analyzerContext.getCandidateInfo().getBindings());
+
+ // Retrieving binding operation by given element name
+ BindingOperation[] potentialDocLitOps =
+ validator.getDocLitOperations(
+ entryContext.getEntry().getEntryType(),
+ messagePartElementQName,
+ docBindingOperations);
+
+ // If there is not exactly one operation matched,
+ // the assertion is not applicable
+ if (potentialDocLitOps.length != 1)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST)
+ && potentialDocLitOps[0].getBindingInput() != null)
+ {
+ extElems = potentialDocLitOps[0]
+ .getBindingInput().getExtensibilityElements();
+ }
+ else if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_RESPONSE)
+ && potentialDocLitOps[0].getBindingOutput() != null)
+ {
+ extElems = potentialDocLitOps[0]
+ .getBindingOutput().getExtensibilityElements();
+ }
+
+ // Getting the parts attribute from soapbind:body
+ List parts = null;
+ SOAPBody soapBody = validator.getSOAPBody(extElems);
+ if (soapBody != null)
+ parts = soapBody.getParts();
+
+ // if the parts attribute is an empty string and there is
+ // at least one accessor, the assertion failed
+ if (parts != null && parts.isEmpty()
+ && !XMLUtils.getChildElements(messageElement).isEmpty())
+ throw new AssertionFailException("wsdl:operation name is "
+ + potentialDocLitOps[0].getName());
+
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1214.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1214.java
new file mode 100644
index 000000000..909b6e5ba
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1214.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * BP1214
+ *
+ * <context>For a candidate non-fault envelope containing a soap:Body element, and is referred by a rpc-literal binding</context>
+ * <assertionDescription>The envelope does not contain any part accessor elements if the value of the parts attribute of the soapbind:body is an empty string in the corresponding rpc-literal description.</assertionDescription>
+ */
+public class BP1214 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1214(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ Element soapOperation = null;
+ // If there is a Fault entry or no body entries,
+ // the assertion is not applicable
+ if (validator.isFault(doc)
+ || (soapOperation = validator.getSoapBodyChild(doc)) == null)
+ throw new AssertionNotApplicableException();
+
+ // Creating a qualified name of potential SOAP operation
+ QName operationQName = new QName(
+ soapOperation.getNamespaceURI(), soapOperation.getLocalName());
+
+ // Retrieving all the RPC binding operations from wsdl:binding
+ BindingOperation[] rpcBindingOperations =
+ validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ validator.analyzerContext.getCandidateInfo().getBindings());
+
+ // Retrieving binding operation by given operation name
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ operationQName,
+ rpcBindingOperations);
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST)
+ && bindingOperation.getBindingInput() != null)
+ {
+ extElems =
+ bindingOperation.getBindingInput().getExtensibilityElements();
+ }
+ else if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_RESPONSE)
+ && bindingOperation.getBindingOutput() != null)
+ {
+ extElems =
+ bindingOperation.getBindingOutput().getExtensibilityElements();
+ }
+
+ // If the message is not literal, the assertion is not applicable
+ if (!validator.isLiteral(extElems))
+ throw new AssertionNotApplicableException();
+
+ // Getting the parts attribute from soapbind:body
+ List parts = null;
+ SOAPBody soapBody = validator.getSOAPBody(extElems);
+ if (soapBody != null)
+ parts = soapBody.getParts();
+
+ // if the parts attribute is an empty string and there is
+ // at least one accessor, the assertion failed
+ if (parts != null && parts.isEmpty()
+ && !XMLUtils.getChildElements(soapOperation).isEmpty())
+ throw new AssertionFailException("wsdl:operation name is "
+ + bindingOperation.getName());
+
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1301.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1301.java
new file mode 100644
index 000000000..a648fd818
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1301.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1301.
+ */
+public class BP1301 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1301(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ //Get the requets message and check the value of mustUnderstand.
+ String message = entryContext.getMessageEntry().getMessage();
+ Object[] mustUnderstandAttributes = getMustUnderstandAttributes(message);
+
+ if (mustUnderstandAttributes == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ for (int index = 0; index < mustUnderstandAttributes.length; index++)
+ {
+ if ((mustUnderstandAttributes[index] != null)
+ && (mustUnderstandAttributes[index].equals("1")
+ || mustUnderstandAttributes[index].equals("0")))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "The SOAP mustUnderstand attribute was present "
+ + " and its value was "
+ + mustUnderstandAttributes[index],
+ entryContext);
+ } //End if
+ } //End for
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ //Retreives the value of the mustUnderstand attribute from ALL SOAP header
+ //If the Header is missing or if it does not contain any targets or if
+ //the header does not contain a mustUnderstand attribute then set the
+ //assertionResult to RESULT_NOT_APPLICABLE.
+ private Object[] getMustUnderstandAttributes(String message)
+ throws WSIException
+ {
+ if (message == null || message.trim().equals("")) {
+ return null;
+ }
+
+ Document doc = XMLUtils.parseXML(message);
+ NodeList headers =
+ doc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Header");
+
+ //If a header not present set result to notApplicable
+ //else process each headerEntry
+ if (headers.getLength() <= 0)
+ {
+ return null;
+ }
+ else
+ {
+ Vector mustUnderstandAttributes = new Vector();
+ Element header = (Element) headers.item(0);
+ if (header == null)
+ return null;
+
+ NodeList headerEntries = header.getChildNodes();
+ //For each header entry check retreive the mustUnderstand attribute
+ //if any, else set the test result to notApplicable
+
+ //This is used to indicate if a header contained any child Elements
+ boolean headerTargets = false;
+
+ for (int index = 0; index < headerEntries.getLength(); ++index)
+ {
+ Node headerEntry = headerEntries.item(index);
+ if (headerEntry.getNodeType() == Node.ELEMENT_NODE)
+ {
+ headerTargets = true;
+ Attr mustUnderstand =
+ ((Element) headerEntry).getAttributeNodeNS(
+ WSIConstants.NS_URI_SOAP,
+ "mustUnderstand");
+ //Retreive the value of the mustUnderstand attribute of the request.
+ if (mustUnderstand != null)
+ {
+ String mustUnderstandValue = mustUnderstand.getNodeValue();
+ mustUnderstandAttributes.add(mustUnderstandValue);
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ //The SOAP Header does not contain a mustUnderstand attribute."
+ } // mustUnderstand != null
+ }
+ } //End for
+
+ if (!headerTargets)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ //The SOAP Header does not contain any header entries.
+ }
+
+ return mustUnderstandAttributes.toArray();
+ } //End If headers.getLength() < 0
+ }
+
+ /**
+ * Returns true if this object is must understand fault code.
+ * @param faultCodeElem understand fault code.
+ * @return true if this object is must understand fault code.
+ */
+ public boolean isMustUnderstandFaultCode(Element faultCodeElem)
+ {
+ //A faultcode may or maynot have a prefix, if it does its namespace should be
+ //htt://schemas.xmlsoap.org/soap/envelope which is the same as the faultcode element.
+ //If a prefix is present and it corresponds to a different namespace or is null
+ //then this returns false. The local part of the faultcode is then check to see
+ //if it is one of the permitted values.
+ if (faultCodeElem == null)
+ return false;
+
+ String faultCode = faultCodeElem.getFirstChild().getNodeValue().trim();
+ if (faultCode == null)
+ return false;
+
+ String faultCodeElemPrefix = faultCodeElem.getPrefix();
+ String faultCodePrefix = faultCode.substring(0, faultCode.indexOf(':'));
+ String faultCodeName =
+ faultCode.substring(faultCode.indexOf(':') + 1, faultCode.length());
+
+ if ((faultCodeElemPrefix != null || faultCodePrefix != null))
+ {
+ if (faultCodePrefix.equals(faultCodeElemPrefix)
+ && (faultCodeName.equals("MustUnderstand")
+ || faultCodeName.startsWith("MustUnderstand.")))
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ if (faultCode.equals("MustUnderstand")
+ || faultCodeName.startsWith("MustUnderstand."))
+ return true;
+ else
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1302.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1302.java
new file mode 100644
index 000000000..ffe6af623
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1302.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1302.
+ * The soap:faultcode value in the soap:Fault element of the response
+ * message is not custom, and is one of: VersionMismatch, MustUnderstand, Client, Server.
+ */
+public class BP1302 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1302(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ //SOAP fault code values should not be custom: only standard code qualifiers
+ //are used: VersionMismatch, MustUnderstand, Client, Server
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ //String requestMessage = null;
+ String responseMessage = null;
+
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ //Get the response message check the faultcode.
+ MessageEntry logEntryResponse = entryContext.getResponse();
+ if (logEntryResponse != null)
+ {
+ responseMessage = logEntryResponse.getMessage();
+
+ Document targetDoc = XMLUtils.parseXML(responseMessage);
+ NodeList faultCodes = targetDoc.getElementsByTagName("faultcode");
+ // targetDoc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "faultcode");
+
+ if (faultCodes.getLength() <= 0)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ //No faultcode
+
+ for (int i = 0; i < faultCodes.getLength(); i++)
+ {
+ Node faultCodeElem = faultCodes.item(i);
+ //If the faultcode was MustUnderstand, check the value of
+ //the mustUnderstand attribute in the request.
+ if (faultCodeElem == null)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ else if (faultCodeElem.getNodeType() == Node.ELEMENT_NODE)
+ {
+ if (isValidFaultCode((Element) faultCodeElem))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(responseMessage, entryContext);
+ //failureDetail =
+ // "The faultcode value was : "
+ // + faultCodeElem.getFirstChild().getNodeValue().trim();
+ } //End if (faultCode.equals...)
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ } //End for
+ } //End if logEntryResponse!= null
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check faultCode.
+ * @param faultCodeElem a faultcode.
+ * @return true if faultcode is valid.
+ */
+ public boolean isValidFaultCode(Element faultCodeElem)
+ {
+ //A faultcode may or maynot have a prefix, if it does its namespace should be
+ //http://schemas.xmlsoap.org/soap/envelope which is the same as the faultcode element.
+ //If a prefix is present and it corresponds to a different namespace or is null
+ //then this returns false. The local part of the faultcode is then check to see
+ //if it is one of the permitted values.
+ if (faultCodeElem == null)
+ return true;
+
+ String faultCode = faultCodeElem.getFirstChild().getNodeValue().trim();
+ if (faultCode == null)
+ return false;
+
+ // FIX: This is not correct, since this element can not be namespace qualified
+ String faultCodeElemPrefix = faultCodeElem.getParentNode().getPrefix();
+
+ // If this is not a QName then return false
+ int index;
+ String faultCodePrefix = null;
+ String faultCodeName = faultCode;
+ if ((index = faultCode.indexOf(':')) != -1)
+ {
+ faultCodePrefix = faultCode.substring(0, index);
+ faultCodeName = faultCode.substring(index + 1, faultCode.length());
+ }
+
+ if ((faultCodeElemPrefix != null && faultCodePrefix != null))
+ {
+ if (faultCodePrefix.equals(faultCodeElemPrefix))
+ {
+ if ((faultCodeName.equals("MustUnderstand")
+ || faultCodeName.equals("VersionMismatch")
+ || faultCodeName.equals("Client")
+ || faultCodeName.equals("Server")))
+ /* REMOVE:
+ || faultCodeName.startsWith("MustUnderstand.")
+ || faultCodeName.startsWith("VersionMismatch.")
+ || faultCodeName.startsWith("Client.")
+ || faultCodeName.startsWith("Server.")))
+ */
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if (faultCodeName.equals("MustUnderstand")
+ || faultCodeName.equals("VersionMismatch")
+ || faultCodeName.equals("Client")
+ || faultCodeName.equals("Server")
+ || faultCodeName.startsWith("MustUnderstand.")
+ || faultCodeName.startsWith("VersionMismatch.")
+ || faultCodeName.startsWith("Client.")
+ || faultCodeName.startsWith("Server."))
+ return true;
+ else
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1305.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1305.java
new file mode 100644
index 000000000..fad1b9662
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1305.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.net.HttpURLConnection;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1305.
+ * It is in an HTTP 500 message with "Server" Error code.
+ */
+public class BP1305 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1305(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ // Check if this is one way response
+ // or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // look for <soap:Fault> element:
+ NodeList faultList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_FAULT);
+ if ((faultList == null) || (faultList.getLength() == 0))
+ {
+ // Response does not contain a soap:fault
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // we have a soap:Fault. Check that it is contained in a HTTP 500 message
+ // GT : base HTTP Header parsing on BP1001 - this should be factored to a
+ // general-purpose HTTP message parsing method or methods (request & response)
+ String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
+ //Response-Line = HTTP-Version ResponseCode ResponseMsg SP CRLF
+ Vector responseLine = new Vector();
+ String startLine = null;
+ //String httpVersion = null;
+ //String responseCode = null;
+ String statusCode = null;
+ StringTokenizer httpMessageTokenizer =
+ new StringTokenizer(httpHeader, "\n\r\f");
+
+ if (httpMessageTokenizer.hasMoreTokens())
+ startLine = httpMessageTokenizer.nextToken();
+
+ if (startLine.startsWith("HTTP"))
+ {
+ StringTokenizer startLineTokenizer =
+ new StringTokenizer(startLine, "\u0020");
+
+ while (startLineTokenizer.hasMoreTokens())
+ {
+ responseLine.add(startLineTokenizer.nextToken());
+ }
+
+ //httpVersion = (String) responseLine.get(0);
+
+ // PB: Check for 500 status code which should be the second token in the string
+ statusCode = (String) responseLine.get(1);
+
+ //responseCode = (String) responseLine.get(1);
+ //statusCode = (String) responseLine.get(2);
+ }
+ try
+ {
+ // PB: Just check for 500 status code
+ if (!statusCode
+ .equals(String.valueOf(HttpURLConnection.HTTP_INTERNAL_ERROR)))
+ {
+ //if (!responseCode.equalsIgnoreCase("OK") ||
+ // (!statusCode.equalsIgnoreCase("ServerError"))) {
+ // Assertion failed
+ throw new AssertionFailException(httpHeader);
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1306.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1306.java
new file mode 100644
index 000000000..1ec562f55
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1306.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1306.
+ * The soap:Fault element does not have children other than soap:faultcode, soap:faultstring, soap:faultactor or soap:detail.
+ */
+public class BP1306 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1306(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ // Check if this is one way response
+ // or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // look for <soap:Fault> element:
+ NodeList faultList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_FAULT);
+ if ((faultList == null) || (faultList.getLength() == 0))
+ {
+ // Response does not contain a soap:fault
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check that no soap:fault contains only faultcode, faultstring, faultactor, detail.
+ // If it does, further check that it is unqualified.
+ // For each <soap:Fault>
+ try
+ {
+ for (int n = 0; n < faultList.getLength(); n++)
+ {
+ for (Node child = faultList.item(n).getFirstChild();
+ child != null;
+ child = child.getNextSibling())
+ {
+ if ((child.getNodeType() == Node.ELEMENT_NODE)
+ && !(child
+ .getLocalName()
+ .equalsIgnoreCase(XMLUtils.SOAP_ELEM_FAULT_CODE)
+ || child.getLocalName().equalsIgnoreCase(
+ XMLUtils.SOAP_ELEM_FAULT_STRING)
+ || child.getLocalName().equalsIgnoreCase(
+ XMLUtils.SOAP_ELEM_FAULT_ACTOR)
+ || child.getLocalName().equalsIgnoreCase(
+ XMLUtils.SOAP_ELEM_FAULT_DETAIL)))
+ {
+ // PB: This is checked in 1316 now
+ //|| (child.getNamespaceURI() != null)) {
+ // Assertion failed
+ throw new AssertionFailException(
+ entryContext.getMessageEntry().getMessage());
+ }
+ }
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1307.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1307.java
new file mode 100644
index 000000000..0e855da07
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1307.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1307.
+ * The elements of the message that are namespaced
+ * "http://schemas.xmlsoap.org/soap/envelope/" do not have a soap:encodingStyle attribute.
+ */
+public class BP1307 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1307(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ // Check if this is one way response
+ // or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // look for <soap:xxx> elements:
+ NodeList soapList =
+ doc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "*");
+ if ((soapList == null) || (soapList.getLength() == 0))
+ {
+ // Response does not contain any soap envelope elements
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check that no <soap:xxx> elements contains a soap:encodingStyle attribute
+ // For each <soap:xxx>
+ try
+ {
+ for (int n = 0; n < soapList.getLength(); n++)
+ {
+ Element nextElem = (Element) soapList.item(n);
+ if (nextElem
+ .getAttributeNodeNS(WSIConstants.NS_URI_SOAP, "encodingStyle")
+ != null)
+ {
+ // Assertion failed
+ throw new AssertionFailException(
+ entryContext.getMessageEntry().getMessage());
+ }
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1308.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1308.java
new file mode 100644
index 000000000..8c970c1d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1308.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1308.
+ * The children elements of soap:Body do not have a soap:encodingStyle attribute.
+ */
+public class BP1308 extends AssertionProcess implements WSITag
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1308(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ throw new AssertionNotApplicableException();
+
+ // look for soap:Body elements:
+ NodeList soapBodyList = doc.getElementsByTagNameNS(
+ ELEM_SOAP_BODY.getNamespaceURI(), ELEM_SOAP_BODY.getLocalPart());
+
+ // The message does not contain any soap:Body, the assertion is not applicable
+ if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
+ throw new AssertionNotApplicableException();
+
+ // check that no soap:Body child elements contain a soap:encodingStyle attribute
+ // Getting the first soap:Body child element
+ Element child =
+ XMLUtils.getFirstChild((Element) soapBodyList.item(0));
+ while (child != null)
+ {
+ if (child.getAttributeNodeNS(
+ ELEM_SOAP_BODY.getNamespaceURI(), "encodingStyle") != null)
+ {
+ throw new AssertionFailException("The child element name is \"" +
+ child.getNodeName() + "\".");
+ }
+ // Getting the next soap:Body child element
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1309.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1309.java
new file mode 100644
index 000000000..9a011ea67
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1309.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1309.
+ * The soap:Envelope does not have direct children after the soap:Body element
+ */
+public class BP1309 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1309(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ // Check if this is one way response
+ // or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // look for <soap:Envelope> elements:
+ // (Note: since this is a Soap message we expect exactly one soap envelope, but we do not assume it).
+ NodeList soapEnvList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_ENVELOPE);
+ if ((soapEnvList == null) || (soapEnvList.getLength() == 0))
+ {
+ // Response does not contain any soap Envelope element(s)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check that if a <soap:Body> exists in a <soap:Envelope>, that its the last in the envelope
+ try
+ {
+ // For each <soap:Envelope>
+ for (int n = 0; n < soapEnvList.getLength(); n++)
+ {
+ // Get the list of all elements in the Envelope
+ Element soapEnv = (Element) soapEnvList.item(n);
+ NodeList envChildList = soapEnv.getChildNodes();
+ Vector envChildElemList = new Vector();
+ for (int v = 0; v < envChildList.getLength(); v++)
+ {
+ Node nextNode = envChildList.item(v);
+ if (nextNode.getNodeType() == Node.ELEMENT_NODE)
+ {
+ envChildElemList.addElement((Element) nextNode);
+ }
+ }
+ // Search the list for <soap:Body>
+ for (int m = 0; m < envChildElemList.size(); m++)
+ {
+ Element envChildElem = (Element) envChildElemList.elementAt(m);
+ if (envChildElem
+ .getNamespaceURI()
+ .equals(WSIConstants.NS_URI_SOAP)
+ && envChildElem.getLocalName().equals(XMLUtils.SOAP_ELEM_BODY))
+ {
+ // found a <soap:Body> so check its the last in the list of child elements of the Envelope
+ if (envChildElem != envChildElemList.lastElement())
+ {
+ throw new AssertionFailException(
+ entryContext.getMessageEntry().getMessage());
+ }
+ }
+ }
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1316.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1316.java
new file mode 100644
index 000000000..b37461beb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1316.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1316.
+ * The soap:Fault element children (soap:faultcode, soap:faultstring, soap:faultactor or soap:detail) are unqualified.
+ */
+public class BP1316 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1316(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ // Check if this is one way response
+ // or message is mepty or invalid
+ if (this.validator.isOneWayResponse(entryContext)
+ || (doc = entryContext.getMessageEntryDocument()) == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // look for <soap:Fault> element:
+ NodeList faultList =
+ doc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_FAULT);
+ if ((faultList == null) || (faultList.getLength() == 0))
+ {
+ // Response does not contain a soap:fault
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check that no soap:fault contains only faultcode, faultstring, faultactor, detail.
+ // If it does, further check that it is unqualified.
+ // For each <soap:Fault>
+ try
+ {
+ for (int n = 0; n < faultList.getLength(); n++)
+ {
+ for (Node child = faultList.item(n).getFirstChild();
+ child != null;
+ child = child.getNextSibling())
+ {
+ if ((child.getNodeType() == Node.ELEMENT_NODE)
+ && (child
+ .getLocalName()
+ .equalsIgnoreCase(XMLUtils.SOAP_ELEM_FAULT_CODE)
+ || child.getLocalName().equalsIgnoreCase(
+ XMLUtils.SOAP_ELEM_FAULT_STRING)
+ || child.getLocalName().equalsIgnoreCase(
+ XMLUtils.SOAP_ELEM_FAULT_ACTOR)
+ || child.getLocalName().equalsIgnoreCase(
+ XMLUtils.SOAP_ELEM_FAULT_DETAIL))
+ && (child.getNamespaceURI() != null))
+ {
+ // Assertion failed
+ throw new AssertionFailException(
+ entryContext.getMessageEntry().getMessage());
+ }
+ }
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1318.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1318.java
new file mode 100644
index 000000000..a6423b7c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1318.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLUtils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BP1318
+ *
+ * The grandchildren elements of soap:Body do not have a soap:encodingStyle attribute.
+ */
+public class BP1318 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1318(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Parse message
+ Document responseDoc = entryContext.getMessageEntryDocument();
+ Document requestDoc = entryContext.getRequestDocument();
+
+ // messages are empty or invalid, DOM objects are null
+ if (responseDoc == null || requestDoc == null) {
+ throw new AssertionNotApplicableException();
+ }
+
+ //if (isFault(responseDoc))
+ // throw new AssertionNotApplicableException();
+
+ // Get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ // Get the binding that is being processed
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+
+ //Create the types registry
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+
+ // Find an operation match
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ requestDoc,
+ action,
+ binding,
+ registry);
+ if (match == null)
+ throw new AssertionNotApplicableException();
+
+ // Get the binding operation based on the match
+ BindingOperation bindingOperation = match.getOperation();
+
+ // If this is not rpc-literal, then return notApplicable result
+ if (!WSDLUtils
+ .isRpcLiteral(match.getOperationStyle(), bindingOperation))
+ {
+ throw new AssertionNotApplicableException();
+ }
+ // look for <soap:Body> elements:
+ NodeList soapBodyList =
+ responseDoc.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_BODY);
+ if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
+ // Response does not contain any soap Body elements
+ throw new AssertionNotApplicableException();
+
+ // check that no <soap:Body> child or grandchild elements contains a soap:encodingStyle attribute
+ // For each <soap:Body>
+ boolean grandChildFound = false;
+ for (int n = 0; n < soapBodyList.getLength(); n++)
+ {
+ Element nextBodyElem = (Element) soapBodyList.item(n);
+ // REMOVE: This will get all nodes (child, grandchildren, etc.)
+ //NodeList childList = nextBodyElem.getElementsByTagName("*");
+ NodeList childList = nextBodyElem.getChildNodes();
+ if (childList != null)
+ {
+ // check all child elements
+ for (int m = 0; m < childList.getLength(); m++)
+ {
+ if (childList.item(m).getNodeType() == Node.ELEMENT_NODE)
+ {
+ Element nextChildElem = (Element) childList.item(m);
+ // check children of this child
+ // REMOVE: This will get all nodes (child, grandchildren, etc.)
+ NodeList grandChildList = nextChildElem.getChildNodes();
+ if (grandChildList != null)
+ {
+ for (int p = 0; p < grandChildList.getLength(); p++)
+ {
+ if (grandChildList.item(p).getNodeType()
+ == Node.ELEMENT_NODE)
+ {
+ grandChildFound = true;
+ Element nextGrandChildElem =
+ (Element) grandChildList.item(p);
+ if (nextGrandChildElem
+ .getAttributeNodeNS(
+ WSIConstants.NS_URI_SOAP,
+ "encodingStyle")
+ != null)
+ {
+ // Assertion failed (ADD highlight the child here ?)
+ throw new AssertionFailException(
+ entryContext.getMessageEntry().getMessage());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!grandChildFound)
+ {
+ throw new AssertionNotApplicableException();
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1600.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1600.java
new file mode 100644
index 000000000..94712fd94
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1600.java
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+
+/**
+ * BP1600
+ *
+ * <context>For a candidate envelope</context>
+ * <assertionDescription>The envelope conforms to the structure specified in SOAP 1.1 Section 4.</assertionDescription>
+ */
+public class BP1600 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1600(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion failed
+ if (doc == null)
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+ else
+ throw new AssertionFailException("The log message is empty or invalid.");
+ }
+ // SOAP 1.1 specifications, Section 4.
+ // http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383494
+
+ // The namespace identifier for the elements and attributes defined
+ // in this section is "http://schemas.xmlsoap.org/soap/envelope/".
+
+ // o The Envelope is the top element of the XML document representing the message.
+
+ // Rule 1. Envelope
+ // o The element name is "Envelope".
+ // o The element MUST be present in a SOAP message
+ // o The element MAY contain namespace declarations as well as additional attributes.
+ // If present, such additional attributes MUST be namespace-qualified. Similarly,
+ // the element MAY contain additional sub elements. If present these elements
+ // MUST be namespace-qualified and MUST follow the SOAP Body element.
+
+ // Getting the top element
+ Element element = doc.getDocumentElement();
+
+ // Assuming that the top element should be soap:Envelope
+ // If not, the assertion failed
+ if (!element.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE)
+ || !isSOAPNamespace(element.getNamespaceURI()))
+ throw new AssertionFailException("The top element is not soap:Envelope");
+
+ // Collecting all the namespace declarations
+ Collection envelopeNamespaces = collectNamespaces(element.getAttributes());
+ envelopeNamespaces.add(WSIConstants.NS_URI_XMLNS);
+
+ // Getting an attribute that is not in any of the namespaces
+ Attr notValidAttr = getNotValidAttr(
+ element.getAttributes(),
+ envelopeNamespaces);
+
+ // If found one, the assertion failed
+ if (notValidAttr != null)
+ throw new AssertionFailException("The attribute "
+ + notValidAttr.getNodeName() + " is not namespace-qualified");
+
+
+ // Rule 2. Header
+ // o The element name is "Header".
+ // o The element MAY be present in a SOAP message. If present, the element
+ // MUST be the first immediate child element of a SOAP Envelope element.
+ // o The element MAY contain a set of header entries each being an immediate
+ // child element of the SOAP Header element. All immediate child elements
+ // of the SOAP Header element MUST be namespace-qualified.
+
+ // Getting the first sub element of the envelope
+ element = XMLUtils.getFirstChild(element);
+
+ // If the child is soap:Header
+ if (element != null
+ && element.getLocalName().equals(XMLUtils.SOAP_ELEM_HEADER)
+ && isSOAPNamespace(element.getNamespaceURI()))
+ {
+
+ // Going through all the Header entries
+ Element headerEntry = XMLUtils.getFirstChild(element);
+ while (headerEntry != null)
+ {
+ // Collecting all the namespaces for the current entry
+ Collection headerEntryNamespaces = collectNamespaces(
+ headerEntry.getAttributes());
+
+ // If the entry is not in the namespaces, the assertion failed
+ if (!envelopeNamespaces.contains(headerEntry.getNamespaceURI())
+ && !headerEntryNamespaces.contains(headerEntry.getNamespaceURI()))
+ throw new AssertionFailException("The header entry "
+ + headerEntry.getNodeName() + " is not namespace-qualified");
+
+ // Getting the next Header entry
+ headerEntry = XMLUtils.getNextSibling(headerEntry);
+ }
+
+ // Getting the next sub element of the envelope
+ element = XMLUtils.getNextSibling(element);
+ }
+
+
+ // Rule 3. Body
+ // o The element name is "Body".
+ // o The element MUST be present in a SOAP message and MUST be an immediate
+ // child element of a SOAP Envelope element. It MUST directly follow the
+ // SOAP Header element if present. Otherwise it MUST be the first immediate
+ // child element of the SOAP Envelope element.
+ // o The element MAY contain a set of body entries each being an immediate
+ // child element of the SOAP Body element. Immediate child elements of the
+ // SOAP Body element MAY be namespace-qualified. SOAP defines the SOAP Fault
+ // element, which is used to indicate error messages.
+
+ // if the SOAP Body element is not presented, the assertion failed
+ if (element == null
+ || !element.getLocalName().equals(XMLUtils.SOAP_ELEM_BODY)
+ || !isSOAPNamespace(element.getNamespaceURI()))
+ throw new AssertionFailException("The soap:Body element is not presented "
+ + "or follows an additional sub element of soap:Envelope");
+
+ // Processing all other sub elements of the envelope
+ element = XMLUtils.getNextSibling(element);
+ while (element != null)
+ {
+ // Checking for the SOAP Header element
+ if (element.getLocalName().equals(XMLUtils.SOAP_ELEM_HEADER)
+ && isSOAPNamespace(element.getNamespaceURI()))
+ throw new AssertionFailException(
+ "The soap:Header element cannot follow the soap:Body element");
+
+ // Collecting all the namespaces for the current element
+ Collection elementNamespaces = collectNamespaces(
+ element.getAttributes());
+
+ // If the element is not in the namespaces, the assertion failed
+ if (!envelopeNamespaces.contains(element.getNamespaceURI())
+ && !elementNamespaces.contains(element.getNamespaceURI()))
+ throw new AssertionFailException("The sub envelope element "
+ + element.getNodeName() + " is not namespace-qualified");
+
+ // Getting the next sub element of the envelope
+ element = XMLUtils.getNextSibling(element);
+ }
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Collects all the namespace declarations from attributes collection
+ * @param attrs an attributes collection
+ * @return a collection of namespaces
+ */
+ private Collection collectNamespaces(NamedNodeMap attrs)
+ {
+ Collection ns = new HashSet();
+ if (attrs != null)
+ {
+ for(int i = 0; i < attrs.getLength(); i++)
+ {
+ Attr attr = (Attr) attrs.item(i);
+ if (attr.getNamespaceURI() != null
+ && attr.getNamespaceURI().equals(WSIConstants.NS_URI_XMLNS))
+ ns.add(attr.getValue());
+ }
+ }
+
+ return ns;
+ }
+
+ /**
+ * Retrieves an attribute that is not in namespaces
+ * @param attrs an attributes collection
+ * @param ns a namespaces collection
+ * @return an attribtue that is not in any of the namespaces specified
+ */
+ private Attr getNotValidAttr(NamedNodeMap attrs, Collection ns)
+ {
+ Attr ret = null;
+ if (attrs != null)
+ {
+ for(int i = 0; i < attrs.getLength(); i++)
+ {
+ Attr attr = (Attr) attrs.item(i);
+ if (attr.getNamespaceURI() == null
+ || !ns.contains(attr.getNamespaceURI()))
+ {
+ ret = attr;
+ break;
+ }
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Qualifies whether a namespace is the SOAP namespace
+ * "http://schemas.xmlsoap.org/soap/envelope/"
+ * @param ns a namespace to be qualified
+ * @return true if the namespace is qualified, false otherwise
+ */
+ private boolean isSOAPNamespace(String ns)
+ {
+ if (ns == null)
+ return false;
+
+ return ns.equals(WSIConstants.NS_URI_SOAP);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1601.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1601.java
new file mode 100644
index 000000000..602ddf8b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1601.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.xml.sax.SAXException;
+
+
+/**
+ * BP1601.
+ */
+public class BP1601 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1601(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // One-way responses will not contain a SOAP message
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ try
+ {
+ // Try to parse the SOAP message
+ //Document doc = XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
+ XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
+ }
+ catch (WSIException e)
+ {
+ if (e.getTargetException() instanceof SAXException)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ e.getTargetException().getMessage(),
+ entryContext);
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1701.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1701.java
new file mode 100644
index 000000000..ef7c55513
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1701.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.TestUtils;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.ibm.wsdl.util.xml.DOM2Writer;
+
+
+/**
+ * BP1701.
+ */
+public class BP1701 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1701(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ try
+ {
+ // TEMP: Use local copy of schema for now
+ // Document doc = XMLUtils.parseXML(entryContext.getLogEntry().getMessage(), WSIConstants.NS_URI_SOAP);
+ // Document doc = XMLUtils.parseXML(entryContext.getLogEntry().getMessage(), "schemas/soapEnvelope.xsd");
+
+ // Get a non-validated but (well-formed) DOM tree of the message content
+ Document doc =
+ XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
+
+ // Remove any xsi:types attributes from the message (SOAP Header, Body and Envelope itself)
+
+ NodeList elementList = doc.getElementsByTagName("*");
+ if (elementList != null)
+ {
+ for (int i = 0; i < elementList.getLength(); i++)
+ {
+ Element element = (Element) elementList.item(i);
+ element.removeAttributeNS(WSIConstants.NS_URI_XSI, "type");
+ }
+ }
+
+ // Write out the (potentially) modified tree to String
+ String filteredMessage = DOM2Writer.nodeToString(doc);
+
+ // Parse the result with validation "on"
+ Document validationDoc =
+ XMLUtils.parseXML(
+ filteredMessage,
+ TestUtils.getSOAPSchemaLocation());
+ }
+ catch (WSIException e)
+ {
+ if (e.getTargetException() instanceof SAXException)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ Utils.getExceptionDetails(e.getTargetException()),
+ entryContext);
+ }
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(Utils.getExceptionDetails(e), entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1755.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1755.java
new file mode 100644
index 000000000..8f1a992b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP1755.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * BP1755
+ *
+ * <context>For a candidate non-fault envelope containing a soap:body with at least one element, and that is referred by a binding style RPC-literal</context>
+ * <assertionDescription>Each part accessor element in the envelope has a local name of the same value as the name attribute of the corresponding wsdl:part element.</assertionDescription>
+ */
+public class BP1755 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1755(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ Element soapOperation = null;
+ // If there is a Fault entry or no body entries,
+ // the assertion is not applicable
+ if (validator.isFault(doc)
+ || (soapOperation = validator.getSoapBodyChild(doc)) == null)
+ throw new AssertionNotApplicableException();
+
+ // Creating a qualified name of potential SOAP operation
+ QName operationQName = new QName(
+ soapOperation.getNamespaceURI(), soapOperation.getLocalName());
+
+ // Retrieving all the RPC binding operations from wsdl:binding
+ BindingOperation[] rpcBindingOperations =
+ validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ validator.analyzerContext.getCandidateInfo().getBindings());
+
+ // Retrieving binding operation by given operation name
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ operationQName,
+ rpcBindingOperations);
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation message parts and extensibility elems
+ // in the binding depending on message type
+ List operationMessageParts = null;
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST))
+ {
+ operationMessageParts = bindingOperation.getOperation()
+ .getInput().getMessage().getOrderedParts(null);
+ if (bindingOperation.getBindingInput() != null)
+ extElems =
+ bindingOperation.getBindingInput().getExtensibilityElements();
+ }
+ else
+ {
+ operationMessageParts = bindingOperation.getOperation()
+ .getOutput().getMessage().getOrderedParts(null);
+ if (bindingOperation.getBindingOutput() != null)
+ extElems =
+ bindingOperation.getBindingOutput().getExtensibilityElements();
+ }
+
+ // If the message is not literal, the assertion is not applicable
+ if (!validator.isLiteral(extElems))
+ throw new AssertionNotApplicableException();
+
+
+ /* Basic Profile Version 1.1 (http://www.ws-i.org/Profiles/Basic/2003-12/BasicProfile-1.1.htm)
+ * says that the order of the elements in the soap:body of an ENVELOPE MUST be
+ * the same as that of the wsdl:parts in the wsdl:message that describes it.
+ * However, we should keep in mind there is the "parts" attribute of soapbind:body
+ * that indicates which parts appear within the SOAP Body.
+ */
+
+ // Getting the ordered list of wsdl:part names
+ List orderedPartNames =
+ validator.orderPartNames(operationMessageParts, extElems);
+ Iterator i = orderedPartNames.iterator();
+ // Getting the first accessor
+ Element accessor = XMLUtils.getFirstChild(soapOperation);
+ while (accessor != null)
+ {
+ // If there is no the corresponding wsdl:part element
+ // for an accessor, the assertion failed
+ if (!i.hasNext())
+ throw new AssertionFailException(
+ "The part accessor element '" + accessor.getLocalName()
+ + "' does not have the corresponding wsdl:part element.");
+
+ // If local name of accessor does not equal to the name of the
+ // corresponding wsdl:part element, the assertion failed
+ String partName = (String) i.next();
+ if (!accessor.getLocalName().equals(partName))
+ throw new AssertionFailException(
+ "The accessor local name is " + accessor.getLocalName()
+ + ", the corresponding part element name is " + partName);
+
+ // Getting the next accessor
+ accessor = XMLUtils.getNextSibling(accessor);
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4100.java
new file mode 100644
index 000000000..d3e8f1c9e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4100.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPHeader;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+
+/**
+ * BP4100
+ * <context>For a candidate envelope containing a header block that is either mandatory or is not described in the wsdl:binding.</context>
+ * <assertionDescription>An envelope contains a header block that is either mandatory or is not described in the wsdl:binding.</assertionDescription>
+ */
+public class BP4100 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4100(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Parsing the message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting header elements from envelope
+ Element root = doc.getDocumentElement();
+ NodeList headerList = root.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_HEADER);
+
+ // If there is no header, the assertion is not applicable
+ if (headerList == null || headerList.getLength() == 0)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting the header element
+ Node header = headerList.item(0);
+
+ // Getting the immediate child elements of the header
+ NodeList elems = header.getChildNodes();
+
+ // If there are no child elements of the header
+ // the assertion is not applicable
+ if (elems == null || elems.getLength() == 0)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Walking through child elements
+ for (int i = 0; i < elems.getLength(); i++)
+ {
+
+ if (elems.item(i).hasAttributes())
+ {
+ // Getting the mustUnderstand attribute
+ Node muNode = elems.item(i).getAttributes().getNamedItem(
+ root.getPrefix() + ":" + XMLUtils.SOAP_ATTR_MUST_UNDERSTAND);
+ // If a header block is mandatory, then the assertion passed
+ if (muNode != null && muNode.getNodeValue().equals("1"))
+ {
+ throw new AssertionPassException();
+ }
+ }
+
+ // Getting header block name
+ String blockName = elems.item(i).getLocalName();
+ // If the name is not presented (occurs when element is empty string)
+ // then continue with the next element
+ if (blockName == null)
+ {
+ continue;
+ }
+
+ boolean blockNameExists = false;
+
+ // Getting WSDL bindings
+ Binding[] bindings = validator.getWSDLDocument().getBindings();
+ for (int j = 0; j < bindings.length; j++)
+ {
+ // Getting wsdl:operations
+ List operations = bindings[j].getBindingOperations();
+ Iterator k = operations.iterator();
+ while (k.hasNext() && !blockNameExists)
+ {
+ BindingOperation operation = (BindingOperation) k.next();
+
+ // If this is a request message,
+ // then getting wsdl:input for an operation
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST))
+ {
+ BindingInput opInput = operation.getBindingInput();
+ if (opInput != null)
+ {
+ // If wsdl:input is presented then checking
+ // whether the block name is described there or not
+ blockNameExists = blockNameExists(
+ opInput.getExtensibilityElements(), blockName);
+ }
+ }
+ // If this is a response message,
+ // then getting wsdl:output for an operation
+ else
+ {
+ BindingOutput opOutput = operation.getBindingOutput();
+ if (opOutput != null)
+ {
+ // If wsdl:output is presented then checking
+ // whether the block name is described there or not
+ blockNameExists = blockNameExists(
+ opOutput.getExtensibilityElements(), blockName);
+ }
+ }
+ }
+ }
+
+ // If a header block is not described in the appropriate wsdl:binding
+ // then the assertion passed
+ if (!blockNameExists)
+ {
+ throw new AssertionPassException();
+ }
+ }
+
+ // No one header block is either mandatory or is not described in the
+ // appropriate wsdl:binding, the assertion is not applicable
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ }
+ catch (AssertionPassException ape)
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checks the existense of blockName in wsdlsoap:header, if it is found in
+ * a list of ExtensibilityElement objects
+ *
+ * @param elems A list of ExtensibilityElement objects
+ * @param blockName The name that will be checked for existence
+ * @return true if blockName is described in the wsdlsoap:header extensibility element
+ */
+ private boolean blockNameExists(List elems, String blockName)
+ {
+ if (elems == null)
+ {
+ return false;
+ }
+
+ Iterator i = elems.iterator();
+ while (i.hasNext())
+ {
+ ExtensibilityElement elem = (ExtensibilityElement) i.next();
+ String elemName = elem.getElementType().getLocalPart();
+ if (elemName.equals("header"))
+ {
+ SOAPHeader soapHeader = (SOAPHeader) elem;
+ if (soapHeader.getPart().equals(blockName))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4101.java
new file mode 100644
index 000000000..ccf155e45
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4101.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * BP4101
+ * <context>For a candidate envelope containing a soap:actor attribute with a value other than the special uri "http://schemas.xmlsoap.org/soap/actor/next".</context>
+ * <assertionDescription>A header element in the envelope contains a soap:actor attribute with a value other than the special uri "http://schemas.xmlsoap.org/soap/actor/next".</assertionDescription>
+ */
+public class BP4101 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4101(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try {
+
+ // Parsing the message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting header elements from envelope
+ Element root = doc.getDocumentElement();
+ NodeList headerList = root.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_HEADER);
+
+ // If there is no header, the assertion is not applicable
+ if (headerList == null || headerList.getLength() == 0)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting the header element
+ Node header = headerList.item(0);
+
+ // Getting the immediate child elements of the header
+ NodeList elems = header.getChildNodes();
+
+ // If there is no child elements of the header
+ // the assertion is not applicable
+ if (elems == null || elems.getLength() == 0)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Walking through child elements
+ for (int i = 0; i < elems.getLength(); i++)
+ {
+ // Getting node attributes
+ NamedNodeMap attrs = elems.item(i).getAttributes();
+
+ // If the node does not have attributes then continue
+ if (attrs == null)
+ {
+ continue;
+ }
+
+ // Getting actor attribute
+ Node actor = attrs.getNamedItem(root.getPrefix()
+ + ":" + XMLUtils.SOAP_ATTR_ACTOR);
+
+ // If the actor attribute is presented and does not equal
+ // to "http://schemas.xmlsoap.org/soap/actor/next",
+ // then the assertion passed
+ if (actor != null
+ && !actor.getNodeValue().equals(WSIConstants.NS_URI_SOAP_NEXT_ACTOR))
+ {
+ throw new AssertionPassException();
+ }
+ }
+
+ // No one actor attribute has a value other than
+ // "http://schemas.xmlsoap.org/soap/actor/next",
+ // the assertion is not applicable
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ }
+ catch (AssertionPassException ape)
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4102.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4102.java
new file mode 100644
index 000000000..e49c072d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4102.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * BP4102
+ * <context>For a candidate envelope containing a fault with a non-empty detail element.</context>
+ * <assertionDescription>A Fault element in an envelope contains a non-empty detail element.</assertionDescription>
+ */
+public class BP4102 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4102(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try {
+
+ // Parsing the message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting Fault elements from envelope
+ Element root = doc.getDocumentElement();
+ NodeList faultList = root.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_FAULT);
+
+ // If there is no Fault element, the assertion is not applicable
+ if (faultList == null || faultList.getLength() == 0)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Fault element must not appear more than once
+ // within a Body element, so getting the first one
+ Element fault = (Element) faultList.item(0);
+
+ // Getting Fualt's detail elements
+ NodeList details = fault.getElementsByTagName(
+ XMLUtils.SOAP_ELEM_FAULT_DETAIL);
+ // If there is a non-empty detail element, then the assertion passed
+ if (details != null
+ && details.getLength() > 0)
+ {
+ NodeList list = details.item(0).getChildNodes();
+ // search first element node
+ for (int i = 0; i < list.getLength(); i++)
+ {
+ if((list.item(i).getNodeType() == Node.ELEMENT_NODE)
+ && (list.item(i).getLocalName() != null) )
+ {
+ throw new AssertionPassException();
+ }
+ }
+ }
+
+ // There is no detail element in Fault,
+ // the assertion is not applicable
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ }
+ catch (AssertionPassException ape)
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4109.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4109.java
new file mode 100644
index 000000000..0613b0d23
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/BP4109.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+/**
+ * BP4109
+ *
+ * <context>For a candidate envelope containing a soap:Body element with attributes</context>
+ * <assertionDescription>An envelope contains a a soap:Body element with attributes.</assertionDescription>
+ */
+public class BP4109 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4109(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try {
+
+ // Parsing the message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting the soap:Body elements from envelope
+ NodeList bodyList = doc.getDocumentElement().getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_BODY);
+
+ // If there is no Body element, the assertion is not applicable
+ if (bodyList == null || bodyList.getLength() == 0)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting the first soap:Body element
+ Element body = (Element) bodyList.item(0);
+
+ // If the Body element has attributes (excluding namespace declarations),
+ // the assertion passed
+ NamedNodeMap attrs = body.getAttributes();
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.getLength(); i++)
+ {
+ String attrName = ((Attr) attrs.item(i)).getName();
+ if (!attrName.equals("xmlns") && !attrName.startsWith("xmlns:"))
+ {
+ throw new AssertionPassException();
+ }
+ }
+ }
+
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionPassException ape)
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/EnvelopeValidatorImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/EnvelopeValidatorImpl.java
new file mode 100644
index 000000000..f8c226939
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/EnvelopeValidatorImpl.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2003 IBM Corporation, Parasoft and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Parasoft - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.EnvelopeValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+
+/**
+ * @version 1.0
+ */
+public class EnvelopeValidatorImpl
+ extends BaseMessageValidator
+ implements EnvelopeValidator
+{
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isPrimaryEntryTypeMatch(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ protected boolean isPrimaryEntryTypeMatch(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ {
+ boolean match = false;
+
+ // Verify that the entry and test assertion have the same primary context
+ if ((testAssertion.getEntryTypeName().equals(EntryType.TYPE_ENVELOPE_ANY))
+ || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_ENVELOPE_REQUEST)
+ && (entryContext
+ .getEntry()
+ .getEntryType()
+ .getTypeName()
+ .equals(EntryType.TYPE_MESSAGE_REQUEST)))
+ || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_ENVELOPE_RESPONSE)
+ && (entryContext
+ .getEntry()
+ .getEntryType()
+ .getTypeName()
+ .equals(EntryType.TYPE_MESSAGE_RESPONSE))))
+ {
+ match = true;
+ }
+
+ return match;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP1601.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP1601.java
new file mode 100644
index 000000000..5daae51b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP1601.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * SSBP1601
+ */
+public class SSBP1601 extends BP1601
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public SSBP1601(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP9704.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP9704.java
new file mode 100644
index 000000000..1ac0eb1ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/envelope/SSBP9704.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.envelope;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * SSBP9704
+ *
+ * <context>For a candidate envelope</context>
+ * <assertionDescription>The ENVELOPE does not contain the namespace declaration xmlns:xml="http://www.w3.org/XML/1998/namespace".</assertionDescription>
+ */
+public class SSBP9704 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public SSBP9704(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // Getting the root element
+ Element elem = doc.getDocumentElement();
+ // If it is not the soap:Envelope, the assertion is not applicable
+ if (!elem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP)
+ || !elem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // If the envelope contains the xmlns:xml namespace declaration,
+ // the assertion failed
+ String incorrectElementName = getIncorrectElementName(elem);
+ if (incorrectElementName != null)
+ {
+ throw new AssertionFailException("The name of an element containing "
+ + "such namespace declaration is \"" + incorrectElementName + "\".");
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for any element that contains the attribute xmlns:xml="http://www.w3.org/XML/1998/namespace".
+ * @param elem the root element.
+ * @return the name of an element found or null.
+ */
+ private String getIncorrectElementName(Element elem)
+ {
+ // Getting a value of the attribute xmlns:xml
+ String attrValue = elem.getAttributeNS(
+ WSIConstants.NS_URI_XMLNS, "xml");
+ // If it equals to "http://www.w3.org/XML/1998/namespace",
+ // return an element name;
+ if (WSIConstants.NS_URI_XML.equals(attrValue))
+ {
+ return elem.getNodeName();
+ }
+ // Going through element's children
+ Element child = XMLUtils.getFirstChild(elem);
+ while (child != null)
+ {
+ // If any of them has xmlns:xml attribute, return a value
+ String name = getIncorrectElementName(child);
+ if (name != null)
+ {
+ return name;
+ }
+ // Getting the next element's child
+ child = XMLUtils.getNextSibling(child);
+ }
+ // No xmlns:xml attributes found, return null
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1003.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1003.java
new file mode 100644
index 000000000..9d1217fd6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1003.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP1003
+ *
+ * <context>For a candidate non-multipart/related message in the log file, which has a non-empty entity-body</context>
+ * <assertionDescription>
+ * The logged SOAP envelope is a UTF-8 transcript of an envelope originally encoded as UTF-8 or UTF-16.
+ * The HTTP Content-Type header's charset value is either UTF-8 or UTF-16. Looking at the messageContent
+ * element of the logged message, either
+ * (1) it has a BOM attribute which maps the charset value in the Content-Type header, or
+ * (2) it has it has an XML declaration which matches the charset value in the Content-Type header, or
+ * (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8.
+ * </assertionDescription>
+ *
+ * @author lauzond
+ */
+public class AP1003 extends SSBP1003 {
+
+ /**
+ * @param impl
+ */
+ public AP1003(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // If there is a SOAP Message with Attachments, the assertion is not applicable
+ if (entryContext.getMessageEntry().isMimeContent())
+ {
+ return validator.createAssertionResult(testAssertion, AssertionResult.RESULT_NOT_APPLICABLE, failureDetail);
+ }
+ else
+ {
+ return super.validate(testAssertion, entryContext);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1902.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1902.java
new file mode 100644
index 000000000..d0123a4e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1902.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP1902
+ *
+ * <context>For a candidate message</context>
+ * <assertionDescription>In a description, if the wsdl:input or wsdl:output
+ * element in the wsdl:binding specifies WSDL MIME binding, then the message
+ * can contain SOAP attachments.</assertionDescription>
+ */
+public class AP1902 extends AssertionProcess implements WSITag
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1902(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting an operation matched for a message
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ entryContext.getMessageEntryDocument());
+ // If no one operation matches, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+ // Getting the corresponding extensibility elements
+ List extElems;
+ String type;
+ if (MessageEntry.TYPE_REQUEST
+ .equals(entryContext.getEntry().getEntryType()))
+ {
+ type = "input";
+ extElems = bindingOperation.getBindingInput() == null ? null
+ : bindingOperation.getBindingInput().getExtensibilityElements();
+ }
+ else
+ {
+ type = "output";
+ extElems = bindingOperation.getBindingOutput() == null ? null
+ : bindingOperation.getBindingOutput().getExtensibilityElements();
+ }
+ // If the MIME binding is not used, but the message has
+ // at least one non-root MIME part, the assertion failed
+ if (!usesMimeBinding(extElems)
+ && entryContext.getMessageEntry().getMimeParts().count() > 1)
+ {
+ throw new AssertionFailException("The wsdl:" + type + " of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checks whether the first extensibility element is mime:multipartRelated.
+ * @param extElems a list of extensibility elements.
+ * @return true if the element is mime:multipartRelated, false otherwise
+ */
+ private boolean usesMimeBinding(List extElems) {
+ // If the first extensibility element is mime:multipartRelated,
+ // return true
+ if (extElems != null && extElems.size() > 0
+ && ((ExtensibilityElement)extElems.get(0))
+ .getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ return true;
+ }
+ // otherwise return false
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1915.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1915.java
new file mode 100644
index 000000000..138338d23
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1915.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.MIMEConstants;
+import org.eclipse.wst.wsi.internal.util.MIMEUtils;
+import org.eclipse.wst.wsi.internal.util.Utils;
+
+/**
+ * AP1915
+ *
+ * <context>For a candidate root-part of a multipart/related message</context>
+ * <assertionDescription>The entity body of the root-part of a
+ * multipart/related message is serialized using either UTF-8 or UTF-16
+ * character encoding.</assertionDescription>
+ */
+public class AP1915 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1915(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // get MIME parts
+ if (!entryContext.getMessageEntry().isMimeContent())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
+ MimePart part = mimeParts.getRootPart();
+ if (part == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ String xmlEncoding = null;
+ String charset = MIMEUtils.getMimeHeaderSubAttribute(
+ part.getHeaders(),
+ MIMEConstants.HEADER_CONTENT_TYPE,
+ "charset");
+ try
+ {
+ // The HTTP Content-Type header's charset value is either UTF-8 or UTF-16.
+ if((charset != null) && (charset.equalsIgnoreCase("utf-8") ||
+ charset.equalsIgnoreCase("utf-16")))
+ {
+ // Looking at the messageContent element of the logged message, either
+ // (1) it has a BOM attribute which maps the charset value in the Content-Type header, or
+ int bom = 0;
+ if ((bom = entryContext.getMessageEntry().getBOM()) != 0)
+ {
+ if ((bom == WSIConstants.BOM_UTF8
+ && !charset.equalsIgnoreCase("utf-8"))
+ || ((bom == WSIConstants.BOM_UTF16
+ && !charset.equalsIgnoreCase("utf-16")))
+ || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN
+ && !charset.equalsIgnoreCase("utf-16"))))
+ {
+ throw new AssertionFailException("The BOM (" + bom +
+ ") and charset value (" + charset + ")do not match.");
+ }
+ }
+ // (2) it has an XML declaration which matches the charset value in the Content-Type header, or
+ else if (((xmlEncoding =
+ Utils.getXMLEncoding(part.getContent())) != null) &&
+ !xmlEncoding.equals(""))
+ {
+ if(!xmlEncoding.equalsIgnoreCase(charset))
+ {
+ throw new AssertionFailException("The XML declaration encoding (" +
+ xmlEncoding + ") and charset value (" + charset +
+ ") do not match.");
+ }
+
+ }
+ // (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8.
+ else if(!charset.equalsIgnoreCase("utf-8"))
+ {
+ throw new AssertionFailException("The no BOM attribute and no XML "+
+ "declaration, and the charset value is (" + charset + ")");
+ }
+ }
+ // header do not found or incorrect charset value
+ else
+ {
+ throw new AssertionFailException("Either the Content-Type header is not "+
+ "present in the Root Part or a charset value is invalid.");
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1917.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1917.java
new file mode 100644
index 000000000..723b8e002
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1917.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.soap.SOAPBody;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * AP1917
+ *
+ * <context>For a candidate message containing zero attachment parts</context>
+ * <assertionDescription>A message containing zero attachment parts is sent
+ * using a content-type of either "text/xml" as though a SOAP HTTP binding were
+ * used or "multipart/related" when the WSDL description for the message
+ * specifies the mime:multipartRelated element on the corresponding wsdl:input
+ * or wsdl:output element in its wsdl:binding.</assertionDescription>
+ */
+public class AP1917 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1917(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // not applicable if there are attachments
+ if (entryContext.getMessageEntry().isMimeContent())
+ {
+ if (entryContext.getMessageEntry().getMimeParts().count() > 1)
+ throw new AssertionNotApplicableException();
+ }
+
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ entryContext.getMessageEntryDocument());
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST)
+ && bindingOperation.getBindingInput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingInput().getExtensibilityElements();
+ }
+ else if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_RESPONSE)
+ && bindingOperation.getBindingOutput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingOutput().getExtensibilityElements();
+ }
+
+ // check list
+ if((extElems == null) || (extElems.size() == 0))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // determine type
+ boolean isMultiPart = false;
+
+ // if MIMEMultipartRelated then only root-part allowed
+ if(extElems.get(0) instanceof MIMEMultipartRelated)
+ {
+ if(((MIMEMultipartRelated) extElems.get(0)).getMIMEParts().size() != 1) {
+ throw new AssertionNotApplicableException();
+ }
+ isMultiPart = true;
+ }
+ // else if not soapbind:body root element
+ else if(!(extElems.get(0) instanceof SOAPBody))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // get HTTP content type
+ String contentType = HTTPUtils.getHttpHeaderAttribute(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ HTTPConstants.HEADER_CONTENT_TYPE);
+
+ //allow "text/xml" or
+ //("multipart/related" and "mime:multipartRelated" WSDL bindings)
+ if((contentType == null) ||
+ (!contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART) &&
+ !contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_TEXT_XML)) ||
+ ((contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART) &&
+ !isMultiPart)))
+ {
+ throw new AssertionFailException("The content-type header field " +
+ "value \"" + contentType + "\" is incorrect");
+ }
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1925.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1925.java
new file mode 100644
index 000000000..d4a0b3cfa
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1925.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * AP1925
+ *
+ * <context>For a candidate message</context>
+ * <assertionDescription>If the WSDL description lists at least one non-root
+ * MIME part, then the corresponding message has a Content-Type HTTP header
+ * field-value with a media-type of "multipart/related.</assertionDescription>
+ */
+public class AP1925 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1925(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ entryContext.getMessageEntryDocument());
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST)
+ && bindingOperation.getBindingInput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingInput().getExtensibilityElements();
+ }
+ else if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_RESPONSE)
+ && bindingOperation.getBindingOutput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingOutput().getExtensibilityElements();
+ }
+ // check list on first element
+ if((extElems == null) || (extElems.size() == 0) ||
+ !(extElems.get(0) instanceof MIMEMultipartRelated))
+ throw new AssertionNotApplicableException();
+
+ // get list mime parts from definition
+ MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0);
+ List parts = mime.getMIMEParts();
+ // if parts count is more than one, than assertion is notApplicable
+ if(parts.size() <= 1)
+ throw new AssertionNotApplicableException();
+ String contentType = HTTPUtils.getHttpHeaderAttribute(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ HTTPConstants.HEADER_CONTENT_TYPE);
+ if((contentType == null) ||
+ !contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART))
+ {
+ throw new AssertionFailException("Incorrect Content-Type value \"" +
+ contentType + "\" in HTTP header");
+ }
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Returns the part value from MIMEContent element
+ * @param part MIMEPart element
+ * @return the part value from MIMEContent element
+ */
+ private String getMIMEContentPart(MIMEPart part) {
+ List list = part.getExtensibilityElements();
+ if(list.size() == 0)
+ return null;
+ return ((MIMEContent) list.get(0)).getPart();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1926.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1926.java
new file mode 100644
index 000000000..db0b7fe3c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1926.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.MIMEConstants;
+import org.eclipse.wst.wsi.internal.util.MIMEUtils;
+
+/**
+ * AP1926
+ *
+ * <context>For a candidate message</context>
+ * <assertionDescription>A message includes all of the MIME parts described by
+ * its WSDL MIME binding.</assertionDescription>
+ */
+public class AP1926 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1926(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if(!entryContext.getMessageEntry().isMimeContent())
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // get message mime parts
+ MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
+
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ entryContext.getMessageEntryDocument());
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST)
+ && bindingOperation.getBindingInput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingInput().getExtensibilityElements();
+ }
+ else if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_RESPONSE)
+ && bindingOperation.getBindingOutput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingOutput().getExtensibilityElements();
+ }
+ // check list for the first element
+ if((extElems == null) || (extElems.size() == 0) ||
+ !(extElems.get(0) instanceof MIMEMultipartRelated))
+ throw new AssertionNotApplicableException();
+
+ // get list mime parts from definition
+ MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0);
+ List parts = mime.getMIMEParts();
+
+ if(mimeParts.getRootPart() == null || mimeParts.count()==0)
+ throw new AssertionNotApplicableException();
+ // skip root part
+ for (int i = 1; i < parts.size(); i++)
+ {
+ String partName = getMIMEContentPart((MIMEPart) parts.get(i));
+ // find the corresponding MIME part
+ if (findMIMEPart(mimeParts.getParts(), partName) == null)
+ {
+ throw new AssertionFailException("The corresponding binding " +
+ "operation \"" + bindingOperation.getName() +
+ "\" does not contain part \"" + partName + "\"");
+ }
+ }
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * find corresponding MIME part
+ * @param parts array of soap MIME parts
+ * @param partName part name to find
+ * @return corresponding MIME part "Content-ID" value,
+ * if the part doesnt found, retuns null
+ * @throws WSIException
+ */
+ private String findMIMEPart(Collection parts, String partName)
+ throws WSIException
+ {
+ if(partName == null)
+ return null;
+ Iterator iparts = parts.iterator();
+ while (iparts.hasNext())
+ {
+ MimePart part = (MimePart)iparts.next();
+ String m_partName = MIMEUtils.getMimeHeaderAttribute(
+ part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);
+
+ // check value format <partname=UID@host>
+ if ((m_partName != null) && (m_partName.startsWith("<")) &&
+ (m_partName.indexOf("=") != -1) &&
+ (encodePartName(m_partName.substring(1, m_partName.indexOf("="))).equals(partName)))
+ {
+ return m_partName;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the part value from MIMEContent element
+ * @param part MIMEPart element
+ * @return the part value from MIMEContent element
+ */
+ private String getMIMEContentPart(MIMEPart part) {
+ List list = part.getExtensibilityElements();
+ if(list.size() == 0)
+ return null;
+ return ((MIMEContent) list.get(0)).getPart();
+ }
+
+ /**
+ * Encode string from %HH to UTF
+ * @param str string
+ * @return encoded string from %HH format
+ */
+ private String encodePartName(String str) {
+ StringBuffer res = new StringBuffer("");
+ for (int i = 0; i < str.length(); i++)
+ {
+ if((str.charAt(i) == '%') && (str.length() > i+2))
+ {
+ try
+ {
+ int value = Integer.parseInt(
+ String.valueOf(str.charAt(i+1)) +
+ String.valueOf(str.charAt(i+2)), 16);
+ res.append((char) value);
+ i +=2;
+ }
+ catch(NumberFormatException e){}
+ }
+ else
+ {
+ res.append(str.charAt(i));
+ }
+ }
+ return res.toString();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1931.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1931.java
new file mode 100644
index 000000000..6178e435b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1931.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * AP1931
+ *
+ * <context>For a candidate root-part of a multipart/related message</context>
+ * <assertionDescription>The entity body of the root-part of multipart/related
+ * message is a soap:Envelope.</assertionDescription>
+ */
+public class AP1931 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1931(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // check for the root part
+ if(entryContext.getMessageEntry().isMimeContent() &&
+ (entryContext.getMessageEntry().getMimeParts().getRootPart() != null))
+ {
+ try
+ {
+ // parse root part message
+ Document doc = XMLUtils.parseXML(
+ entryContext.getMessageEntry().getMimeParts().getRootPart().getContent());
+
+ // get entity body
+ Element el = doc.getDocumentElement();
+
+ // if the element is not soap:Envelope, then fail
+ if(!el.getLocalName().equals(WSITag.ELEM_SOAP_ENVELOPE.getLocalPart()) ||
+ !el.getNamespaceURI().equals(WSITag.ELEM_SOAP_ENVELOPE.getNamespaceURI()))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "the entity body of the root part is {" +
+ el.getNamespaceURI() + "}" + el.getLocalName(), entryContext);
+ }
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "the entity body of the root part does not contain " +
+ "\"soap:Envelope\" element", entryContext);
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1932.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1932.java
new file mode 100644
index 000000000..bfba67561
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1932.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * AP1932
+ *
+ * <context>For a candidate message containing a Content-Type HTTP header
+ * field-value with a media type of "multipart/related"</context>
+ * <assertionDescription>In a message, the Content-Type HTTP header field-value
+ * has a type parameter with a value of "text/xml" when it has a media type of
+ * "multipart/related".</assertionDescription>
+ */
+public class AP1932 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1932(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // check for multipart/related content type
+ String content_type = HTTPUtils.getHttpHeaderAttribute(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ HTTPConstants.HEADER_CONTENT_TYPE);
+
+ if((content_type == null) ||
+ (!content_type.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART)))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ String subType = HTTPUtils.getHttpHeaderSubAttribute(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ HTTPConstants.HEADER_CONTENT_TYPE, "type");
+ if((subType == null)
+ || !subType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_TEXT_XML))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "The \"type\" parameter value is \"" + subType + "\"", entryContext);
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1933.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1933.java
new file mode 100644
index 000000000..4ee6df11a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1933.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.MIMEConstants;
+import org.eclipse.wst.wsi.internal.util.MIMEUtils;
+
+/**
+ * AP1933
+ *
+ * <context>For a candidate message</context>
+ * <assertionDescription>If a description binds a wsdl:message part to a
+ * mime:content element, then the corresponding MIME part in a message has a
+ * content-id header with a globally unique value of the form
+ * &lt;partname=ID@hostname&gt;, where 'partname' is the value of the name attribute of
+ * the wsdl:part element referenced by the mime:content.</assertionDescription>
+ */
+public class AP1933 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1933(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ try
+ {
+ if(!entryContext.getMessageEntry().isMimeContent())
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // get message mime parts
+ MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
+
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ entryContext.getMessageEntryDocument());
+
+ // If there is no matched operation, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+
+ // Finding operation extensibility elems
+ // in the binding depending on message type
+ List extElems = null;
+ if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_REQUEST)
+ && bindingOperation.getBindingInput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingInput().getExtensibilityElements();
+ }
+ else if (entryContext.getMessageEntry().getType().equals(
+ MessageEntry.TYPE_RESPONSE)
+ && bindingOperation.getBindingOutput() != null)
+ {
+ extElems = bindingOperation
+ .getBindingOutput().getExtensibilityElements();
+ }
+ // check list for the first element
+ if((extElems == null) || (extElems.size() == 0) ||
+ !(extElems.get(0) instanceof MIMEMultipartRelated))
+ throw new AssertionNotApplicableException();
+
+ // get list mime parts from definition
+ MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0);
+ List parts = mime.getMIMEParts();
+
+ // skip root part
+ for (int i = 1; i < parts.size(); i++)
+ {
+ String partName = getMIMEContentPart((MIMEPart) parts.get(i));
+ // find the corresponding MIME part
+ if (findMIMEPart(mimeParts.getParts(), partName) == null)
+ {
+ throw new AssertionFailException("The corresponding binding " +
+ "operation \"" + bindingOperation.getName() +
+ "\" does not contain part \"" + partName + "\"");
+ }
+ }
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * find corresponding MIME part
+ * @param parts array of soap MIME parts
+ * @param partName part name to find
+ * @return corresponding MIME part "Content-ID" value,
+ * if the part doesnt found, retuns null
+ * @throws WSIException
+ */
+ private String findMIMEPart(Collection parts, String partName)
+ throws WSIException, AssertionFailException
+ {
+ if(partName == null)
+ return null;
+
+ Iterator iparts = parts.iterator();
+ int i = 0;
+ while (iparts.hasNext())
+ {
+ i = i + 1;
+ MimePart part = (MimePart)iparts.next();
+ String m_partName = MIMEUtils.getMimeHeaderAttribute(
+ part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);
+
+ // check value format <partname=UID@hostname>
+ if ((m_partName != null) && m_partName.startsWith("<") && m_partName.endsWith(">"))
+ {
+ int idx, atIdx;
+ String enPartName = null;
+ String uid = null;
+ String host = null;
+
+ // get part name from content-id
+ if ((idx = m_partName.indexOf("=")) != -1)
+ {
+ enPartName = encodePartName(m_partName.substring(1, idx));
+ }
+ // get uid and hostname from content-id
+ if (((atIdx = m_partName.indexOf("@")) != -1) && (atIdx > idx))
+ {
+ uid = m_partName.substring(idx+1, atIdx);
+ host = m_partName.substring(atIdx+1, m_partName.length()-1);
+ }
+ // if part names match, validate format
+ if((enPartName != null) && enPartName.equals(partName))
+ {
+ if((uid == null) || (uid.length() == 0))
+ throw new AssertionFailException(
+ "The \"Content-ID\" attribute of the part \""+(i+1)+
+ "\"contains value \""+ m_partName+
+ "\" which has a incorrect UID format");
+ if(host == null)
+ throw new AssertionFailException(
+ "The \"Content-ID\" attribute of the part \""+(i+1)+
+ "\"contains value \""+ m_partName+
+ "\" which has a incorrect host format");
+ // check for malformed URL
+ try
+ {
+ new URL("HTTP", host, "");
+ }
+ catch (MalformedURLException e)
+ {
+ throw new AssertionFailException(
+ "The \"Content-ID\" attribute of the part \""+(i+1)+
+ "\"contains value \""+ m_partName+
+ "\" which has a incorrect host format");
+ }
+ return m_partName;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the part value from MIMEContent element
+ * @param part MIMEPart element
+ * @return the part value from MIMEContent element
+ */
+ private String getMIMEContentPart(MIMEPart part)
+ {
+ List list = part.getExtensibilityElements();
+ if(list.size() == 0)
+ return null;
+ return ((MIMEContent) list.get(0)).getPart();
+ }
+
+ /**
+ * Encode string from %HH to UTF
+ * @param str string
+ * @return encoded string from %HH format
+ */
+ private String encodePartName(String str) {
+ StringBuffer res = new StringBuffer("");
+ for (int i = 0; i < str.length(); i++)
+ {
+ if((str.charAt(i) == '%') && (str.length() > i+2))
+ {
+ try
+ {
+ int value = Integer.parseInt(
+ String.valueOf(str.charAt(i+1)) +
+ String.valueOf(str.charAt(i+2)), 16);
+ res.append((char) value);
+ i +=2;
+ }
+ catch(NumberFormatException e){}
+ }
+ else
+ {
+ res.append(str.charAt(i));
+ }
+ }
+ return res.toString();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1934.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1934.java
new file mode 100644
index 000000000..7a7a633b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1934.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Iterator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.MIMEConstants;
+import org.eclipse.wst.wsi.internal.util.MIMEUtils;
+
+/**
+ * AP1934
+ *
+ * <context>For a candidate part of a multipart/related message</context>
+ * <assertionDescription>The Content-Transfer-Encoding field of a part in a
+ * multipart/related message has a value of "7bit", "8bit", "binary",
+ * "quoted-printable" or "base64".</assertionDescription>
+ */
+public class AP1934 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1934(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // check for multipart/related content type
+ if(!entryContext.getMessageEntry().isMimeContent())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // get MIME parts
+ MimeParts parts = entryContext.getMessageEntry().getMimeParts();
+ if(parts.count() == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ Iterator iparts = parts.getParts().iterator();
+ // check each part for the Content-Transfer-Encoding field
+ int i = 0;
+ while (iparts.hasNext())
+ {
+ MimePart part = (MimePart)iparts.next();
+ String type_value = MIMEUtils.getMimeHeaderAttribute(
+ part.getHeaders(),
+ MIMEConstants.HEADER_CONTENT_TRANSFER_ENCODING);
+ if (type_value != null)
+ {
+ if((type_value == null) || !(type_value.equalsIgnoreCase("7bit") ||
+ type_value.equalsIgnoreCase("8bit") ||
+ type_value.equalsIgnoreCase("base64") ||
+ type_value.equalsIgnoreCase("quoted-printable") ||
+ type_value.equalsIgnoreCase("binary")))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "(" + (i+1) +
+ "), part header field \"Content-Transfer-Encoding\" has incorrect value \""+
+ type_value+"\"", entryContext);
+ }
+ }
+ i++;
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1935.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1935.java
new file mode 100644
index 000000000..e537ea427
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1935.java
@@ -0,0 +1,348 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.Utils;
+
+/**
+ * AP1935
+ *
+ * <context>For a candidate part of a multipart/related message</context>
+ * <assertionDescription>The encoding of the body of a part in a
+ * multipart/related message conforms to the encoding indicated by the
+ * Content-Transfer-Encoding field-value,
+ * as specified by RFC2045.</assertionDescription>
+ */
+public class AP1935 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1935(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ if(!entryContext.getMessageEntry().isMimeContent())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // get MIME parts
+ MimeParts parts = entryContext.getMessageEntry().getMimeParts();
+ if(parts.count() == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check each part for the encoding match
+ Iterator iparts = parts.getParts().iterator();
+ int i = 0;
+ MimePart root = parts.getRootPart();
+ while (iparts.hasNext())
+ {
+ i = i = 1;
+ try
+ {
+ MimePart part = (MimePart)iparts.next();
+
+ // get encoding from header
+ String encoding = HTTPUtils.getHttpHeaderAttribute(part.getHeaders(),
+ HTTPConstants.HEADER_CONTENT_TRANSFER_ENCODING);
+
+ if ((part == root) ||
+ ((encoding != null) && encoding.equalsIgnoreCase("base64")))
+ checkPart(part, encoding, false);
+ else
+ checkPart(part, encoding, true);
+ } catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ "part "+(i+1)+" Error: " + e.getMessage(), entryContext);
+ }
+ }
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+ /**
+ * Check message entry to encoding conformity
+ * @param entry message entry
+ * @throws AssertionFailException if message does not encoding conformity
+ * @throws WSIException
+ */
+ private void checkPart(MimePart part, String encoding, boolean encoded)
+ throws AssertionFailException, WSIException
+ {
+ String content = null;
+ if (encoded)
+ content = new String(Utils.decodeBase64(part.getContent()));
+ else
+ content = part.getContent();
+
+ if(encoding == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ // check 7bit
+ } else if(encoding.equalsIgnoreCase("7bit")) {
+ checkOn7bit(content);
+ // check 8bit
+ } else if(encoding.equalsIgnoreCase("8bit")) {
+ checkOn8bit(content);
+ // check quoted-printable
+ } else if(encoding.equalsIgnoreCase("quoted-printable")) {
+ checkOnQuotedPrintable(content);
+ // check base64
+ } else if(encoding.equalsIgnoreCase("base64")) {
+ checkOnBase64(content);
+ }
+ // we dont check binary encoding, since message can contains any chars
+ }
+
+ /**
+ * Validate a 7bit encoded message (RFC2045)
+ * @param message message to check
+ * @throws AssertionFailException if message does not conform
+ */
+ private void checkOn7bit(String message)
+ throws AssertionFailException
+ {
+ String[] strs = split(message);
+ for (int i = 0; i < strs.length; i++)
+ {
+ String str = strs[i];
+
+ // check string length
+ if(str.length() > 998)
+ {
+ throw new AssertionFailException("The length (" + str.length() +
+ ") of the line (" + (i+1) + ") greater than 998");
+ }
+ // No octets with decimal values greater than 127
+ // are allowed and neither are NULs (octets with decimal value 0). CR
+ //(decimal value 13) and LF (decimal value 10) octets only occur as
+ // part of CRLF line separation sequences.
+ char[] chars = str.toCharArray();
+ for (int j = 0; j < chars.length; j++)
+ {
+ if((chars[j] > 127) || (chars[j] == 0) ||
+ (chars[j] == 10) || (chars[j] == 13))
+ {
+ throw new AssertionFailException("The char (" + chars[j] +
+ ")[code=" + (byte) chars[j] + " position=" + j +
+ "] does not allows in 7bit encoding content");
+ }
+ }
+ }
+ }
+
+ /**
+ * Validate an 8bit encoded message (RFC2045)
+ * @param message message to check
+ * @throws AssertionFailException if message does not conform
+ */
+ private void checkOn8bit(String message)
+ throws AssertionFailException
+ {
+ String[] strs = split(message);
+ for (int i = 0; i < strs.length; i++)
+ {
+ String str = strs[i];
+
+ // check string length
+ if(str.length() > 998)
+ {
+ throw new AssertionFailException("The length (" + str.length() +
+ ") of the line (" + (i+1) + ") greater than 998");
+ }
+ // octets with decimal values greater than 127
+ // may be used. As with "7bit data" CR and LF octets only occur as part
+ // of CRLF line separation sequences and no NULs are allowed.
+ char[] chars = str.toCharArray();
+ for (int j = 0; j < chars.length; j++)
+ {
+ if((chars[j] == 0) || (chars[j] == 10) || (chars[j] == 13))
+ {
+ throw new AssertionFailException("The char (" + chars[j] +
+ ")[code=" + (byte) chars[j] + " position=" + j +
+ "] does not allows in 8bit encoding content");
+ }
+ }
+ }
+ }
+
+ /**
+ * Validate a quoted-printable encoded message (RFC2045)
+ * @param message message to check
+ * @throws AssertionFailException if message does not conform
+ */
+ private void checkOnQuotedPrintable(String message)
+ throws AssertionFailException
+ {
+ String[] strs = split(message);
+ for (int i = 0; i < strs.length; i++)
+ {
+ // check length
+ // RFC2045
+ // (5) (Soft Line Breaks) The Quoted-Printable encoding
+ //REQUIRES that encoded lines be no more than 76
+ //characters long. If longer lines are to be encoded
+ //with the Quoted-Printable encoding, "soft" line breaks
+ //must be used. An equal sign as the last character on a
+ //encoded line indicates such a non-significant ("soft")
+ //line break in the encoded text.
+ if(((strs[i].indexOf("\t") != -1) || (strs[i].indexOf(" ") != -1)) &&
+ (strs[i].length() > 76))
+ {
+ throw new AssertionFailException("The length (" + strs[i].length() +
+ ") of the line (" + (i+1) +
+ ") greater than 76, \"soft\" line breaks must be used");
+ }
+
+ char[] chars = strs[i].toCharArray();
+ for (int j = 0; j < chars.length; j++)
+ {
+ //(1) (General 8bit representation) Any octet, except a CR or
+ //LF that is part of a CRLF line break of the canonical
+ //(standard) form of the data being encoded, may be
+ //represented by an "=" followed by a two digit
+ //hexadecimal representation of the octet's value. The
+ //digits of the hexadecimal alphabet, for this purpose,
+ //are "0123456789ABCDEF". Uppercase letters must be
+ //used; lowercase letters are not allowed. Thus, for
+ //example, the decimal value 12 (US-ASCII form feed) can
+ //be represented by "=0C", and the decimal value 61 (US-
+ //ASCII EQUAL SIGN) can be represented by "=3D". This
+ //rule must be followed except when the following rules
+ //allow an alternative encoding.
+ // (2) (Literal representation) Octets with decimal values of
+ //33 through 60 inclusive, and 62 through 126, inclusive,
+ //MAY be represented as the US-ASCII characters which
+ //correspond to those octets (EXCLAMATION POINT through
+ //LESS THAN, and GREATER THAN through TILDE,
+ //respectively).
+ if((chars[j] == 61) && (chars.length > j+2))
+ {
+ if(!isHex(chars[j+1]) || !isHex(chars[j+2]))
+ {
+ throw new AssertionFailException("the quoted char (" +
+ chars[j] + chars[j+1] + chars[j+2] + ") is incorrect");
+ } else {
+ j += 2;
+ }
+ }
+ // check for space and tab
+ else if((chars[j] != 9) && (chars[j] != 32))
+ {
+ // check invalid symbol
+ if((chars[j] == 0) || (chars[j] == 10) || (chars[j] == 13) ||
+ (chars[j] < 33) || (chars[j] > 126) || (chars[j] == 61))
+ {
+ throw new AssertionFailException("The char (" + chars[j] +
+ ")[code=" + (byte) chars[j] + " position=" + j +
+ "] must be quoted");
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Validate a base64 encoded message (RFC3548)
+ * @param message message to check
+ * @throws AssertionFailException if message does not conform
+ */
+ private void checkOnBase64(String message)
+ throws AssertionFailException
+ {
+ String[] strs = split(message);
+ for (int i = 0; i < strs.length; i++)
+ {
+ String str = strs[i];
+
+ // check string length
+ if(str.length() > 76)
+ {
+ throw new AssertionFailException("The length (" + str.length() +
+ ") of the line (" + (i+1) + ") greater than 998");
+ }
+ // check for "ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz0123456789/+"
+ char[] chars = str.toCharArray();
+ for (int j = 0; j < chars.length; j++)
+ {
+ char c = chars[i];
+ if((c < 47) || (c > 122) || ((c > 57) && (c < 65)) ||
+ ((c > 90) && (c < 97)))
+ {
+ throw new AssertionFailException("The char (" + chars[j] +
+ ")[code=" + (byte) chars[j] + " position=" + j +
+ "] does not allows in base64 encoding content");
+ }
+ }
+ }
+ }
+
+ /**
+ * split string to array of strings and use as delimeter CRLF
+ * @param str original string
+ * @return array of strings
+ */
+ private String[] split(String str)
+ {
+ ArrayList list = new ArrayList();
+ for(int idx = str.indexOf("\r\n"); idx != -1; idx = str.indexOf("\r\n"))
+ {
+ list.add(str.substring(0, idx));
+ str = str.substring(idx+2);
+ }
+ list.add(str);
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+
+ /**
+ * Returns true if byte is "0123456789ABCDEF" range, false othewise
+ * @param c char
+ * @return true if byte is "0123456789ABCDEF" range, false othewise
+ */
+ private boolean isHex(char c) {
+ return (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 70)));
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1936.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1936.java
new file mode 100644
index 000000000..9d35ce778
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1936.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP1936
+ * <context>For a candidate multipart/related message</context>
+ * <assertionDescription>In a message, all MIME encapsulation boundary strings
+ * are preceded with the ascii characters CR (13) and LF (10)
+ * in that sequence.</assertionDescription>
+ */
+public class AP1936 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public AP1936(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // if boundary equals null, then result is not applicable
+ if (!entryContext.getMessageEntry().isMimeContent())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // otherwise it is true -- checked in monitor
+ // MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
+ // Iterator i = mimeParts.getParts().iterator();
+ // boolean invalidBoundaryStringFound = false;
+ //while (i.hasNext() && !invalidBoundaryStringFound)
+ //{
+ // MimePart part = (MimePart)i.next();
+ // String[] boundaries = part.getBoundaryStrings();
+ // for (int j = 0; j<boundaries.length; j++)
+ // {
+ // if (!boundaries[j].startsWith("&#xd;\n"))
+ // {
+ // invalidBoundaryStringFound = true;
+ // result = AssertionResult.RESULT_FAILED;
+ // failureDetail = validator.createFailureDetail(boundaries[j], entryContext);
+ // break;
+ // }
+ // }
+ //}
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1942.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1942.java
new file mode 100644
index 000000000..8f53c47fc
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1942.java
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.log.MimePart;
+import org.eclipse.wst.wsi.internal.log.MimeParts;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.MIMEConstants;
+import org.eclipse.wst.wsi.internal.util.MIMEUtils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+
+/**
+ * AP1942
+ *
+ * <context>For a candidate part of a multipart/related message that is bound
+ * to a mime:content that refers to global element declaration (via the element
+ * attribute of the wsdl:part element)</context>
+ * <assertionDescription>The bound message part is serialized within the MIME
+ * part as a serialization of an XML infoset whose root element is described by
+ * the referenced element.</assertionDescription>
+ */
+public class AP1942 extends AssertionProcess implements WSITag
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1942(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ if (!entryContext.getMessageEntry().isMimeContent())
+ {
+ throw new AssertionNotApplicableException();
+ }
+ else
+ {
+ MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
+
+ // If the message does not contain non-root MIME parts
+ // the assertion is not applicable
+ if (mimeParts.count()< 2)
+ throw new AssertionNotApplicableException();
+
+ // Getting an operation matched for a message
+ BindingOperation bindingOperation = validator.getOperationMatch(
+ entryContext.getEntry().getEntryType(),
+ entryContext.getMessageEntryDocument());
+ // If no one operation matches, the assertion is not applicable
+ if (bindingOperation == null)
+ throw new AssertionNotApplicableException();
+ // Getting the corresponding extensibility elements and message
+ List extElems;
+ Message message;
+ if (MessageEntry.TYPE_REQUEST
+ .equals(entryContext.getEntry().getEntryType()))
+ {
+ extElems = bindingOperation.getBindingInput() == null ? null
+ : bindingOperation.getBindingInput().getExtensibilityElements();
+ message = bindingOperation.getOperation().getInput() == null ? null
+ : bindingOperation.getOperation().getInput().getMessage();
+ }
+ else
+ {
+ extElems = bindingOperation.getBindingOutput() == null ? null
+ : bindingOperation.getBindingOutput().getExtensibilityElements();
+ message = bindingOperation.getOperation().getOutput() == null ? null
+ : bindingOperation.getOperation().getOutput().getMessage();
+ }
+ // A variable that indicates a binding contains at least one
+ // mime:content element that refers to global element declaration
+ boolean mimeContentFound = false;
+ // Going through the message MIME parts
+ Iterator iMimeParts = mimeParts.getParts().iterator();
+ int i = 0;
+ while (iMimeParts.hasNext())
+ {
+ i = i + 1;
+ // Getting a MIME part
+ MimePart mimePart = (MimePart)iMimeParts.next();
+ // Getting a part name form the Content-ID header
+ String partName = MIMEUtils.getMimeHeaderAttribute(
+ mimePart.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);
+ try
+ {
+ int idx = partName.indexOf("=");
+ if((idx != -1) && partName.startsWith("<"))
+ partName = encodePartName(partName.substring(1, idx));
+ }
+ catch (Exception e)
+ {
+ // Could not extract a part name from the header,
+ // proceed with the next MIME part
+ continue;
+ }
+
+ // If the part is bound by a mime:content element
+ if (boundToMimeContent(extElems, partName) && message != null)
+ {
+ // Getting the corresponding part
+ Part part = (Part) message.getParts().get(partName);
+ QName refName;
+ // If the part refers to global element declaration
+ if (part != null && (refName = part.getElementName()) != null)
+ {
+ mimeContentFound = true;
+ // Trying to parse part content
+ Document doc = null;
+ try
+ {
+ doc = XMLUtils.parseXML(mimePart.getContent());
+ }
+ catch (Exception e) {}
+ // If the message is not an XML infoset, the assertion failed
+ if (doc == null)
+ {
+ throw new AssertionFailException("The bound message part of the "
+ + "MIME part number " + (i + 1) + " is invalid XML infoset.");
+ }
+ // Creating a QName object of the root element
+ QName rootName = new QName(
+ doc.getDocumentElement().getNamespaceURI(),
+ doc.getDocumentElement().getLocalName());
+ // If the names of the root element and the referenced element
+ // are not equal, the assertion failed
+ if (!refName.equals(rootName))
+ {
+ throw new AssertionFailException("The root element name is "
+ + rootName + ", the name of the referenced element is "
+ + refName + ".");
+ }
+ }
+ }
+ }
+ // If no mime:contentS found, the assertion is not applicable
+ if (!mimeContentFound)
+ throw new AssertionNotApplicableException();
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+
+ /**
+ * Validates whether a part is bound by a mime:content element.
+ * @param extElems a list of extensibility elements.
+ * @param part a part name.
+ * @return true if a part is bound by mime:content, false otherwise.
+ */
+ private boolean boundToMimeContent(List extElems, String part)
+ {
+ if (extElems != null && extElems.size() > 0)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(0);
+ // Expected the first ext elem is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ for (int i = 0; i < mimeParts.size(); i++)
+ {
+ // Getting the mime:part element needed
+ List elems = ((MIMEPart) mimeParts.get(i)).getExtensibilityElements();
+ if (elems.size() > 0)
+ {
+ // Getting the first element
+ ExtensibilityElement elem = (ExtensibilityElement) elems.get(0);
+ // If the element is mime:content and it binds a part
+ if (elem.getElementType().equals(WSDL_MIME_CONTENT)
+ && part.equals(((MIMEContent)elem).getPart()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Encode string from %HH to UTF
+ * @param str string
+ * @return encoded string from %HH format
+ */
+ private String encodePartName(String str) {
+ StringBuffer res = new StringBuffer("");
+ for (int i = 0; i < str.length(); i++)
+ {
+ if((str.charAt(i) == '%') && (str.length() > i+2))
+ {
+ try
+ {
+ int value = Integer.parseInt(
+ String.valueOf(str.charAt(i+1)) +
+ String.valueOf(str.charAt(i+2)), 16);
+ res.append((char) value);
+ i +=2;
+ }
+ catch(NumberFormatException e){}
+ }
+ else
+ {
+ res.append(str.charAt(i));
+ }
+ }
+ return res.toString();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1945.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1945.java
new file mode 100644
index 000000000..f9801e7b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1945.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * AP1945
+ * <context>For a candidate message</context>
+ * <assertionDescription>The Content-Type HTTP header field-value in a message
+ * is either "multipart/related" or "text/xml".</assertionDescription>
+ */
+public class AP1945 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public AP1945(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ String headerName = HTTPConstants.HEADER_CONTENT_TYPE;
+
+ // Getting a header
+ String headerValue = HTTPUtils.getHttpHeaderAttribute(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ headerName);
+ // If headerValue is null, the assertion is not applicable
+ if (headerValue == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // If the header is "multipart/related" or "text/xml",
+ // then the assertion passed
+ else if (headerValue.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART)
+ || headerValue.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_TEXT_XML))
+ {
+ }
+ // else the assertion failed
+ else {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ headerValue, entryContext);
+ }
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1946.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1946.java
new file mode 100644
index 000000000..74eb84517
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP1946.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP1946
+ *
+ * <context>For a candidate multipart/related message
+ * containing non-root parts</context>
+ * <assertionDescription>The candidate multipart/related message
+ * containing non-root parts.</assertionDescription>
+ */
+public class AP1946 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP1946(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // If there are more than one MIME parts, the assertion passed
+ if (entryContext.getMessageEntry().getMimeParts().count() > 1)
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ // The assertion is not applicable
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5100.java
new file mode 100644
index 000000000..3b25446fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5100.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP5100
+ *
+ * <context>For a candidate non-multipart/related message in the log file, with an HTTP entity-body.</context>
+ * <assertionDescription>The SOAP envelope is the exclusive payload of the HTTP entity-body.</assertionDescription>
+ *
+ * @author lauzond
+ */
+public class AP5100 extends SSBP5100
+{
+ /**
+ * Constructor.
+ * @param impl
+ */
+ public AP5100(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // If there is a SOAP Message with Attachments, the assertion is not applicable
+ if (entryContext.getMessageEntry().isMimeContent())
+ {
+ return validator.createAssertionResult(testAssertion, AssertionResult.RESULT_NOT_APPLICABLE, failureDetail);
+ }
+ else
+ {
+ return super.validate(testAssertion, entryContext);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5101.java
new file mode 100644
index 000000000..e173bc744
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/AP5101.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+ package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP5101
+ * <context>For a non-multipart/related candidate message in the log file.</context>
+ * <assertionDescription>A message must have a "Content-Type" HTTP header field. The "Content-Type" HTTP header field must have a field-value whose media type is "text/xml".</assertionDescription>
+ *
+ * @author lauzond
+ */
+public class AP5101 extends SSBP5101 {
+
+ /**
+ * @param impl
+ */
+ public AP5101(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // If there is a SOAP Message with Attachments, the assertion is not applicable
+ if (entryContext.getMessageEntry().isMimeContent())
+ {
+ return validator.createAssertionResult(testAssertion, AssertionResult.RESULT_NOT_APPLICABLE, failureDetail);
+ }
+ else
+ {
+ return super.validate(testAssertion, entryContext);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1001.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1001.java
new file mode 100644
index 000000000..c991007cc
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1001.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+ package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.MessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP1001.
+ * If it is a request, the arg #2 of POST is &lt;HTTP/1.1&gt;. If absent, first line of the
+ * body is: HTTP-Version = HTTP/1.1. If it is a response, it starts with &lt;HTTP/1.1&gt;.
+ */
+public class BP1001 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1001(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
+
+ // If this is a request message, then check POST header
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equalsIgnoreCase(MessageEntry.TYPE_REQUEST))
+ {
+ Vector requestLine;
+ if (((requestLine = this.validator.getPostRequest(httpHeader)) == null)
+ || (requestLine.size() == 0))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ String method = (String) requestLine.get(0);
+ //String requestURI = (String) requestLine.get(1);
+ String httpVersion = (String) requestLine.get(2);
+
+ //For each request message that is an HTTP POST
+ if (method.equals(MessageValidator.HTTP_POST) && httpVersion != null)
+ {
+ if (httpVersion.equals(MessageValidator.HTTP_VERSION_1_1))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = this.validator.createFailureDetail(httpHeader, entryContext);
+ }
+ }
+ }
+ }
+
+ // Otherwise it must be a response
+ else
+ {
+ if (httpHeader.startsWith(MessageValidator.HTTP_VERSION_1_1))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = this.validator.createFailureDetail(httpHeader, entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1002.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1002.java
new file mode 100644
index 000000000..2fa760f18
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1002.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.MessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP1002.
+ * If it is a request, the arg #2 of POST is &lt;HTTP/1.1&gt; or &lt;HTTP/1.0&gt;. If absent, first line
+ * of the body is: HTTP-Version = HTTP/1.1. (or HTTP/1.0). If it is a response, it starts with
+ * &lt;HTTP/1.1&gt; or &lt;HTTP/1.0&gt; or higher;
+ */
+public class BP1002 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1002(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
+
+ // If this is a request message, then check POST for 1.1 or 1.0
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equalsIgnoreCase(MessageEntry.TYPE_REQUEST))
+ {
+ // Get each entry in the post header
+ StringTokenizer postMessage = new StringTokenizer(httpHeader, " \r\n");
+
+ // If there is no third token, then fail
+ if (postMessage.countTokens() < 3)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(httpHeader, entryContext);
+ }
+ else
+ {
+ // Get the 3rd token (there must be a better way to do this?)
+ String httpVersion = "";
+ String messageType = "";
+ for (int i = 0; i < 3; i++)
+ {
+ // Message type
+ if (i == 0)
+ messageType = postMessage.nextToken();
+ else if (i == 2)
+ httpVersion = postMessage.nextToken();
+ else
+ postMessage.nextToken();
+ }
+
+ if (!messageType.equals("POST"))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // If the third token is not HTTP/1.1 ot HTTP/1.0, then fail
+ else if (
+ (!httpVersion.equalsIgnoreCase(MessageValidator.HTTP_VERSION_1_1))
+ && (!httpVersion.equalsIgnoreCase(MessageValidator.HTTP_VERSION_1_0)))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(httpHeader, entryContext);
+ }
+ }
+ }
+
+ // Else it is a response message
+ else
+ {
+ // Response-Line (1st) = HTTP-Version SP Response-code SP Response-text CRLF
+ StringTokenizer httpMessageTokenizer =
+ new StringTokenizer(httpHeader, "\n\r\f");
+
+ String startLine = null;
+ try
+ {
+ if (httpMessageTokenizer.hasMoreTokens())
+ {
+ startLine = httpMessageTokenizer.nextToken();
+ }
+ else
+ {
+ // HTTP version info expected but not found
+ // (state the fact in the exception message?)
+ throw new AssertionFailException(httpHeader);
+ }
+
+ // check that protocol version indicates HTTP/1.0 or HTTP/1.1
+ if (!startLine.startsWith(MessageValidator.HTTP_VERSION_1_1)
+ && !startLine.startsWith(MessageValidator.HTTP_VERSION_1_0))
+ {
+ throw new AssertionFailException(httpHeader);
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1004.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1004.java
new file mode 100644
index 000000000..6512e389f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1004.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.MessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP1004.
+ * The request message is a POST message, without any use of framework extension.
+ */
+public class BP1004 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1004(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
+ StringTokenizer httpMessageTokenizer =
+ new StringTokenizer(httpHeader, "\n\r\f");
+
+ // Check if this is a POST message
+ if (!httpHeader.startsWith(MessageValidator.HTTP_POST))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(httpHeader, entryContext);
+ }
+
+ String line = null;
+ while (httpMessageTokenizer.hasMoreTokens()
+ && (result.equals(AssertionResult.RESULT_PASSED)))
+ {
+ line = httpMessageTokenizer.nextToken();
+ if ((line != null)
+ && (line.startsWith("M-POST") || line.startsWith("Ext:")))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(httpHeader, entryContext);
+ }
+ } //End While
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1006.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1006.java
new file mode 100644
index 000000000..c97d42421
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1006.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Map;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+
+/**
+ * BP1006.
+ */
+public class BP1006 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1006(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Parse the HTTP header
+ String rawHTTPHeader = entryContext.getMessageEntry().getHTTPHeaders();
+ Map httpHeader = HTTPUtils.getHttpHeaderTokens(rawHTTPHeader, ":");
+
+ // Get the soap action header
+ String soapAction = (String) httpHeader.get("SOAPAction".toUpperCase());
+
+ // If there is no soap action header, then NA
+ if (soapAction == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else if (!(soapAction.startsWith("\"")) || !(soapAction.endsWith("\"")))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "HTTP Header: \"" + rawHTTPHeader + "\".",
+ entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1010.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1010.java
new file mode 100644
index 000000000..91511c1bd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1010.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Operation;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.w3c.dom.Document;
+
+
+/**
+ * BP1010.
+ * It MUST NOT contain a SOAP Envelope: the HTTP entity-body must be empty.
+ */
+public class BP1010 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1010(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ try
+ {
+ // Parse request message
+ Document docRequest = entryContext.getRequestDocument();
+
+ // get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+
+ if (match == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+
+ BindingOperation bindingOperation = match.getOperation();
+ //find operation in port type
+ Operation operation = bindingOperation.getOperation();
+ if (operation == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+ else
+ {
+ if (operation.getOutput() == null)
+ {
+ String message = entryContext.getMessageEntry().getMessage();
+ if (message.length() == 0)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ }
+
+ if (result == AssertionResult.RESULT_FAILED)
+ {
+ failureDetail = this.validator.createFailureDetail(null, entryContext);
+ }
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1101.java
new file mode 100644
index 000000000..429a9c436
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1101.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.Utils;
+
+
+/**
+ * BP1101.
+ * A response message that does not contain a SOAP message SHOULD be sent
+ * using either a "200 OK" or "202 Accepted" HTTP status code.
+ */
+public class BP1101 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1101(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // response does not contains SOAP message
+ if (entryContext.getMessageEntry().getMessage() == null
+ || "".equals(entryContext.getMessageEntry().getMessage()))
+ {
+ // check HTTP status code
+ String httpStatus =
+ Utils.getHTTPStatusCode(
+ entryContext.getMessageEntry().getHTTPHeaders());
+ if ("200".equals(httpStatus));
+ else if ("202".equals(httpStatus));
+
+ // If 4xx, then result is notApplicable
+ else if (httpStatus.startsWith("4"))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nResponse message:\nHeaders:\n"
+ + entryContext.getMessageEntry().getHTTPHeaders()
+ + "Message:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ }
+ else
+ {
+ // response contains SOAP message
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1103.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1103.java
new file mode 100644
index 000000000..d6d1b5f04
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1103.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.Utils;
+
+
+/**
+ * BP1103.
+ * The request message should not contain a POST method.
+ */
+public class BP1103 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1103(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ MessageEntry request = entryContext.getRequest();
+ String requestHeaders = request.getHTTPHeaders();
+
+ // Get HTTP status code
+ String httpStatus =
+ Utils.getHTTPStatusCode(
+ entryContext.getMessageEntry().getHTTPHeaders());
+
+ if (requestHeaders.startsWith("POST "))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else if (!"405".equals(httpStatus))
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nRequest message:\nHeaders:\n"
+ + entryContext.getRequest().getHTTPHeaders()
+ + "\nMessage:\n"
+ + entryContext.getRequest().getMessage()
+ + "\n\nResponse message:\nHeaders:\n"
+ + entryContext.getResponse().getHTTPHeaders()
+ + "\nMessage:\n"
+ + entryContext.getResponse().getMessage(),
+ entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1104.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1104.java
new file mode 100644
index 000000000..5af659fba
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1104.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.Utils;
+
+
+/**
+ * BP1104.
+ * The request message should not contain a content-type of "text/xml".
+ */
+public class BP1104 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1104(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // check request for the "text/xml" content type
+ MessageEntry request = entryContext.getRequest();
+ String headers = request.getHTTPHeaders();
+ String contentType = (String) HTTPUtils.getHttpHeaderTokens(headers, ":")
+ .get(HTTPConstants.HEADER_CONTENT_TYPE.toUpperCase());
+
+ // Get HTTP status code
+ String httpStatus =
+ Utils.getHTTPStatusCode(
+ entryContext.getMessageEntry().getHTTPHeaders());
+
+ // If the request message has a content type of text/xml,
+ // then the assertion is not applicable
+ if (contentType != null
+ && contentType.indexOf(WSIConstants.CONTENT_TYPE_TEXT_XML) != -1)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check HTTP status code
+ if (!"415".equals(httpStatus))
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nRequest message:\nHeaders:\n"
+ + entryContext.getRequest().getHTTPHeaders()
+ + "\nMessage:\n"
+ + entryContext.getRequest().getMessage()
+ + "\n\nResponse message:\nHeaders:\n"
+ + entryContext.getResponse().getHTTPHeaders()
+ + "\nMessage:\n"
+ + entryContext.getResponse().getMessage(),
+ entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1116.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1116.java
new file mode 100644
index 000000000..60509344a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP1116.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.w3c.dom.Document;
+
+
+/**
+ * BP1116.
+ * SOAPAction header should contain a quoted string that has same
+ * value as the value of the soapbind:operation/@soapAction attribute,
+ * and an empty string ("") if there is no such attribute.
+ */
+public class BP1116 extends AssertionProcessVisitor
+{
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP1116(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private String action = null;
+ private String headers = null;
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation soapOper,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String soapAction = soapOper.getSoapActionURI();
+ if (soapAction == null)
+ {
+ if (!"".equals(action))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "\nHTTP headers:\n" + headers + "\nsoapAction:\n" + soapAction;
+ }
+ }
+ else
+ {
+ if (!soapAction.equals(action))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "\nHTTP headers:\n" + headers + "\nsoapAction:\n" + soapAction;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Parse request message
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // get SOAPAction
+ headers = entryContext.getRequest().getHTTPHeaders();
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+
+ if (action == null)
+ throw new AssertionNotApplicableException();
+
+ if (action.length() > 1
+ && action.charAt(0) == '"'
+ && action.charAt(action.length() - 1) == '"')
+ {
+ action = action.substring(1, action.length() - 1);
+ }
+
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ doc,
+ null,
+ validator.analyzerContext.getCandidateInfo().getBindings()[0],
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator),
+ false);
+
+ if (match != null)
+ {
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPOperation(true);
+ traversal.traverse(match.getOperation());
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ if (result == AssertionResult.RESULT_FAILED
+ && failureDetailMessage != null)
+ {
+ failureDetail = this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4103.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4103.java
new file mode 100644
index 000000000..dd46795b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4103.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * BP4103
+ *
+ * <context>For a candidate message in the message log file</context>
+ * <assertionDescription>The message contains an HTTP Authentication header field</assertionDescription>
+ */
+public class BP4103 extends AssertionProcess {
+
+ private static final String HTTP_AUTH_SCHEME_BASIC = "Basic";
+ private static final String HTTP_AUTH_SCHEME_DIGEST = "Digest";
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4103(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Getting message headers
+ String headers = entryContext.getMessageEntry().getHTTPHeaders();
+ // If this is a request message
+ if (entryContext.getMessageEntry().getType().equals(MessageEntry.TYPE_REQUEST))
+ {
+ // If the request headers contain authentication scheme "Basic" or "Digest"
+ // or there are no HTTP Authentication headers, the assertion is not applicable
+ if (!containsInvalidAuth(headers, HTTPConstants.HEADER_AUTHORIZATION)
+ && !containsInvalidAuth(headers, HTTPConstants.HEADER_PROXY_AUTHORIZATION))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ // else this is a response
+ else
+ {
+ // If the response headers contain authentication scheme "Basic" or "Digest"
+ // or there are no HTTP Authentication headers, the assertion is not applicable
+ if (!containsInvalidAuth(headers, HTTPConstants.HEADER_WWW_AUTHENTICATE)
+ && !containsInvalidAuth(headers, HTTPConstants.HEADER_PROXY_AUTHENTICATE))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+
+ // Assertion result has not been changed, HTTP Authentication headers
+ // does not contain authentication scheme "Basic" or "Digest",
+ // the assertion passed
+ if (result.equals(AssertionResult.RESULT_PASSED))
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checks whether HTTP headers contain HTTP Authentication headers that uses
+ * authentication scheme other than "Basic" or "Digest".
+ * @param headers HTTP headers.
+ * @param header a header name being retrieved.
+ * @return true if the HTTP Authentication header that uses authentication
+ * scheme other than "Basic" or "Digest" is found, false otherwise.
+ */
+ private boolean containsInvalidAuth(String headers, String header)
+ {
+ // Getting a header value
+ String headerValue = null;
+ try
+ {
+ headerValue = (String) HTTPUtils.getHttpHeaderTokens(headers,":")
+ .get(header.toUpperCase());
+ }
+ catch (Exception e) {}
+
+ // If the header is presented
+ if (headerValue != null)
+ {
+ // Retrieving authentication scheme
+ int idxSP = headerValue.indexOf(" ");
+ if (idxSP > -1)
+ {
+ headerValue = headerValue.substring(0, idxSP);
+ }
+ // If a scheme is neither "Basic" nor "Digest", return true
+ if (!headerValue.equalsIgnoreCase(HTTP_AUTH_SCHEME_BASIC)
+ && !headerValue.equalsIgnoreCase(HTTP_AUTH_SCHEME_DIGEST))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4104.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4104.java
new file mode 100644
index 000000000..2b50a0bd2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4104.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * BP4104
+ * <context>For a candidate message in the message log file containing an HTTP Header field that is not from the following list of specified header fields: (http://www.mnot.net/drafts/draft-nottingham-http-header-reg-00.txt)</context>
+ * <assertionDescription>The message contains an HTTP Header field that is not from the following list of specified header fields: (http://www.mnot.net/drafts/draft-nottingham-http-header-reg-00.txt)</assertionDescription>
+ */
+public class BP4104 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ private List knownHeaderNames;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4104(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ knownHeaderNames = null;
+ }
+
+ private List getAllKnownHeaderNames() {
+ if (knownHeaderNames == null) {
+ knownHeaderNames = HTTPConstants.getAllKnownHeaderNames();
+ }
+ return knownHeaderNames;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // getting HTTP Headers
+ Map hmap = HTTPUtils.getHttpHeaderTokens(
+ entryContext.getMessageEntry().getHTTPHeaders(), ":");
+
+ Iterator i = hmap.keySet().iterator() ;
+ while (i.hasNext()) {
+ String headerName = (String) i.next();
+ // If header name is not known, then the assertion passed
+ if (!getAllKnownHeaderNames().contains(headerName.toUpperCase()))
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+
+ break;
+ }
+ }
+
+ // If there is no HTTP header that is not from a list,
+ // then the assertion is not applicable
+ if (failureDetail == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4105.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4105.java
new file mode 100644
index 000000000..abd09f7dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4105.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+
+/**
+ * BP4105
+ * <context>For a candidate message in the message log file containing a Content-encoding HTTP header field with a value other than "gzip", "compress" or "deflate"</context>
+ * <assertionDescription>The contained Content-encoding HTTP header field has a value other than "gzip", "compress" or "deflate".</assertionDescription>
+ */
+public class BP4105 extends AssertionProcess {
+
+ // All the registered content-coding value tokens (RFC2616) except "identity"
+ private static final String GZIP_VALUE = "gzip";
+ private static final String COMPRESS_VALUE = "compress";
+ private static final String DEFLATE_VALUE = "deflate";
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4105(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // Getting the Content-Encoding HTTP header value
+ String contentEncoding = (String) HTTPUtils.getHttpHeaderTokens(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ ":").get(HTTPConstants.HEADER_CONTENT_ENCODING.toUpperCase());
+
+ if (contentEncoding != null)
+ {
+ // Lowering value's case because RFC2616 says
+ // that all content-coding values are case-insensitive
+ contentEncoding = contentEncoding.toLowerCase();
+
+ // Multiple encodings can be applied to an entity,
+ // so breaking the value into tokens
+ StringTokenizer st = new StringTokenizer(contentEncoding, ",");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken().trim();
+ // If a token does not equal to any registered one
+ // then the assertion passed
+ if ( !token.equals(GZIP_VALUE)
+ && !token.equals(COMPRESS_VALUE)
+ && !token.equals(DEFLATE_VALUE)) {
+
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+
+ break;
+ }
+ }
+ }
+
+ // If there is no unregistered value of Content-Encoding,
+ // then the assertion is not applicable
+ if (failureDetail == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4106.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4106.java
new file mode 100644
index 000000000..0d9489b94
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4106.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+
+/**
+ * BP4106
+ * <context>For a candidate response message in the message log file that contains a transfer-encoding HTTP header field.</context>
+ * <assertionDescription>The contained transfer-encoding HTTP header field has a value of "chunked"</assertionDescription>
+ */
+public class BP4106 extends AssertionProcess {
+
+ private static final String CHUNKED_VALUE = "chunked";
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4106(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // Getting a Transfer-Encoding HTTP header value
+ String transferEncoding = (String) HTTPUtils.getHttpHeaderTokens(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ ":").get(HTTPConstants.HEADER_TRANSFER_ENCODING.toUpperCase());
+
+ if (transferEncoding != null)
+ {
+ // Lowering value's case because RFC2616 says
+ // that all transfer-coding values are case-insensitive
+ transferEncoding = transferEncoding.toLowerCase();
+
+ // If the value is other than "chunked", then the assertion passed
+ if (!transferEncoding.equals(CHUNKED_VALUE)) {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ }
+
+ // If there is no Tranfer-Encoding or its value is "chunked",
+ // then the assertion is not applicable
+ if (failureDetail == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4107.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4107.java
new file mode 100644
index 000000000..4e68a612b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/BP4107.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+
+/**
+ * BP4107
+ * <context>For a request message containing an Upgrade field in the HTTP Headers.</context>
+ * <assertionDescription>The request message contains an Upgrade field in the HTTP Headers.</assertionDescription>
+ */
+public class BP4107 extends AssertionProcess {
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public BP4107(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Getting the Upgrade HTTP header value
+ String upgrage = (String) HTTPUtils.getHttpHeaderTokens(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ ":").get(HTTPConstants.HEADER_UPGRADE.toUpperCase());
+
+ // If the header is presented, then the assertion passed
+ if (upgrage != null)
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription(), entryContext);
+ }
+ // else the assertion is not applicable
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/MessageValidatorImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/MessageValidatorImpl.java
new file mode 100644
index 000000000..0938add12
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/MessageValidatorImpl.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2003 IBM Corporation, Parasoft and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Parasoft - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.MessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+
+/**
+ * @version 1.0
+ */
+public class MessageValidatorImpl
+ extends BaseMessageValidator
+ implements MessageValidator
+{
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isPrimaryEntryTypeMatch(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ protected boolean isPrimaryEntryTypeMatch(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ {
+ boolean match = false;
+
+ // Verify that the entry and test assertion have the same primary context
+ if ((testAssertion.getEntryTypeName().equals(EntryType.TYPE_MESSAGE_ANY))
+ || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_MESSAGE_REQUEST)
+ && (entryContext
+ .getEntry()
+ .getEntryType()
+ .getTypeName()
+ .equals(EntryType.TYPE_MESSAGE_REQUEST)))
+ || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_MESSAGE_RESPONSE)
+ && (entryContext
+ .getEntry()
+ .getEntryType()
+ .getTypeName()
+ .equals(EntryType.TYPE_MESSAGE_RESPONSE)))
+ || testAssertion.getEntryTypeName().equals(EntryType.TYPE_MIME_ROOT_PART)
+ || testAssertion.getEntryTypeName().equals(EntryType.TYPE_MIME_PART))
+ {
+ match = true;
+ }
+
+ return match;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP1003.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP1003.java
new file mode 100644
index 000000000..0c5bb9851
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP1003.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Map;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+
+/**
+ * SSBP1003.
+ *
+ * <context>For a candidate non-multipart/related message in the log file, which has a non-empty entity-body</context>
+ * <assertionDescription>
+ * The logged SOAP envelope is a UTF-8 transcript of an envelope originally encoded as UTF-8 or UTF-16.
+ * The HTTP Content-Type header's charset value is either UTF-8 or UTF-16. Looking at the messageContent
+ * element of the logged message, either
+ * (1) it has a BOM attribute which maps the charset value in the Content-Type header, or
+ * (2) it has it has an XML declaration which matches the charset value in the Content-Type header, or
+ * (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8.
+ * </assertionDescription>
+ *
+ * @author lauzond
+ */
+public class SSBP1003 extends AssertionProcess
+{
+ protected final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public SSBP1003(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // If there is a response message for one-way operation, the assertion is not applicable
+ if (validator.isOneWayResponse(entryContext))
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
+
+ Map httpHeaderMap = HTTPUtils.getHttpHeaderTokens(httpHeader, ":");
+ String contentType = (String) httpHeaderMap.get("Content-Type".toUpperCase());
+
+ if (contentType == null)
+ {
+ throw new AssertionFailException(
+ "The Content-Type header is not present.");
+ }
+
+ contentType = contentType.trim();
+ String charset = contentType.substring(
+ contentType.indexOf(";") + 1, contentType.length());
+ charset = charset.trim();
+ if (!charset.startsWith("charset"))
+ {
+ throw new AssertionFailException(
+ "Missing or bad \"charset\" attribute in the Content-Type header: "
+ + charset);
+ }
+
+ String charsetValue = charset.substring(
+ charset.indexOf("=") + 1, charset.length());
+ if (charsetValue.startsWith("\""))
+ {
+ charsetValue = charsetValue.substring(1, charsetValue.length() - 1);
+ }
+
+ if (!charsetValue.equalsIgnoreCase("utf-8")
+ && !charsetValue.equalsIgnoreCase("utf-16"))
+ {
+ throw new AssertionFailException("The value of the \"charset\" "
+ + "attribute of the Content-Type header is " + contentType);
+ }
+ // Parse log message
+ //gets first string
+ int idx = entryContext.getMessageEntry().getMessage().indexOf("<?xml");
+ if (idx == -1)
+ {
+ throw new AssertionPassException();
+ }
+
+ int idx2 = entryContext.getMessageEntry().getMessage().indexOf("?>");
+ if (idx2 == -1)
+ {
+ throw new AssertionPassException();
+ }
+
+ String xmlDeclaration = entryContext.getMessageEntry().getMessage()
+ .substring(idx, idx2 + "?>".length());
+
+ idx = xmlDeclaration.indexOf("encoding");
+ if (idx == -1)
+ {
+ if (charsetValue.equalsIgnoreCase("utf-8"))
+ {
+ throw new AssertionPassException();
+ }
+ else
+ {
+ throw new AssertionFailException("There is no XML declaration and the"
+ + " charset value in the Content-Type header is not UTF-8."
+ + "\nCharset value in the Content-Type header: " + charsetValue);
+ }
+ }
+
+ int idxQ = xmlDeclaration.indexOf('\'', idx);
+ int idxQQ = xmlDeclaration.indexOf('\"', idx);
+ int idxQuote = -1;
+ char qouteCh = '\0';
+ if (idxQ == -1)
+ {
+ idxQuote = idxQQ;
+ qouteCh = '\"';
+ }
+ else
+ {
+ if (idxQQ == -1)
+ {
+ idxQuote = idxQ;
+ qouteCh = '\'';
+ }
+ else
+ {
+ if (idxQQ < idxQ)
+ {
+ idxQuote = idxQQ;
+ qouteCh = '\"';
+ }
+ else
+ {
+ idxQuote = idxQ;
+ qouteCh = '\'';
+ }
+ }
+ }
+
+ if (idxQuote == -1 || qouteCh == '\0')
+ {
+ throw new AssertionPassException();
+ }
+
+ int idxLQoute = xmlDeclaration.indexOf(qouteCh, idxQuote + 1);
+
+ if (idxLQoute == -1)
+ {
+ throw new AssertionPassException();
+ }
+
+ String xmlEncoding =
+ xmlDeclaration.substring(idxQuote + 1, idxLQoute);
+ if (charsetValue.equalsIgnoreCase(xmlEncoding))
+ {
+ // If there is a BOM, then check that it is the same as the xmlEncoding
+ int bom = 0;
+ if ((bom = entryContext.getMessageEntry().getBOM()) != 0)
+ {
+ if ((bom == WSIConstants.BOM_UTF8
+ && !xmlEncoding.equalsIgnoreCase("utf-8"))
+ || ((bom == WSIConstants.BOM_UTF16
+ && !xmlEncoding.equalsIgnoreCase("utf-16")))
+ || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN
+ && !xmlEncoding.equalsIgnoreCase("utf-16"))))
+ {
+ throw new AssertionFailException(
+ "The BOM and XML declaration do not match.");
+ }
+ }
+
+ throw new AssertionPassException();
+ }
+ else
+ {
+ throw new AssertionFailException("There is an XML declaration, but its "
+ + "encoding value does not match the charset value.\n"
+ + "Charset value in the Content-Type header: " + charsetValue
+ + "\nEncoding in the XML declaration: " + xmlEncoding);
+ }
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5100.java
new file mode 100644
index 000000000..db528ce45
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5100.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+
+
+/**
+ * SSBP5100
+ * <context>For a candidate message in the log file, with an HTTP entity-body.</context>
+ * <assertionDescription>The SOAP envelope is the exclusive payload of the HTTP entity-body.</assertionDescription>
+ */
+public class SSBP5100 extends AssertionProcess {
+
+ protected final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public SSBP5100(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ try
+ {
+ // Getting a message document
+ Document doc = entryContext.getMessageEntryDocument();
+
+ // If the message is empty or invalid, the assertion is not applicable
+ if (doc == null)
+ {
+ if (this.validator.isOneWayResponse(entryContext))
+ throw new AssertionNotApplicableException();
+ else
+ throw new AssertionFailException();
+ }
+ if (!doc.getDocumentElement().getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
+ throw new AssertionFailException();
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getFailureMessage(),
+ entryContext);
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5101.java
new file mode 100644
index 000000000..0a7a68401
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/SSBP5101.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+
+/**
+ * SSBP5101
+ * <context>For a candidate message in the log file.</context>
+ * <assertionDescription>A message must have a "Content-Type" HTTP header field. The "Content-Type" HTTP header field must have a field-value whose media type is "text/xml".</assertionDescription>
+ *
+ * @author lauzond
+ */
+public class SSBP5101 extends AssertionProcess {
+
+ protected final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public SSBP5101(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // getting Content-Type HTTP header
+ String contentType = (String) HTTPUtils.getHttpHeaderTokens(
+ entryContext.getMessageEntry().getHTTPHeaders(),
+ ":").get(HTTPConstants.HEADER_CONTENT_TYPE.toUpperCase());
+
+ // if Content-Type header is not presented
+ // or does not equal to text/xml, then the assertion is failed
+ if (contentType == null
+ || !contentType.startsWith(WSIConstants.CONTENT_TYPE_TEXT_XML))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getFailureMessage(),
+ entryContext);
+ }
+ return this.validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1001.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1001.java
new file mode 100644
index 000000000..fd54c0a0b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1001.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1001
+ */
+public class WSI1001 extends BP1001
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1001(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1002.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1002.java
new file mode 100644
index 000000000..1596f8a52
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1002.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1002
+ */
+public class WSI1002 extends BP1002
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1002(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1003.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1003.java
new file mode 100644
index 000000000..7ea67d346
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1003.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1003
+ */
+public class WSI1003 extends SSBP1003
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1003(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1004.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1004.java
new file mode 100644
index 000000000..e3989c3f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1004.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1004
+ */
+public class WSI1004 extends BP1004
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1004(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1005.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1005.java
new file mode 100644
index 000000000..f2e642af1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1005.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1005;
+
+/**
+ * WSI1005
+ */
+public class WSI1005 extends BP1005
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1005(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1006.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1006.java
new file mode 100644
index 000000000..e9bc23649
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1006.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1006
+ */
+public class WSI1006 extends BP1006
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1006(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1007.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1007.java
new file mode 100644
index 000000000..b98682a79
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1007.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1007;
+
+/**
+ * WSI1007
+ */
+public class WSI1007 extends BP1007
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1007(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1008.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1008.java
new file mode 100644
index 000000000..34215815c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1008.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1008;
+
+/**
+ * WSI1008
+ */
+public class WSI1008 extends BP1008
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1008(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1009.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1009.java
new file mode 100644
index 000000000..0fc8662d5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1009.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1009;
+
+/**
+ * WSI1009
+ */
+public class WSI1009 extends BP1009
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1009(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1010.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1010.java
new file mode 100644
index 000000000..0d18bf3cd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1010.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1010
+ */
+public class WSI1010 extends BP1010
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1010(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1011.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1011.java
new file mode 100644
index 000000000..d5b9743e8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1011.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1011;
+
+/**
+ * WSI1011
+ */
+public class WSI1011 extends BP1011
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1011(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1012.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1012.java
new file mode 100644
index 000000000..b2cc640fb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1012.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1012;
+
+/**
+ * WSI1012
+ */
+public class WSI1012 extends BP1012
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1012(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1013.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1013.java
new file mode 100644
index 000000000..e2f71dd44
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1013.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1013;
+
+/**
+ * WSI1013
+ */
+public class WSI1013 extends BP1013
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1013(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1031.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1031.java
new file mode 100644
index 000000000..4383e9cfd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1031.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1031;
+
+/**
+ * WSI1031
+ */
+public class WSI1031 extends BP1031
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1031(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1100.java
new file mode 100644
index 000000000..4cdb358bc
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1100.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1100;
+
+/**
+ * WSI1100
+ */
+public class WSI1100 extends BP1100
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1100(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1101.java
new file mode 100644
index 000000000..5ef5d2cb2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1101.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1101
+ */
+public class WSI1101 extends BP1101
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1101(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1102.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1102.java
new file mode 100644
index 000000000..042a4f6a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1102.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPConstants;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.HttpHeadersValidator;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ * BPWSI4.
+ * The request message should be invalid (HTTP request malformed,
+ * XML not well formed, ...).
+ */
+public class WSI1102 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1102(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
+
+ String requestMessage = null;
+ //String responseMessage = null;
+ String contentType = null;
+ result = null;
+ //
+
+ try
+ {
+ // check HTTP status code
+ String httpStatus =
+ Utils.getHTTPStatusCode(
+ entryContext.getMessageEntry().getHTTPHeaders());
+ if ("400".equals(httpStatus))
+ {
+
+ requestMessage = entryContext.getRequest().getMessage();
+
+ String requestHTTPHeaders =
+ entryContext.getRequest().getHTTPHeaders();
+
+ //check request HTTP Headers
+
+ //HttpHeadersValidator validator = new HttpHeadersValidator();
+
+ if (!HttpHeadersValidator
+ .validateHttpRequestHeaders(requestHTTPHeaders))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ //check request xml message
+
+ contentType = (String) HTTPUtils.getHttpHeaderTokens(httpHeader, ":")
+ .get(HTTPConstants.HEADER_CONTENT_TYPE.toUpperCase());
+ if (contentType.indexOf(WSIConstants.CONTENT_TYPE_TEXT_XML) != -1)
+ {
+ try
+ {
+ if (requestMessage != null)
+ {
+ DocumentBuilderFactory factory =
+ DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ //Document doc = builder.parse(new InputSource(new StringReader(requestMessage)));
+ builder.parse(
+ new InputSource(new StringReader(requestMessage)));
+ }
+
+ }
+ catch (SAXException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Exception e)
+ {
+ new WSIException(e.getMessage(), e);
+ }
+ }
+
+ if (result == null)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nRequest message:\nHeaders:\n"
+ + entryContext.getRequest().getHTTPHeaders()
+ + "Message:\n"
+ + entryContext.getRequest().getMessage()
+ + "\n\nResponse message:\nHeaders:\n"
+ + entryContext.getResponse().getHTTPHeaders()
+ + "Message:\n"
+ + entryContext.getResponse().getMessage(),
+ entryContext);
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ catch (WSIException wsie)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1103.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1103.java
new file mode 100644
index 000000000..df52b104d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1103.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1103
+ */
+public class WSI1103 extends BP1103
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1103(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1104.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1104.java
new file mode 100644
index 000000000..9e0ce85aa
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1104.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1104.
+ * The request message should not contain a content-type of "text/xml".
+ */
+public class WSI1104 extends BP1104
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1104(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1105.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1105.java
new file mode 100644
index 000000000..52c56f2a2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1105.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.SetCookie2Validator;
+
+
+/**
+ * BPWSI4.
+ * The Cookies should conform to RFC2965.
+ */
+public class WSI1105 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1105(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ SetCookie2Validator cookieVal = new SetCookie2Validator();
+ String headers = entryContext.getMessageEntry().getHTTPHeaders();
+ if (entryContext
+ .getMessageEntry()
+ .getType()
+ .equalsIgnoreCase(MessageEntry.TYPE_RESPONSE))
+ {
+ // if response trom server
+ String setCookie2 =
+ (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("Set-Cookie2".toUpperCase());
+ if (setCookie2 == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ if (cookieVal.isSetCookie2(setCookie2.trim()))
+ result = AssertionResult.RESULT_PASSED;
+ else
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nMessage:\nHeaders:\n"
+ + entryContext.getMessageEntry().getHTTPHeaders()
+ + "\nSOAP message:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ }
+ }
+ else
+ {
+ // if request to the server
+ String cookie =
+ (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("Cookie");
+ if (cookie == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ if (cookieVal.isCookie(cookie.trim()))
+ result = AssertionResult.RESULT_PASSED;
+ else
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nMessage:\nHeaders:\n"
+ + entryContext.getMessageEntry().getHTTPHeaders()
+ + "\nSOAP message:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1107.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1107.java
new file mode 100644
index 000000000..0cfbac6da
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1107.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1107;
+
+/**
+ * WSI1107
+ */
+public class WSI1107 extends BP1107
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1107(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1108.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1108.java
new file mode 100644
index 000000000..55782595a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1108.java
@@ -0,0 +1,415 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.log.MessageEntry;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.NullUtil;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BPWSI4.
+ * Each soapbind extension element with a wsdl:required
+ * attribute of false must appear in a message.
+ */
+public class WSI1108 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1108(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private OperationSignature.OperationMatch match = null;
+ private EntryContext entryContext = null;
+ private OperationSignature responseSig = null;
+ private Vector headerRarts = null;
+ private boolean visitFault = false;
+ private boolean existSOAPHeader = true;
+ private boolean isRequest = false;
+ private boolean existSOAPHeaderFault = true;
+
+ /**
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(SOAPBody, Object, WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+
+ // if "wsdl:required" is true then return
+ if (body.getRequired() != null
+ && body.getRequired().booleanValue() == true)
+ return;
+
+ // assert parent instanceof BindingOutput
+ BindingOperation bop = ctx.getBindingOperation();
+ if (bop.getOperation() == null
+ || bop.getOperation().getOutput() == null
+ || bop.getOperation().getOutput().getMessage() == null)
+ return;
+ Message msg = bop.getOperation().getOutput().getMessage();
+ List parts =
+ WSDLUtil.getParts(
+ bop.getOperation(),
+ msg,
+ body,
+ match.getOperationStyle());
+
+ QName additionalName = null;
+ // if operation is rpc, add to parts qname qith function name
+ if (WSIConstants
+ .ATTRVAL_SOAP_BIND_STYLE_RPC
+ .equals(match.getOperationStyle()))
+ {
+ // found out target namespace
+ String namespace = body.getNamespaceURI();
+ if (namespace == null || namespace.length() == 0)
+ // !! ATTENTION
+ // namespace should be retrieved from service target nameapce
+ namespace = ctx.getBinding().getQName().getNamespaceURI();
+
+ // insert operation name as first signature part
+ additionalName =
+ new QName(
+ namespace,
+ bop
+ .getOperation()
+ .getOutput()
+ .getMessage()
+ .getQName()
+ .getLocalPart());
+ }
+
+ // create the signature of this operation
+ OperationSignature op =
+ new OperationSignature(
+ parts,
+ null,
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator),
+ false);
+ if (additionalName != null)
+ op.getSignature().add(0, additionalName);
+
+ if (op.getSignature().equals(responseSig.getSignature()))
+ {
+ // ctx.cancelBindingOperationProcessing();
+ }
+ else
+ {
+ // create the signature of this operation
+ op =
+ new OperationSignature(
+ parts,
+ null,
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator),
+ true);
+
+ if (additionalName != null)
+ op.getSignature().add(0, additionalName);
+ if (op.getSignature().equals(responseSig.getSignature()))
+ {
+ // ctx.cancelBindingOperationProcessing();
+ }
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nMessage:\n" + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ ctx.cancelBindingOperationProcessing();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+
+ if (existSOAPHeaderFault == false)
+ {
+ existSOAPHeader = false;
+ ctx.cancelBindingOperationProcessing();
+ return;
+ }
+ // if "wsdl:required" is true then return
+ if (header.getRequired() != null
+ && header.getRequired().booleanValue() == true)
+ return;
+ // find headr part
+ Definition d = (Definition) ctx.getParameter("definition");
+ TypesRegistry tReg = (TypesRegistry) ctx.getParameter("TypesRegistry");
+ Part mesPart =
+ WSDLUtil.getPart(d.getMessage(header.getMessage()), header.getPart());
+
+ // test this part and parts from header
+ QName partQName = mesPart.getTypeName();
+ if (partQName == null)
+ partQName = tReg.getType(mesPart.getElementName());
+ if (partQName == null)
+ throw new IllegalArgumentException(
+ "Part type can not be null." + mesPart.getElementName().toString());
+ String local = partQName.getLocalPart();
+ String ns = partQName.getNamespaceURI();
+
+ existSOAPHeader = false;
+ for (int i = 0; i < headerRarts.size(); i++)
+ {
+ Element elem = (Element) headerRarts.get(i);
+ if (elem.getLocalName().equals(local)
+ && NullUtil.equals(ns, elem.getNamespaceURI()))
+ {
+ existSOAPHeader = true;
+ break;
+ }
+ }
+ if (existSOAPHeader == true)
+ ctx.cancelSOAPHeaderProcessing();
+ if (isRequest == true)
+ ctx.cancelBindingOperationProcessing();
+ if (existSOAPHeader == false && isRequest == false)
+ existSOAPHeaderFault = false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault headerFault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // find headr part
+ Definition d = (Definition) ctx.getParameter("definition");
+ TypesRegistry tReg = (TypesRegistry) ctx.getParameter("TypesRegistry");
+ Part mesPart =
+ WSDLUtil.getPart(
+ d.getMessage(headerFault.getMessage()),
+ headerFault.getPart());
+
+ // test this part and parts from headerfault
+ QName partQName = mesPart.getTypeName();
+ if (partQName == null)
+ partQName = tReg.getType(mesPart.getElementName());
+ if (partQName == null)
+ throw new IllegalArgumentException(
+ "Part type can not be null." + mesPart.getElementName().toString());
+ String local = partQName.getLocalPart();
+ String ns = partQName.getNamespaceURI();
+
+ for (int i = 0; i < headerRarts.size(); i++)
+ {
+ Element elem = (Element) headerRarts.get(i);
+ if (elem.getLocalName().equals(local)
+ && NullUtil.equals(ns, elem.getNamespaceURI()))
+ {
+ existSOAPHeaderFault = true;
+ break;
+ }
+ }
+ if (existSOAPHeaderFault == true)
+ ctx.cancelSOAPHeaderProcessing();
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
+ {
+ // set in true if any SOAPFault exist
+ visitFault = true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ if (this.validator.isOneWayResponse(entryContext))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ this.entryContext = entryContext;
+ // Parse request message
+ Document doc = entryContext.getRequestDocument();
+ // create request signature
+ match =
+ OperationSignature.matchOperation(
+ doc,
+ null,
+ validator.analyzerContext.getCandidateInfo().getBindings()[0],
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator),
+ false);
+
+ // if such operation exist
+ if (match != null)
+ {
+ isRequest =
+ MessageEntry.TYPE_REQUEST.equals(
+ entryContext.getMessageEntry().getType());
+ // Parse message
+ doc = entryContext.getMessageEntryDocument();
+
+ if (!isRequest)
+ {
+ responseSig = new OperationSignature(doc);
+ if (WSIConstants
+ .ATTRVAL_SOAP_BIND_STYLE_RPC
+ .equals(match.getOperationStyle()))
+ responseSig.createRPCSignature();
+ }
+ // extract all headers from message
+ Element headerElem =
+ XMLUtils.findChildElement(
+ doc.getDocumentElement(),
+ WSITag.ELEM_SOAP_HEADER);
+ headerRarts = new Vector();
+ if (headerElem != null)
+ headerRarts = XMLUtils.getChildElements(headerElem);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreBindingInput2SOAPBody();
+
+ if (isRequest)
+ traversal.ignoreBindingOutput();
+ else
+ traversal.ignoreBindingInput2SOAPHeader();
+
+ if (responseSig != null && responseSig.isFault())
+ traversal.ignoreBindingOutput();
+ else
+ traversal.ignoreBindingFault();
+
+ existSOAPHeaderFault = true;
+ Map m = new HashMap();
+ WSDLUtil.expandDefinition(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions());
+ m.put(
+ "definition",
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions());
+ TypesRegistry tReg =
+ new TypesRegistry(
+ validator.analyzerContext
+ .getCandidateInfo()
+ .getWsdlDocument()
+ .getDefinitions(),
+ validator);
+ m.put("TypesRegistry", tReg);
+ traversal.traverse(match.getOperation(), m);
+
+ if (isRequest == false)
+ if (existSOAPHeaderFault == true)
+ existSOAPHeader = true;
+
+ if (responseSig != null
+ && responseSig.isFault()
+ && visitFault == false)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nMessage:\n" + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ if (existSOAPHeader == false)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nMessage:\n" + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1109.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1109.java
new file mode 100644
index 000000000..0ce7391e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1109.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * WSI1109.
+ * Any conformance claims MUST be children of the soap:Header element.
+ */
+public class WSI1109 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1109(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ if ((entryContext.getMessageEntry() != null)
+ && (!this.validator.isOneWayResponse(entryContext)))
+ {
+ try
+ {
+ // Parse message
+ Document doc = entryContext.getMessageEntryDocument();
+ Element root = doc.getDocumentElement();
+ // find "Header" element
+ NodeList headerList =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Header");
+ Element headerElem = null;
+ if (headerList != null && headerList.getLength() != 0)
+ headerElem = (Element) headerList.item(0);
+
+ // find "Claim" element
+ NodeList claimList =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_CLAIM, "Claim");
+ if (claimList == null || claimList.getLength() == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ for (int i = 0; i < claimList.getLength(); i++)
+ {
+ if (headerElem == null
+ || claimList.item(i).getParentNode() != headerElem)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nSOAP message:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1110.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1110.java
new file mode 100644
index 000000000..08a3c5972
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1110.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * WSI1110.
+ * Any conformance claims MUST adhere to the WS-I conformance
+ * claim schema defined in the Basic Profile.
+ */
+public class WSI1110 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1110(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ if (entryContext.getMessageEntry() != null
+ && !this.validator.isOneWayResponse(entryContext)
+ && (doc = entryContext.getMessageEntryDocument()) != null)
+ {
+ Element root = doc.getDocumentElement();
+ // find "Claim" element
+ NodeList claimList =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_CLAIM, "Claim");
+ if (claimList == null || claimList.getLength() == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ for (int i = 0; i < claimList.getLength(); i++)
+ {
+ Element elem = (Element) claimList.item(i);
+ // check "conformsTo" attribute
+ Node node = elem.getAttributeNode("conformsTo");
+ if (node == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nSOAP message:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ break;
+ }
+ /* This is checked in WSI1111
+ // check "mustUnderstand" attribute
+ node = elem.getAttributeNodeNS(WSIConstants.NS_URI_SOAP, "mustUnderstand");
+ if (node != null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = createFailureDetail("\nSOAP message:\n" + entryContext.getMessageEntry().getMessage(), entryContext);
+ break;
+ }
+ */
+ }
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1111.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1111.java
new file mode 100644
index 000000000..285c5e831
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1111.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * WSI1111.
+ * Any conformance claims MUST NOT use soap:mustUnderstand='1'.
+ */
+public class WSI1111 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1111(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Document doc;
+ if (entryContext.getMessageEntry() != null
+ && !this.validator.isOneWayResponse(entryContext)
+ && (doc = entryContext.getMessageEntryDocument()) != null)
+ {
+ Element root = doc.getDocumentElement();
+ // find "Claim" element
+ NodeList claimList =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_CLAIM, "Claim");
+ if (claimList != null && claimList.getLength() != 0)
+ {
+ // if contains "Claim" element find all "Header" elements
+ NodeList headerList =
+ root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Header");
+ if (headerList != null && headerList.getLength() != 0)
+ {
+ for (int iHeader = 0; iHeader < headerList.getLength(); iHeader++)
+ {
+ // find all "Header" child elements
+ Node child = headerList.item(iHeader).getFirstChild();
+ while (child != null)
+ {
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ {
+ // if contains "mustUnderstand" -> fail
+ String attrVal =
+ ((Element) child).getAttributeNS(
+ WSIConstants.NS_URI_SOAP,
+ "mustUnderstand");
+ if (attrVal != null && !"".equals(attrVal))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "\nSOAP message:\n"
+ + entryContext.getMessageEntry().getMessage(),
+ entryContext);
+ iHeader = headerList.getLength();
+ break;
+ }
+ }
+ child = child.getNextSibling();
+ }
+ }
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1116.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1116.java
new file mode 100644
index 000000000..dc97e0365
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1116.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI1116
+ */
+public class WSI1116 extends BP1116
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1116(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1121.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1121.java
new file mode 100644
index 000000000..f2c16c7a9
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1121.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BPWSI4.
+ */
+public class WSI1121 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1121(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ try
+ {
+ // GT: -- start: base on wsi1011 - should refactor this
+
+ Binding[] bindings = validator.analyzerContext.getCandidateInfo().getBindings();
+
+ // get soap message child name
+ // Get the DOM contents of the message soap:body (if non-empty)
+ Document messageDoc = null;
+
+ QName messagePartElementQName = null;
+ if (!entryContext.getMessageEntry().getMessage().equals(""))
+ {
+ messageDoc =
+ XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
+ // get soap operation name from the soap:body
+
+ // NOTE: getSoapBodyChild() may return null, if the soap:body did not contain any child elements
+ Element soapMessageElement = this.validator.getSoapBodyChild(messageDoc);
+
+ // for doc-lit... find the wsdl:part from one of the specified operations that has
+ // the soap element used in the message.
+ // we are looking for a part with an element attrib val matching the soap message element
+ if (soapMessageElement != null)
+ {
+ messagePartElementQName =
+ new QName(
+ soapMessageElement.getNamespaceURI(),
+ soapMessageElement.getLocalName());
+ }
+ }
+
+ if ((messageDoc == null) || this.validator.isFault(messageDoc))
+ {
+ // empty messages and messages containing soap:Faults do not qualify for this TA
+ throw new AssertionNotApplicableException();
+ }
+
+ BindingOperation[] docBindingOperations =
+ this.validator.getMatchingBindingOps(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
+ bindings);
+ // list of operations that match the <wsdl:input> or <wsdl:output> (depending on entryType)
+ // for part element="..."
+ // (ISSUE: what about part type="..."?)
+ BindingOperation[] potentialDocLitOps =
+ this.validator.getDocLitOperations(
+ entryContext.getEntry().getEntryType(),
+ messagePartElementQName,
+ docBindingOperations);
+ // GT: --- end: base on wsi1011
+
+ //
+ if (potentialDocLitOps.length == 0)
+ {
+ // not doc-lit so quit
+ throw new AssertionNotApplicableException();
+ }
+
+ // We know there is a doc-lit match, so now try to validate the soap message against the
+ // referenced schema
+
+ // GT - how to reference the schema document?? need to use the <wsdl:part>, or do it purely
+ // from the soap message elements?
+ // ie body, envelope or wsdl??
+
+ // <experiment>
+
+ boolean isSchemaValid;
+
+ try {
+ isSchemaValid = this.validator.messageIsDocLitSchemaValid(entryContext);
+ } catch (Exception e) {
+ throw new AssertionFailException();
+ }
+ // </experiment>
+
+
+ //isSchemaValid = true; // for now, getting this far does it
+
+ if (isSchemaValid)
+ {
+ throw new AssertionPassException();
+ }
+ else
+ {
+ throw new AssertionFailException();
+ }
+
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
+ }
+ catch (AssertionNotApplicableException e)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1201.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1201.java
new file mode 100644
index 000000000..62748bf54
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1201.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1201;
+
+/**
+ * WSI1201
+ */
+public class WSI1201 extends BP1201
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1201(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1202.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1202.java
new file mode 100644
index 000000000..e0e6bd836
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1202.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1202;
+
+/**
+ * WSI1202
+ */
+public class WSI1202 extends BP1202
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1202(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1203.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1203.java
new file mode 100644
index 000000000..ffe38a3a6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1203.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1203;
+
+/**
+ * WSI1203
+ */
+public class WSI1203 extends BP1203
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1203(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1204.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1204.java
new file mode 100644
index 000000000..49056e86d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1204.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1204;
+
+/**
+ * WSI1204
+ */
+public class WSI1204 extends BP1204
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1204(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1208.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1208.java
new file mode 100644
index 000000000..e90ea3cb2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1208.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1208;
+
+/**
+ * WSI1208
+ */
+public class WSI1208 extends BP1208
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1208(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1211.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1211.java
new file mode 100644
index 000000000..907c7cf09
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1211.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1211;
+
+/**
+ * WSI1211
+ */
+public class WSI1211 extends BP1211
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1211(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1301.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1301.java
new file mode 100644
index 000000000..f781e1175
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1301.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1301;
+
+/**
+ * WSI1301
+ */
+public class WSI1301 extends BP1301
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1301(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1302.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1302.java
new file mode 100644
index 000000000..5f30493ef
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1302.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1302;
+
+/**
+ * WSI1302
+ */
+public class WSI1302 extends BP1302
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1302(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1305.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1305.java
new file mode 100644
index 000000000..72f0684db
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1305.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1305;
+
+/**
+ * WSI1305
+ */
+public class WSI1305 extends BP1305
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1305(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1306.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1306.java
new file mode 100644
index 000000000..389cd964f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1306.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1306;
+
+/**
+ * WSI1306
+ */
+public class WSI1306 extends BP1306
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1306(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1307.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1307.java
new file mode 100644
index 000000000..e900b6a5b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1307.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1307;
+
+/**
+ * WSI1307
+ */
+public class WSI1307 extends BP1307
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1307(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1308.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1308.java
new file mode 100644
index 000000000..e41b290ff
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1308.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1308;
+
+/**
+ * WSI1308
+ */
+public class WSI1308 extends BP1308
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1308(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1309.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1309.java
new file mode 100644
index 000000000..36d599010
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1309.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1309;
+
+/**
+ * WSI1309
+ */
+public class WSI1309 extends BP1309
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1309(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1311.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1311.java
new file mode 100644
index 000000000..30d403155
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1311.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionPassException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.HTTPUtils;
+import org.eclipse.wst.wsi.internal.util.OperationSignature;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * BPWSI4.
+ * The response (SOAP envelope) should be carried by an HTTP
+ * response, over same HTTP connection as the Request.
+ */
+public class WSI1311 extends AssertionProcess
+{
+ private final BaseMessageValidator validator;
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1311(BaseMessageValidator impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+ boolean isOneWayResponse = this.validator.isOneWayResponse(entryContext);
+
+ Document docResponse = null;
+ if (!isOneWayResponse)
+ docResponse = entryContext.getResponseDocument();
+
+ //if fault
+ if (!isOneWayResponse && this.validator.isFault(docResponse))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ { // not fault
+ // 1. get an operation from request
+ // Parse request message
+ Document docRequest = entryContext.getRequestDocument();
+
+ // get SOAPAction
+ String headers = entryContext.getRequest().getHTTPHeaders();
+ String action = null;
+ if (headers != null)
+ action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
+ Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
+ TypesRegistry registry =
+ new TypesRegistry(
+ this.validator.getWSDLDocument().getDefinitions(),
+ validator);
+ OperationSignature.OperationMatch match =
+ OperationSignature.matchOperation(
+ docRequest,
+ action,
+ binding,
+ registry);
+
+ if (match == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ try
+ {
+
+ BindingOperation bindingOperation = match.getOperation();
+ Operation operation = null;
+
+ // Check whether the transport attribute has the value
+ // "http://schemas.xmlsoap.org/soap/http".
+ List extElem = binding.getExtensibilityElements();
+ for (Iterator index = extElem.iterator(); index.hasNext();)
+ {
+ Object o = (Object) index.next();
+ if (o instanceof SOAPBinding)
+ {
+ SOAPBinding soapBinding = (SOAPBinding) o;
+ if (!WSIConstants
+ .NS_URI_SOAP_HTTP
+ .equals(soapBinding.getTransportURI()))
+ {
+ throw new AssertionFailException();
+ }
+
+ }
+ }
+
+ //find operation in port type
+ operation = bindingOperation.getOperation();
+ if (operation == null)
+ {
+ throw new AssertionFailException();
+ }
+
+ if (isOneWayResponse)
+ {
+ if (operation.getOutput() == null)
+ throw new AssertionPassException();
+ else
+ throw new AssertionFailException();
+ }
+
+ // check whether the response message from the log
+ // contains the output message
+ NodeList soapBodyList =
+ docResponse.getElementsByTagNameNS(
+ WSIConstants.NS_URI_SOAP,
+ XMLUtils.SOAP_ELEM_BODY);
+ if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
+ {
+ // Response does not contain any soap Body elements
+ throw new AssertionFailException();
+ }
+ for (int i = 0; i < soapBodyList.getLength(); i++)
+ {
+ Element nextBodyElem = (Element) soapBodyList.item(i);
+ Element soapMessageElement = XMLUtils.getFirstChild(nextBodyElem);
+ while (soapMessageElement != null)
+ {
+ // check whether the operation output has message from SOAP response
+ Message message = operation.getOutput().getMessage();
+ QName soapMessageQName =
+ new QName(
+ soapMessageElement.getNamespaceURI(),
+ soapMessageElement.getLocalName());
+
+ if (message != null
+ && soapMessageQName.equals(message.getQName()))
+ {
+ throw new AssertionPassException();
+ }
+
+ soapMessageElement =
+ XMLUtils.getNextSibling(soapMessageElement);
+ }
+ }
+
+ }
+ catch (AssertionPassException e)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+
+ }
+ }
+
+ if (result == AssertionResult.RESULT_FAILED)
+ {
+ failureDetail = this.validator.createFailureDetail(null, entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1316.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1316.java
new file mode 100644
index 000000000..60da45bf6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1316.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1316;
+
+/**
+ * WSI1316
+ */
+public class WSI1316 extends BP1316
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1316(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1318.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1318.java
new file mode 100644
index 000000000..90b951e25
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1318.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1318;
+
+/**
+ * WSI1318
+ */
+public class WSI1318 extends BP1318
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1318(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1601.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1601.java
new file mode 100644
index 000000000..69d110709
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1601.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1601;
+
+/**
+ * WSI1601
+ */
+public class WSI1601 extends BP1601
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1601(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1701.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1701.java
new file mode 100644
index 000000000..8aed3c0a2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI1701.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP1701;
+
+/**
+ * WSI1701
+ */
+public class WSI1701 extends BP1701
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI1701(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4100.java
new file mode 100644
index 000000000..7dfda3c4f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4100.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP4100;
+
+/**
+ * WSI4100
+ */
+public class WSI4100 extends BP4100
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4100(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4101.java
new file mode 100644
index 000000000..11af4760c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4101.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP4101;
+
+/**
+ * WSI4101
+ */
+public class WSI4101 extends BP4101
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4101(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4102.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4102.java
new file mode 100644
index 000000000..691af49e5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4102.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.envelope.BP4102;
+
+/**
+ * WSI4102
+ */
+public class WSI4102 extends BP4102
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4102(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4103.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4103.java
new file mode 100644
index 000000000..44f4de30d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4103.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI4103
+ */
+public class WSI4103 extends BP4103
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4103(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4104.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4104.java
new file mode 100644
index 000000000..9b061b32b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4104.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI4104
+ */
+public class WSI4104 extends BP4104
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4104(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4105.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4105.java
new file mode 100644
index 000000000..8d05de86c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4105.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI4105
+ */
+public class WSI4105 extends BP4105
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4105(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4106.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4106.java
new file mode 100644
index 000000000..99ffa992f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4106.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI4106
+ */
+public class WSI4106 extends BP4106
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4106(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4107.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4107.java
new file mode 100644
index 000000000..e530407a0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/message/WSI4107.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.message;
+
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseMessageValidator;
+
+/**
+ * WSI4107
+ */
+public class WSI4107 extends BP4107
+{
+
+ /**
+ * @param BaseMessageValidator
+ */
+ public WSI4107(BaseMessageValidator impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3001.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3001.java
new file mode 100644
index 000000000..7f8db4229
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3001.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+import org.uddi4j.datatype.OverviewDoc;
+import org.uddi4j.datatype.tmodel.TModel;
+
+
+/**
+ * BP3001 - The tModel element uses WSDL as the description language:
+ * the uddi:overviewDoc/uddi:overviewURL element contains a reference
+ * to a WSDL definition, which uses a namespace
+ * of http://schemas.xmlsoap.org/wsdl/.
+ * The uddi:overviewURL may use the fragment notation to resolve
+ * to a wsdl:binding.
+ */
+public class BP3001 extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public BP3001(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Sets the result variable to AssertionResult.RESULT_FAILED value and
+ * places a tModel key in the fault detail message.
+ * @param tModelKey
+ */
+ private void setFaultMessage(String tModelKey)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = "The tModel key is: [" + tModelKey + "].";
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ Binding binding = null;
+
+ // Get the tModel from the entryContext
+ TModel tModel = (TModel) entryContext.getEntry().getEntryDetail();
+
+ // If the tModel does not exist, then fail
+ if (tModel == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = "Could not locate a tModel.";
+ return validator.createAssertionResult(
+ testAssertion,
+ result,
+ failureDetailMessage);
+ }
+
+ String key = tModel.getTModelKey();
+
+ OverviewDoc doc = tModel.getOverviewDoc();
+ if (doc != null)
+ {
+ String urlText = doc.getOverviewURLString();
+
+ // Try to resolve the URL & check the WSDL
+ try
+ {
+ WSDLDocument wsdlDocument = new WSDLDocument(urlText);
+ Definition definition = wsdlDocument.getDefinitions();
+ Map namespaces = definition.getNamespaces();
+ if (!namespaces.containsValue(WSIConstants.NS_URI_WSDL))
+ {
+ urlText = null;
+ }
+
+ // Get binding
+ binding = validator.getBinding(urlText, wsdlDocument);
+
+ // See if the binding is in the WSDL document
+ if (binding == null
+ || definition.getBinding(binding.getQName()) == null)
+ {
+ urlText = null;
+ }
+ }
+
+ catch (Exception e)
+ {
+ urlText = null;
+ }
+
+ if (urlText != null)
+ {
+ String fragmentID = null;
+ int index = urlText.indexOf("#");
+ if (index > -1)
+ {
+ fragmentID = urlText.substring(index + 1);
+ }
+
+ if ((fragmentID != null)
+ && (fragmentID.length() != 0)
+ && (fragmentID.toUpperCase().indexOf("xpointer(".toUpperCase()) == -1
+ || fragmentID.lastIndexOf(")") != fragmentID.length() - 1))
+ {
+ setFaultMessage(key);
+ }
+ }
+
+ else
+ {
+ setFaultMessage(key);
+ }
+ }
+
+ else
+ {
+ setFaultMessage(key);
+ }
+
+ if (result == AssertionResult.RESULT_PASSED)
+ {
+ // Set the binding that will be used
+ validator.setWSDLBinding(binding);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3002.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3002.java
new file mode 100644
index 000000000..fb536d989
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3002.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.uddi4j.datatype.binding.BindingTemplate;
+
+
+/**
+ * BP3002 - The uddi:bindingTemplate element contains a uddi:accessPoint element,
+ * with a non-empty value.
+ */
+public class BP3002 extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public BP3002(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ String serviceLocation = null;
+
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the bindingTemplate from the entryContext
+ BindingTemplate bindingTemplate =
+ (BindingTemplate) entryContext.getEntry().getEntryDetail();
+
+ // If the bindingTemplate does not contain an accessPoint, then fail
+ if ((bindingTemplate.getAccessPoint() == null)
+ || ((serviceLocation = bindingTemplate.getAccessPoint().getText())
+ == null))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The bindingTempate key is: ["
+ + bindingTemplate.getBindingKey()
+ + "].";
+ }
+
+ // Else save the service location in the assertion result
+ else
+ {
+ // Save service location in analyzer context
+ entryContext
+ .getAnalyzerContext()
+ .getServiceReference()
+ .setServiceLocation(
+ serviceLocation);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3003.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3003.java
new file mode 100644
index 000000000..1fde9b18a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/BP3003.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.uddi4j.datatype.tmodel.TModel;
+
+
+/**
+ * BP3003 - The uddi:tModel is categorized using the uddi:types taxonomy,
+ * as "wsdlSpec": the uddi:keyedReference element has an attribute keyValue
+ * equal to "wsdlSpec", and keyName equal to "uddi-org:types" or "types".
+ */
+public class BP3003 extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public BP3003(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the tModel from the entryContext
+ TModel tModel = (TModel) entryContext.getEntry().getEntryDetail();
+
+ // If the tModel does not exist, then fail
+ if (tModel == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "Could not locate a tModel with a categorization of 'wsdlSpec'.";
+ }
+
+ // If there is a tModel and it is not categorized as "wsdlSpec", then fail
+ else if (!(validator.isWsdlSpec(tModel)))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The tModel key is: ["
+ + tModel.getTModelKey()
+ + "]\n"
+ + "The categoryBag is: ["
+ + this.validator.categoryBagToString(tModel.getCategoryBag())
+ + "]";
+ }
+
+ // Else get the WSDL document location and set it and the binding element in analyzer context
+ else
+ {
+ // set WSDL location in analyzer context
+ validator.setWSDLLocation(validator.getWSDLLocation(validator.getOverviewURL(tModel)));
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/UDDIValidatorImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/UDDIValidatorImpl.java
new file mode 100644
index 000000000..2178a8029
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/UDDIValidatorImpl.java
@@ -0,0 +1,594 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.*;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.analyzer.ServiceReference;
+import org.eclipse.wst.wsi.internal.analyzer.config.UDDIReference;
+import org.eclipse.wst.wsi.internal.analyzer.config.WSDLElement;
+import org.eclipse.wst.wsi.internal.analyzer.config.impl.WSDLElementImpl;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.UDDIValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseValidatorImpl;
+import org.eclipse.wst.wsi.internal.report.Entry;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+import org.eclipse.wst.wsi.internal.util.UDDIUtils;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+import org.uddi4j.client.UDDIProxy;
+import org.uddi4j.datatype.binding.BindingTemplate;
+import org.uddi4j.datatype.binding.TModelInstanceInfo;
+import org.uddi4j.datatype.tmodel.TModel;
+import org.uddi4j.response.BindingDetail;
+import org.uddi4j.response.TModelDetail;
+import org.uddi4j.util.CategoryBag;
+import org.uddi4j.util.KeyedReference;
+import com.ibm.wsdl.util.StringUtils;
+
+/**
+ * The UDDI validator will verify that a web service description was published correctly in a UDDI registry.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ */
+public class UDDIValidatorImpl
+ extends BaseValidatorImpl
+ implements UDDIValidator
+{
+ /**
+ * UDDI reference.
+ */
+ protected UDDIReference uddiReference;
+ /**
+ * UDDI proxy.
+ */
+ protected UDDIProxy uddiProxy;
+
+ /**
+ * WSDL binding.
+ */
+ private Binding binding = null;
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.UDDIValidator#init(org.wsi.test.analyzer.AnalyzerContext, org.wsi.test.profile.ProfileArtifact, org.wsi.test.report.ReportArtifact, org.wsi.test.analyzer.config.UDDIReference, org.wsi.test.report.Reporter)
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact profileArtifact,
+ ReportArtifact reportArtifact,
+ UDDIReference uddiReference,
+ Reporter reporter)
+ throws WSIException
+ {
+ // BaseValidatorImpl
+ super.init(analyzerContext, profileArtifact, reportArtifact, reporter);
+
+ // Save input references
+ this.uddiReference = uddiReference;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.UDDIValidator#validate()
+ */
+ public String validate() throws WSIException
+ {
+ String wsdlURL = null;
+ Entry entry = null;
+
+ BindingTemplate bindingTemplate = null;
+ TModel tModel = null;
+
+ // it depricated after refactoring
+ // now the inner classes moved out from validator
+ //String classPrefix = this.getClass().getName() + "$";
+ String classPrefix = this.getClass().getPackage().getName()+".";
+
+ try
+ {
+ // Set up a reference to the UDDI registry
+ uddiProxy = new UDDIProxy();
+
+ //new Socket(new InetAddress(uddiReference.getInquiryURL()));
+ uddiProxy.setInquiryURL(uddiReference.getInquiryURL());
+ boolean wasEx = false;
+ InputStream stream;
+ try
+ {
+ URL url = StringUtils.getURL(null, uddiReference.getInquiryURL());
+ stream = url.openStream();
+ stream.close();
+ }
+
+ catch (UnknownHostException ex)
+ {
+ wasEx = true;
+ }
+
+ catch (IOException ex)
+ {
+ }
+
+ if (!wasEx)
+ {
+
+ // If the UDDI reference is to a bindingTemplate then get it
+ if (uddiReference.getKeyType().equals(UDDIReference.BINDING_KEY))
+ {
+ // Get binding detail which will contain the bindingTemplate
+ BindingDetail bindingDetail =
+ uddiProxy.get_bindingDetail(uddiReference.getKey());
+
+ // Get bindingTemplate
+ bindingTemplate =
+ (BindingTemplate) bindingDetail
+ .getBindingTemplateVector()
+ .elementAt(
+ 0);
+
+ if (verboseOption)
+ {
+ System.err.println(
+ " BindingTemplate - "
+ + UDDIUtils.bindingTemplateToString(bindingTemplate));
+ }
+
+ // Get the wsdlSpec tModel
+ tModel = findTModel(uddiProxy, bindingTemplate);
+ }
+
+ // Else it has to be a tModel
+ else
+ {
+ TModelDetail tModelDetail =
+ uddiProxy.get_tModelDetail(uddiReference.getKey());
+ tModel = (TModel) tModelDetail.getTModelVector().elementAt(0);
+ }
+
+ if (verboseOption)
+ {
+ System.err.println(
+ " TModel specified or found in bindingTemplate - "
+ + UDDIUtils.tModelToString(tModel));
+ }
+ }
+
+ if (bindingTemplate == null)
+ {
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DISCOVERY_BINDINGTEMPLATE));
+ }
+
+ // If there is a bindingTemplate, then process test assertions for it
+ else
+ {
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DISCOVERY_BINDINGTEMPLATE));
+ entry.setReferenceID(bindingTemplate.getBindingKey());
+ entry.setEntryDetail(bindingTemplate);
+
+ // Process test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, this.analyzerContext));
+ }
+
+ // NOTE: From this point forward, if a bindingTemplate does NOT have a wsdlSpec tModel,
+ // the tModel will be NULL.
+
+ //Parse WSDL document, and get WSDL document url, binding name and namespace
+ try
+ {
+ String overviewURL = getOverviewURL(tModel);
+ wsdlURL = getWSDLLocation(overviewURL);
+ WSDLDocument wsdlDocument = getWSDLDocument(wsdlURL);
+
+ // ADD: The WSDL binding is used in WSI3001 and should be moved to the entryContext
+ binding = getBinding(overviewURL, wsdlDocument);
+ }
+
+ catch (Exception e)
+ {
+ // ADD:
+ if (verboseOption)
+ {
+ System.err.println(" EXCEPTION: " + e.toString());
+ }
+ }
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DISCOVERY_TMODEL));
+ entry.setReferenceID(
+ (tModel == null ? "[tModel]" : tModel.getTModelKey()));
+ entry.setEntryDetail(tModel);
+
+ // Process test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, this.analyzerContext));
+ }
+
+ catch (Exception e)
+ {
+ // Throw WSIException
+ if (e instanceof WSIException)
+ throw (WSIException) e;
+ else
+ throw new WSIException(
+ "An exception occurred while processing the discovery test assertions.",
+ e);
+ }
+
+ // Cleanup
+ cleanup();
+
+ // Get WSDL location
+ wsdlURL = this.analyzerContext.getServiceReference().getWSDLLocation();
+
+ // Return WSDL URL
+ return wsdlURL;
+ }
+
+ /**
+ * Set WSDL binding in the service reference portion of the analyzer context.
+ */
+ protected void setWSDLBinding(Binding binding)
+ {
+ String bindingName =
+ binding == null ? null : binding.getQName().getLocalPart();
+ String namespace =
+ binding == null ? null : binding.getQName().getNamespaceURI();
+
+ // Set the WSDL document location in analyzerContext
+ ServiceReference serviceReference =
+ this.analyzerContext.getServiceReference();
+
+ // If the wsdlElement does not exist, then set it
+ WSDLElement wsdlElement;
+ if ((wsdlElement = serviceReference.getWSDLElement()) == null)
+ {
+ // Get the WSDL binding from the overviewURL and set in analyzerContext
+ wsdlElement = new WSDLElementImpl();
+ wsdlElement.setName(bindingName);
+ wsdlElement.setNamespace(namespace);
+ wsdlElement.setType(EntryType.TYPE_DESCRIPTION_BINDING);
+ }
+
+ // Set the wsdlElement in the service reference
+ serviceReference.setWSDLElement(wsdlElement);
+
+ // Set the service reference back into the analyzerContext
+ analyzerContext.setServiceReference(serviceReference);
+ }
+
+ /**
+ * Set the WSDL location in the service reference portion of the analyzer context.
+ */
+ protected void setWSDLLocation(String wsdlURL)
+ {
+ // Set the WSDL document location in analyzerContext
+ ServiceReference serviceReference =
+ this.analyzerContext.getServiceReference();
+ serviceReference.setWSDLLocation(wsdlURL);
+
+ // Set the service reference back into the analyzerContext
+ analyzerContext.setServiceReference(serviceReference);
+ }
+
+ /**
+ * Find the wsdlSpec tModel associated with a binding.
+ */
+ private TModel findTModel(
+ UDDIProxy uddiProxy,
+ BindingTemplate bindingTemplate)
+ throws WSIException
+ {
+ TModel tModel = null;
+
+ // Get the list of tModel references associated with this bindingTemplate
+ Iterator iterator =
+ bindingTemplate
+ .getTModelInstanceDetails()
+ .getTModelInstanceInfoVector()
+ .iterator();
+
+ // Process each tModel reference
+ Vector tModelKeyList = new Vector();
+ while (iterator.hasNext())
+ {
+ // Get tModelInstanceInfo
+ TModelInstanceInfo tModelInstanceInfo =
+ (TModelInstanceInfo) iterator.next();
+
+ // Add key to list
+ tModelKeyList.add(tModelInstanceInfo.getTModelKey());
+ }
+
+ // Get the tModels associated with the bindingTemplate
+ if (tModelKeyList.size() > 0)
+ {
+ try
+ {
+ // Get the tModel details
+ TModelDetail tModelDetail = uddiProxy.get_tModelDetail(tModelKeyList);
+
+ // Get the list of tModels
+ Iterator tModelIterator = tModelDetail.getTModelVector().iterator();
+
+ //boolean tModelFound = false;
+ TModel nextTModel = null;
+
+ // Go through the list of tModels
+ while ((tModelIterator.hasNext()) && (tModel == null))
+ {
+ // Get next tModel in list
+ nextTModel = (TModel) tModelIterator.next();
+
+ if (verboseOption)
+ {
+ System.err.println(
+ " TModel referenced from bindingTemplate - "
+ + UDDIUtils.tModelToString(nextTModel));
+ }
+
+ // If this is a wsdlSpec tModel, then this is the tModel we want
+ if (isWsdlSpec(nextTModel))
+ tModel = nextTModel;
+ }
+ }
+
+ catch (Exception e)
+ {
+ // Throw WSIException
+ throw new WSIException("Could not get tModel details.", e);
+ }
+ }
+
+ else
+ {
+ // Throw exception
+ //throw new WSIException("UDDI bindingTemplate did not contain any tModel references.");
+ }
+
+ return tModel;
+ }
+
+ /**
+ * Determine if this is a wsdlSpec tModel.
+ */
+ protected boolean isWsdlSpec(TModel tModel)
+ {
+ boolean tModelFound = false;
+ CategoryBag categoryBag = null;
+ Iterator categoryBagIterator = null;
+
+ // Determine if the catetgoryBag contains wsdlSpec
+ if ((categoryBag = tModel.getCategoryBag()) != null)
+ {
+ // Get the list of keyed references
+ categoryBagIterator = categoryBag.getKeyedReferenceVector().iterator();
+
+ KeyedReference keyedReference = null;
+
+ // Go through the list of keyed references
+ while (categoryBagIterator.hasNext() && !(tModelFound))
+ {
+ // Get next keyed reference
+ keyedReference = (KeyedReference) categoryBagIterator.next();
+
+ // If this is a types taxonomy tModel and the value is wsdlSpec, then this is the tModel we want
+ // REMOVE: It is not necessary to check the key name
+ //if (keyedReference.getTModelKey().equalsIgnoreCase(TModel.TYPES_TMODEL_KEY) &&
+ // "wsdlSpec".equals(keyedReference.getKeyValue()) &&
+ // ("types".equals(keyedReference.getKeyName()) ||
+ // "uddi-org:types".equals(keyedReference.getKeyName()))) {
+ // tModelFound = true;
+ //}
+ if (keyedReference
+ .getTModelKey()
+ .equalsIgnoreCase(TModel.TYPES_TMODEL_KEY)
+ && "wsdlSpec".equals(keyedReference.getKeyValue()))
+ {
+ tModelFound = true;
+ }
+ }
+ }
+
+ return tModelFound;
+ }
+
+ /**
+ * Get an OverviewURL from tModel.
+ */
+ protected String getOverviewURL(TModel tModel)
+ {
+ if (tModel != null
+ && tModel.getOverviewDoc() != null
+ && tModel.getOverviewDoc().getOverviewURL() != null)
+ {
+ return tModel.getOverviewDoc().getOverviewURL().getText();
+ }
+ return null;
+ }
+
+ /**
+ * Get WSDL document.
+ */
+ protected String getWSDLLocation(String wsdlLocation)
+ {
+ int index;
+
+ // Check if the overviewURL contains a fragment identifier
+ if ((index = wsdlLocation.indexOf("#")) > -1)
+ {
+ wsdlLocation = wsdlLocation.substring(0, index);
+ }
+ return wsdlLocation;
+ }
+
+ /**
+ * Get WSDL document.
+ */
+ protected WSDLDocument getWSDLDocument(String wsdlLocation)
+ throws MalformedURLException, WSDLException
+ {
+ return new WSDLDocument(getWSDLLocation(wsdlLocation));
+ }
+
+ /**
+ * Get WSDL binding from the overviewURL in the tModel.
+ */
+ protected Binding getBinding(String overviewURL, WSDLDocument wsdlDocument)
+ {
+ int index;
+ int nameIndex;
+
+ Binding[] bindings = wsdlDocument.getBindings();
+ if (bindings == null || bindings.length == 0)
+ return null;
+
+ if (overviewURL != null)
+ {
+ // Check if the overviewURL contains a fragment identifier
+ if ((index = overviewURL.indexOf("#")) > -1)
+ {
+ // TEMP: Need to use a real XPath evaluator like Xalan
+ String nameAttribute = "@name=";
+
+ // Locate name reference
+ if ((nameIndex =
+ overviewURL.substring(index + 1).indexOf(nameAttribute))
+ > -1)
+ {
+ // Get the next character which should be a quote
+ int firstQuoteIndex = index + 1 + nameIndex + nameAttribute.length();
+ String quote =
+ overviewURL.substring(firstQuoteIndex, firstQuoteIndex + 1);
+
+ // Get the part of the URL which should contain the binding name
+ String urlPart = overviewURL.substring(firstQuoteIndex + 1);
+
+ // Find the next quote
+ int nextQuoteIndex;
+ if ((nextQuoteIndex = urlPart.indexOf(quote)) > -1)
+ {
+ String bindingName = urlPart.substring(0, nextQuoteIndex);
+ //look for binding with the specified name
+ for (int i = 0; i < bindings.length; i++)
+ {
+ if (bindingName.equals(bindings[i].getQName().getLocalPart()))
+ return bindings[i];
+ }
+ }
+ }
+ }
+ }
+
+ return bindings[0];
+ }
+
+ /**
+ * Get string representation of categoryBag.
+ * @param categoryBag a CategoryBag object.
+ * @return string representation of categoryBag.
+ */
+ protected String categoryBagToString(CategoryBag categoryBag)
+ {
+ String toString = "";
+
+ if (categoryBag != null)
+ {
+ Vector keyedReferenceList = null;
+ if (((keyedReferenceList = categoryBag.getKeyedReferenceVector())
+ == null)
+ || (keyedReferenceList.size() == 0))
+ {
+ toString += "No KeyedReferences";
+ }
+
+ else
+ {
+ int count = 1;
+ KeyedReference keyedReference;
+ Iterator iterator = keyedReferenceList.iterator();
+ while (iterator.hasNext())
+ {
+ keyedReference = (KeyedReference) iterator.next();
+ toString += "\n ["
+ + count++
+ + "] tModelKey: "
+ + keyedReference.getTModelKey()
+ + ", keyName: "
+ + keyedReference.getKeyName()
+ + ", keyValue: "
+ + keyedReference.getKeyValue();
+ }
+ }
+ }
+ else
+ {
+ toString = "null";
+ }
+
+ return toString;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isPrimaryEntryTypeMatch(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ protected boolean isPrimaryEntryTypeMatch(
+ TestAssertion testAssertion,
+ EntryContext targetContext)
+ {
+ boolean match = false;
+
+ // If the test assertion entry type matches the target context entry type, then contine
+ if (testAssertion
+ .getEntryTypeName()
+ .equals(targetContext.getEntry().getEntryType().getTypeName()))
+ {
+ match = true;
+ }
+
+ return match;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isNotApplicable(org.wsi.test.profile.TestAssertion)
+ */
+ protected boolean isNotApplicable(TestAssertion testAssertion)
+ {
+ boolean notApplicable = false;
+
+ // ADD:
+
+ return notApplicable;
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3001.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3001.java
new file mode 100644
index 000000000..e259842ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3001.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+/**
+ * WSI3001
+ */
+public class WSI3001 extends BP3001
+{
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3001(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3002.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3002.java
new file mode 100644
index 000000000..4f464684c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3002.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+/**
+ * WSI3002
+ */
+public class WSI3002 extends BP3002
+{
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3002(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3003.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3003.java
new file mode 100644
index 000000000..18c8624c4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3003.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+/**
+ * WSI3003
+ */
+public class WSI3003 extends BP3003
+{
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3003(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3004.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3004.java
new file mode 100644
index 000000000..3aa3c350a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3004.java
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Port;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.UDDIUtils;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.uddi4j.datatype.tmodel.TModel;
+import org.uddi4j.util.CategoryBag;
+import org.uddi4j.util.KeyedReference;
+import org.w3c.dom.Element;
+
+
+/**
+ * WSI3004 - The conformance claims in the uddi:tModel are the same
+ * as those in the wsdl:binding which is referenced by the uddi:tModel.
+ */
+public class WSI3004 extends AssertionProcessVisitor implements WSITag
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3004(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private static final String PORTS_PARAM = "ports";
+ private static final String BINDING_PARAM = "binding";
+
+ /**
+ * Gets WSI conformance claims from a tModel.
+ * @param tModel
+ * @return HashSet
+ * @throws WSIException
+ */
+ private HashSet getConformanceClaimsFromUDDI(TModel tModel)
+ throws WSIException
+ {
+ String conformanceKey = UDDIUtils.getWSIConformanceTModelKey(validator.uddiProxy);
+
+ HashSet result = new HashSet();
+
+ CategoryBag bag = tModel.getCategoryBag();
+ if (bag != null)
+ {
+ Vector references = bag.getKeyedReferenceVector();
+ for (int i = 0; i < references.size(); i++)
+ {
+ KeyedReference ref = (KeyedReference) references.get(i);
+
+ if (ref.getTModelKey().equalsIgnoreCase(conformanceKey))
+ {
+ result.add(ref.getKeyValue());
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets WSI conformance claims from WSDL binding
+ * that references specified tModel. Additionally,
+ * WSDL ports, which uses the binding, are processed.
+ *
+ * @param tModel
+ * @return HashSet
+ */
+ private HashSet getConformanceClaimsFromWSDL(TModel tModel)
+ {
+ HashSet result = new HashSet();
+
+ try
+ {
+ // Read the WSDL document
+ String overviewURL = validator.getOverviewURL(tModel);
+ WSDLDocument wsdlDocument = validator.getWSDLDocument(overviewURL);
+
+ // Get binding
+ Binding binding = validator.getBinding(overviewURL, wsdlDocument);
+ String bindingName = binding.getQName().getLocalPart();
+
+ // Get claims
+ result =
+ getClaimsFromElement(binding.getDocumentationElement(), result);
+
+ // Get ports, which reference this binding, because:
+ // "A claim on a wsdl:port is inherited by the referenced wsdl:bindings."
+ Vector ports = getPorts(wsdlDocument, bindingName);
+ for (int i = 0; i < ports.size(); i++)
+ {
+ Port port = (Port) ports.get(i);
+
+ result = getClaimsFromElement(port.getDocumentationElement(), result);
+ }
+ }
+ catch (Exception e)
+ {
+ // ADD:
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets WSI conformance claims from the 'documentation' XML element
+ * and puts them into the HashSet.
+ * @param docElement
+ * @param result
+ * @return HashSet
+ */
+ private HashSet getClaimsFromElement(Element docElement, HashSet result)
+ {
+ if (result == null)
+ {
+ result = new HashSet();
+ }
+
+ if (docElement != null)
+ {
+ Element claimElement = XMLUtils.findChildElement(docElement, WSI_CLAIM);
+ while (claimElement != null)
+ {
+ /*
+ Node attr = XMLUtils.getAttribute(claimElement, ATTR_CLAIM_CONFORMSTO);
+ if (attr != null)
+ result.add(attr.getNodeValue());
+ */
+ String value =
+ claimElement.getAttribute(ATTR_CLAIM_CONFORMSTO.getLocalPart());
+ if (value != null)
+ result.add(value);
+
+ claimElement = XMLUtils.findElement(claimElement, WSI_CLAIM);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets wsdl:ports, which use specified binding.
+ * @param wsdlDocument
+ * @param bindingName
+ * @return Vector
+ */
+ private Vector getPorts(WSDLDocument wsdlDocument, String bindingName)
+ {
+ Vector ports = new Vector();
+
+ Map params = new HashMap();
+ params.put(PORTS_PARAM, ports);
+ params.put(BINDING_PARAM, bindingName);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitPort(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse(wsdlDocument.getDefinitions(), params);
+
+ return ports;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port
+ .getBinding()
+ .getQName()
+ .getLocalPart()
+ .equals(ctx.getParameter(BINDING_PARAM).toString()))
+ {
+ ((Vector) ctx.getParameter(PORTS_PARAM)).add(port);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the tModel from the entryContext
+ TModel tModel = (TModel) entryContext.getEntry().getEntryDetail();
+
+ // If the tModel does not exist, then fail
+ if (tModel == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = "Could not locate a tModel.";
+ }
+
+ // If there is a tModel
+ else
+ {
+ try
+ {
+ HashSet claimsFromUDDI = getConformanceClaimsFromUDDI(tModel);
+ HashSet claimsFromWSDL = getConformanceClaimsFromWSDL(tModel);
+
+ if (claimsFromUDDI.size() == 0)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else if (claimsFromUDDI.size() == claimsFromWSDL.size())
+ {
+ int counter = 0;
+ for (Iterator iter = claimsFromWSDL.iterator(); iter.hasNext();)
+ {
+ String claim = (String) iter.next();
+
+ for (Iterator iter2 = claimsFromUDDI.iterator();
+ iter2.hasNext();
+ )
+ {
+ String uddiClaim = (String) iter2.next();
+ if (claim.equalsIgnoreCase(uddiClaim))
+ {
+ counter++;
+ break;
+ }
+ }
+ }
+
+ if (counter != claimsFromWSDL.size())
+ {
+ // failed
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The tModel key is: [" + tModel.getTModelKey() + "].";
+ }
+ }
+ else
+ {
+ // failed
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The tModel key is: [" + tModel.getTModelKey() + "].";
+ }
+ }
+ catch (IllegalStateException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The tModel key is: [" + tModel.getTModelKey() + "].";
+ }
+
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3005_OBSOLETE.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3005_OBSOLETE.java
new file mode 100644
index 000000000..2a76f5318
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3005_OBSOLETE.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.UDDIUtils;
+import org.uddi4j.client.UDDIProxy;
+import org.uddi4j.datatype.tmodel.TModel;
+import org.uddi4j.util.CategoryBag;
+import org.uddi4j.util.KeyedReference;
+
+
+/**
+ * WSI3005_OBSOLETE - A uddi:tModel which claims conformance with a WS-I profile
+ * must be categorized using the ws-i-org:conformsTo taxonomy.
+ */
+public class WSI3005_OBSOLETE extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3005_OBSOLETE(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the tModel from the entryContext
+ TModel tModel = (TModel) entryContext.getEntry().getEntryDetail();
+
+ // If the tModel does not exist, then fail
+ if (tModel == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = "Could not locate a tModel.";
+ }
+
+ // If there is a tModel
+ else
+ {
+ CategoryBag bag = tModel.getCategoryBag();
+
+ try
+ {
+ if (!checkCategoryBag(this.validator.uddiProxy, bag))
+ {
+ // failed
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The tModel key is: [" + tModel.getTModelKey() + "].";
+ }
+ }
+ catch (IllegalStateException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The UDDI registry does not contain WSI conformance taxonomy"
+ + " tModel (\"ws-i-org:conformsTo:2002_12\").";
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+
+ /**
+ * Checks a category bag.
+ * @param proxy
+ * @param bag
+ * @return boolean
+ */
+ private boolean checkCategoryBag(UDDIProxy proxy, CategoryBag bag)
+ {
+ String conformanceKey = UDDIUtils.getWSIConformanceTModelKey(proxy);
+
+ boolean result = false;
+
+ if (bag != null)
+ {
+ Vector references = bag.getKeyedReferenceVector();
+ for (int i = 0; i < references.size() && !result; i++)
+ {
+ KeyedReference ref = (KeyedReference) references.get(i);
+
+ result = ref.getTModelKey().equalsIgnoreCase(conformanceKey);
+ }
+ }
+
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3006.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3006.java
new file mode 100644
index 000000000..66e334379
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3006.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionResultException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.UDDIUtils;
+import org.uddi4j.client.UDDIProxy;
+import org.uddi4j.datatype.tmodel.TModel;
+import org.uddi4j.util.CategoryBag;
+import org.uddi4j.util.KeyedReference;
+
+
+/**
+ * WSI3006 - The uddi:tModel uses the ws-i-org:conformsTo:2002_12 categorization
+ * value of "http://ws-i.org/profiles/base/1.0". The categoryBag in the tModel
+ * contains a keyedReference with a tModelKey that contains the key value
+ * uuid:65719168-72c6-3f29-8c20-62defb0961c0 for the ws-i-org:conformsTo:2002_12
+ * tModel.
+ */
+public class WSI3006 extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3006(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+ failureDetailMessage = null;
+ KeyedReference claimKeyedRef = null;
+
+ // check whether a UDDI conformance claim is being made...
+
+ // Get the tModel from the entryContext
+ TModel tModel = (TModel) entryContext.getEntry().getEntryDetail();
+ try
+ {
+ if ((claimKeyedRef = conformanceClaimMade(tModel)) == null)
+ {
+ throw new AssertionResultException(
+ AssertionResult.RESULT_NOT_APPLICABLE);
+ }
+
+ // we have a conformance claim, so check the keyedReference keyValue
+ if (!claimKeyedRef
+ .getKeyValue()
+ .equals(WSIConstants.ATTRVAL_UDDI_CLAIM_KEYVALUE))
+ {
+ throw new AssertionResultException(
+ AssertionResult.RESULT_FAILED,
+ "The tModel key is: ["
+ + tModel.getTModelKey()
+ + "].\nThe categoryBag is: ["
+ + tModel.getCategoryBag()
+ + "].");
+ }
+ }
+ catch (AssertionResultException e)
+ {
+ result = e.getMessage();
+ failureDetailMessage = e.getDetailMessage();
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+
+ /**
+ * Checks a category bag and extracts KeyedReference containing
+ * the conformance claim.
+ * @param proxy
+ * @param bag
+ * @return boolean
+ */
+ private KeyedReference checkCategoryBag(UDDIProxy proxy, CategoryBag bag)
+ {
+ String conformanceKey = null;
+ try
+ {
+ conformanceKey = UDDIUtils.getWSIConformanceTModelKey(proxy);
+ }
+ catch (IllegalStateException ex)
+ {
+ return null;
+ }
+
+ boolean result = true;
+ KeyedReference conformanceRef = null;
+
+ if (bag != null)
+ {
+ Vector references = bag.getKeyedReferenceVector();
+ for (int i = 0; i < references.size() && result; i++)
+ {
+ KeyedReference ref = (KeyedReference) references.get(i);
+
+ if (ref
+ .getTModelKey()
+ .equalsIgnoreCase(conformanceKey) //&& ref.getKeyValue().equals(WSIConstants.ATTRVAL_UDDI_CLAIM_KEYVALUE)
+ // we need only tModel key
+ )
+ {
+ result = true;
+ conformanceRef = ref;
+ }
+ }
+ }
+
+ return conformanceRef;
+ }
+ /**
+ * Gets KeyedReference containing the conformance claim.
+ * @param tModel
+ * @return
+ * @throws WSIException
+ */
+ private KeyedReference conformanceClaimMade(TModel tModel)
+ throws WSIException
+ {
+
+ // If the tModel does not exist, then fail
+ if (tModel == null)
+ {
+ throw new IllegalArgumentException("tModel cannot be null");
+ }
+
+ // If there is a tModel
+ else
+ {
+ CategoryBag bag = tModel.getCategoryBag();
+ return checkCategoryBag(this.validator.uddiProxy, bag);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3007.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3007.java
new file mode 100644
index 000000000..fbd6c7fcd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3007.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.UDDIUtils;
+import org.uddi4j.client.UDDIProxy;
+import org.uddi4j.datatype.binding.BindingTemplate;
+import org.uddi4j.datatype.business.BusinessEntity;
+import org.uddi4j.datatype.service.BusinessService;
+import org.uddi4j.util.CategoryBag;
+import org.uddi4j.util.KeyedReference;
+
+
+/**
+ * WSI3007 - A uddi:businessEntity or uddi:businessService associated
+ * with this uddi:bindingTemplate is not categorized using
+ * the ws-i-org:conformsTo:2002_12 taxonomy.
+ */
+public class WSI3007 extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3007(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ String serviceLocation = null;
+
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the bindingTemplate from the entryContext
+ BindingTemplate bindingTemplate =
+ (BindingTemplate) entryContext.getEntry().getEntryDetail();
+
+ boolean validService = false;
+ boolean validBusiness = false;
+
+ String serviceKey = null;
+ String businessKey = null;
+ try
+ {
+ serviceKey = bindingTemplate.getServiceKey();
+ BusinessService service =
+ UDDIUtils.getBusinessServiceByKey(this.validator.uddiProxy, serviceKey);
+
+ businessKey = service.getBusinessKey();
+ BusinessEntity business =
+ UDDIUtils.getBusinessByKey(this.validator.uddiProxy, businessKey);
+
+ validService = checkCategoryBag(this.validator.uddiProxy, service.getCategoryBag());
+ validBusiness = checkCategoryBag(this.validator.uddiProxy, business.getCategoryBag());
+
+ if (!validBusiness || !validService)
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ if (!validBusiness)
+ {
+ failureDetailMessage =
+ "The businessEntity key is: [" + businessKey + "].";
+ }
+
+ if (!validService)
+ {
+ if (!validBusiness)
+ failureDetailMessage += " ";
+ else
+ failureDetailMessage = "";
+
+ failureDetailMessage += "The businessService key is: ["
+ + serviceKey
+ + "].";
+ }
+ }
+ }
+ catch (IllegalStateException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "The UDDI registry does not contain WSI conformance taxonomy"
+ + " tModel (\"ws-i-org:conformsTo:2002_12\").";
+ }
+ catch (Throwable e)
+ {
+ throw new WSIException(
+ "An exception occurred while processing the discovery test assertions.",
+ e);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+
+ /**
+ * Checks whether the category bag contains the conformance claim.
+ * Returns <b>true</b> if the bag does not contain the conformance claim.
+ * @param proxy
+ * @param bag
+ * @return boolean
+ */
+ private boolean checkCategoryBag(UDDIProxy proxy, CategoryBag bag)
+ {
+ String conformanceKey = null;
+ try
+ {
+ conformanceKey = UDDIUtils.getWSIConformanceTModelKey(proxy);
+ }
+ catch (IllegalStateException ex)
+ {
+ return false;
+ }
+
+ boolean result = true;
+
+ if (bag != null)
+ {
+ Vector references = bag.getKeyedReferenceVector();
+ for (int i = 0; i < references.size() && result; i++)
+ {
+ KeyedReference ref = (KeyedReference) references.get(i);
+
+ result = !ref.getTModelKey().equalsIgnoreCase(conformanceKey);
+ }
+ }
+
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3021.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3021.java
new file mode 100644
index 000000000..56e2befa7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/uddi/WSI3021.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.uddi;
+
+import java.util.Vector;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.UDDIUtils;
+import org.uddi4j.datatype.tmodel.TModel;
+import org.uddi4j.util.CategoryBag;
+import org.uddi4j.util.KeyedReference;
+
+
+/**
+* WSI3021 - The uddi:tModel has a "name" element of value "ws-i-org:conformsTo:2002_12" ,
+* has an overviewURL value of "http://ws-i.org/schemas/conformanceClaim/", and has
+* a keyedReference element with keyName attribute value of "uddi-org:types:categorization".
+*/
+public class WSI3021 extends AssertionProcess
+{
+ private final UDDIValidatorImpl validator;
+
+ /**
+ * @param UDDIValidatorImpl
+ */
+ public WSI3021(UDDIValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ TModel tModel =
+ UDDIUtils.getTModelByKey(
+ this.validator.uddiProxy,
+ UDDIUtils.getWSIConformanceTModelKey(this.validator.uddiProxy));
+
+ // If the tModel does not exist, then fail
+ if (tModel == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = "Could not locate a tModel.";
+ }
+ else
+ {
+ boolean validURL =
+ tModel.getOverviewDoc() != null
+ && "http://ws-i.org/schemas/conformanceClaim/".equals(
+ tModel.getOverviewDoc().getOverviewURLString());
+ boolean validCategory = checkCategoryBag(tModel.getCategoryBag());
+
+ if (validURL && validCategory)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = this.validator.uddiReference.getInquiryURL();
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailMessage);
+ }
+
+ /**
+ * Checks whether the category bag meets the WSI's requirements.
+ * @param bag
+ * @return
+ */
+ private boolean checkCategoryBag(CategoryBag bag)
+ {
+ boolean result = false;
+
+ if (bag != null)
+ {
+ Vector references = bag.getKeyedReferenceVector();
+ for (int i = 0; i < references.size() && !result; i++)
+ {
+ KeyedReference ref = (KeyedReference) references.get(i);
+
+ result =
+ "uddi-org:types:categorization".equals(ref.getKeyName())
+ && "categorization".equals(ref.getKeyValue())
+ && "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4".equals(
+ ref.getTModelKey());
+ }
+ }
+
+ return result;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2901.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2901.java
new file mode 100644
index 000000000..3a09c9107
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2901.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2901
+ *
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>A description uses either the WSDL MIME Binding as described in WSDL 1.1 Section 5
+ * or WSDL SOAP binding as described in WSDL 1.1 Section 3
+ * on each of the wsdl:input or wsdl:output elements of a wsdl:binding. </assertionDescription>
+ */
+public class AP2901 extends AssertionProcess implements WSITag
+{
+ /**
+ * WSDLValidator
+ */
+ private final WSDLValidatorImpl validator;
+
+ private Collection mimeElements;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2901(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+
+ mimeElements = new HashSet();
+ mimeElements.add(WSDL_MIME_CONTENT);
+ mimeElements.add(WSDL_MIME_XML);
+ mimeElements.add(WSDL_MIME_MULTIPART);
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ QName inapplicableElement = null;
+ // Getting an inapplicable extensibility element of wsdl:input
+ // If such element exists, the assertion failed
+ if (bindingInput != null)
+ {
+ // Getting an inapplicable extensibility element of wsdl:input
+ // If such element exists, the assertion failed
+ inapplicableElement = getInapplicableElement(bindingInput.getExtensibilityElements());
+
+ if (inapplicableElement != null)
+ throw new AssertionFailException(inapplicableElement.toString());
+ }
+
+ // Getting an inapplicable extensibility element of wsdl:output
+ // If such element exists, the assertion failed
+ if (bindingOutput != null)
+ {
+ inapplicableElement =
+ getInapplicableElement(bindingOutput.getExtensibilityElements());
+ if (inapplicableElement != null)
+ throw new AssertionFailException(inapplicableElement.toString());
+ }
+ }
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for any extensibility element of wsdl:input or wsdl:output
+ * that does not conform to the SOAP binding or the MIME binding.
+ * @param extElems a list of extensibility elements
+ * @return the QName of an inapplicable element
+ */
+ private QName getInapplicableElement(List extElems)
+ {
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ QName elementName =
+ ((ExtensibilityElement) extElems.get(i)).getElementType();
+
+ if (!mimeElements.contains(elementName) &&
+ !elementName.equals(WSDL_SOAP_BODY) &&
+ !elementName.equals(WSDL_SOAP_HEADER))
+ {
+ return elementName;
+ }
+ }
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2903.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2903.java
new file mode 100644
index 000000000..a64d434e8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2903.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2903
+ *
+ * <context>For a candidate wsdl:binding with at least one mime:content element</context>
+ * <assertionDescription>The part attribute of each mime:content element in a wsdl:binding references
+ * a wsdl:part element of a wsdl:message that is present in the respective wsdl:input or wsdl:output of the
+ * corresponding wsdl:operation of the corresponding wsdl:portType.</assertionDescription>
+ */
+public class AP2903 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2903(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:content element
+ boolean mimeContentsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ // If there is no the corresponding wsdl:input in wsdl:portType,
+ // the assertion failed
+ if (portTypeInput == null)
+ throw new AssertionFailException(
+ "There is no the corresponging wsdl:input in the wsdl:portType"
+ + " operation for the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+
+ // If the wsdl:portType input does not reference any wsdl:message,
+ // the assertion failed
+ if (portTypeInput.getMessage() == null)
+ throw new AssertionFailException("The wsdl:input of the \""
+ + bindingOperation.getOperation().getName() + "\" wsdl:portType "
+ + "operation does not reference any wsdl:message.");
+
+ // Getting the part name that is not specified in the wsdl:message
+ // the input of wsdl:portType refers to
+ String part = getInvalidMimeContentPart(
+ inputMimeContents, portTypeInput.getMessage());
+
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the input of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If there is no the corresponding wsdl:input in wsdl:portType,
+ // the assertion failed
+ if (portTypeOutput == null)
+ throw new AssertionFailException(
+ "There is no the corresponging wsdl:output in the wsdl:portType"
+ + " operation for the wsdl:output of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+
+ // If the wsdl:portType output does not reference any wsdl:message,
+ // the assertion failed
+ if (portTypeOutput.getMessage() == null)
+ throw new AssertionFailException("The wsdl:output of the \""
+ + bindingOperation.getOperation().getName() + "\" wsdl:portType "
+ + "operation does not reference any wsdl:message.");
+
+ // Getting the part name that is not specified in the wsdl:message
+ // the output of wsdl:portType refers to
+ String part = getInvalidMimeContentPart(
+ outputMimeContents, portTypeOutput.getMessage());
+
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the output of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+ }
+
+ // If the binding contains no mime:content elements,
+ // the assertion is not applicable
+ if (!mimeContentsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Collects all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+
+ /**
+ * Returns part name specified in mime:content element that is not presented in wsdl:message
+ * @param mimeContents a list of mime:content elements which part attributes are validated
+ * @param message a wsdl:message
+ * @return a part name
+ */
+ private String getInvalidMimeContentPart(List mimeContents, Message message)
+ {
+ // Going throug all the mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ // Getting the part name of a mime:element
+ String part = ((MIMEContent) mimeContents.get(i)).getPart();
+ // If the wsdl:message does not contain such part, return the part
+ if (!message.getParts().keySet().contains(part))
+ return part;
+ }
+ // Return null if no one part is found
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2904.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2904.java
new file mode 100644
index 000000000..17ccb7452
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2904.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2904
+ * <context>For a candidate wsdl:binding with at least one mime:content element</context>
+ * <assertionDescription>The part attribute of each mime:content element in a wsdl:binding
+ * does not reference a sub-component of a wsdl:part of the wsdl:message that is present in the
+ * respective wsdl:input or wsdl:output of the corresponding wsdl:operation of the corresponding
+ * wsdl:portType.</assertionDescription>
+ */
+public class AP2904 extends AP2903
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2904(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Return assertion result
+ return super.validate(testAssertion, entryContext);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2906.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2906.java
new file mode 100644
index 000000000..88d6e8422
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2906.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2906
+ *
+ * <context>For a candidate wsdl:binding containing a mime:multipartRelated element</context>
+ * <assertionDescription>A non-root MIME part in a wsdl:binding does not contain a soapbind:header element.</assertionDescription>
+ */
+public class AP2906 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2906(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:multipartRelated element
+ boolean multipartsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:multipartRelated elements from wsdl:input and wsdl:output
+ List inputMultiparts = getMimeMultipartElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMultiparts = getMimeMultipartElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:multipartRelated elements
+ if (!inputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a soap:header in the non-root mime:part,
+ // the assertion failed
+ if (containsInvalidMimePart(inputMultiparts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+ }
+
+ // If the wsdl:output contains mime:multipartRelated elements
+ if (!outputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a soap:header in the non-root mime:part,
+ // the assertion failed
+ if (containsInvalidMimePart(outputMultiparts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+ }
+ }
+ // If the binding contains no one mime:multipartRelated element,
+ // the assertion is not applicable
+ if (!multipartsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for such non-root mime:part element from a list of mime:multipartRelated elements
+ * that contains a soap:header element.
+ * @param multiparts a list of mime:multipartRelated elements
+ * @return true, if such element is found, false otherwise
+ */
+ private boolean containsInvalidMimePart(List multiparts)
+ {
+ // Going through a list of mime:multipartRelated elements
+ for (int i = 0; i < multiparts.size(); i++)
+ {
+ // Getting a list of mime:part elements
+ List mimeParts =
+ ((MIMEMultipartRelated) multiparts.get(i)).getMIMEParts();
+
+ // Looking for non-root mime:partS
+ if (mimeParts.size() > 1)
+ {
+ for (int j = 1; j < mimeParts.size(); j++)
+ {
+ // Getting a list of extensibility elements of a mime:part
+ List extElems =
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements();
+ // Going through the extensibility elements
+ for (int k = 0; k < extElems.size(); k++)
+ {
+ // If an extensibility element is a soap:header,
+ // return true
+ if (((ExtensibilityElement)extElems.get(k))
+ .getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ // return false, if the element is not found
+ return false;
+ }
+
+ /**
+ * Collects all mime:multipartRelated elements.
+ * @param extElems a list of extensibility elements that can contain mime:multipartRelated elements.
+ * @return the list of mime:multipartRelated elements found.
+ */
+ private List getMimeMultipartElements(List extElems)
+ {
+ List mimeMultipartElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Adding the element to the list being returned
+ mimeMultipartElements.add(extElem);
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:multipartRelated elements of this mime:part
+ List elems = getMimeMultipartElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeMultipartElements.addAll(elems);
+ }
+ }
+ }
+ }
+
+ return mimeMultipartElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2907.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2907.java
new file mode 100644
index 000000000..f0c7cb442
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2907.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2907
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>Each MIME part in a description is defined using
+ * an element with a local name of part in the namespace of the
+ * WSDL MIME Binding extension.</assertionDescription>
+ */
+public class AP2907 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2907(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2908.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2908.java
new file mode 100644
index 000000000..44916e4e7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2908.java
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * AP2908
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>The mime:part element in a DESCRIPTION does not have a name attribute.</assertionDescription>
+ */
+public class AP2908 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2908(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a wsdl:binding
+ Binding wsdlBinding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Since WSDL4J 1.4 ignores any attributes of mime:part, use Xerces 2.6.2 instead
+ Document doc = XMLUtils.parseXMLDocument(validator.wsdlURL);
+
+ // Finding the wsdl:binding element being processed
+ Element binding = getBindingElement(
+ doc.getDocumentElement(), wsdlBinding.getQName().getLocalPart());
+
+ List ops = getChildElements(binding, WSDL_OPERATION);
+
+ // A variable that indicates a binding contains at least one
+ // mime:multipartRelated element
+ boolean multipartsFound = false;
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ Element bindingOperation = (Element) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ Element bindingInput = getChildElement(bindingOperation, WSDL_INPUT);
+ Element bindingOutput = getChildElement(bindingOperation, WSDL_OUTPUT);
+
+ // Collecting all the mime:multipartRelated elements from wsdl:input and wsdl:output
+ List inputMultiparts = getMimeMultipartElements(bindingInput);
+ List outputMultiparts = getMimeMultipartElements(bindingOutput);
+
+ // If the wsdl:input contains mime:multipartRelated elements
+ if (!inputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a mime:part element containing a name attribute,
+ // the assertion failed
+ if (containsInvalidMimePart(inputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:part element is in the wsdl:input of the \""
+ + bindingOperation.getAttribute(WSIConstants.ATTR_NAME)
+ + "\" binding operation.");
+ }
+ }
+
+ // If the wsdl:output contains mime:multipartRelated elements
+ if (!outputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a mime:part element containing a name attribute,
+ // the assertion failed
+ if (containsInvalidMimePart(outputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:part element is in the wsdl:output of the \""
+ + bindingOperation.getAttribute(WSIConstants.ATTR_NAME)
+ + "\" binding operation.");
+ }
+ }
+ }
+ // If the binding contains no one mime:multipartRelated element,
+ // the assertion is not applicable
+ if (!multipartsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (IOException ioe)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Validates mime:part elements for each of mime:multipartRelated element.
+ * @param multiparts a list of mime:multipartRelated elements.
+ * @return true, if any mime:part contains a name attribute, false otherwise.
+ */
+ private boolean containsInvalidMimePart(List multiparts) {
+ // Going through a list of mime:multipartRelated elements
+ for (int i = 0; i < multiparts.size(); i++)
+ {
+ // Getting a list of mime:part elements
+ List mimeParts =
+ getChildElements((Element) multiparts.get(i), WSDL_MIME_PART);
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ Element mimePart = (Element) mimeParts.get(j);
+ // If the mime:part element contains a name attribute,
+ // return true
+ if (mimePart.getAttributeNode(WSIConstants.ATTR_NAME) != null)
+ {
+ return true;
+ }
+ }
+ }
+ // No one invalid mime:part element is found, return false
+ return false;
+ }
+
+ /**
+ * Collects all mime:multipartRelated elements.
+ * @param parent an element which the child elements are gathered from.
+ * @return the list of mime:multipartRelated elements found.
+ */
+ private List getMimeMultipartElements(Element parent)
+ {
+ List mimeMultipartElements = new ArrayList();
+ // If the parent is not null
+ if (parent != null)
+ {
+ // Getting the first parent's child
+ Element child = XMLUtils.getFirstChild(parent);
+ while (child != null)
+ {
+ // If the child is a mime:multipartRelated element
+ if (child.getNamespaceURI().equals(WSDL_MIME_MULTIPART.getNamespaceURI())
+ && child.getLocalName().equals(WSDL_MIME_MULTIPART.getLocalPart()))
+ {
+ // Adding the element to the list being returned
+ mimeMultipartElements.add(child);
+
+ // Getting mime:partS from the element
+ List mimeParts = getChildElements(child, WSDL_MIME_PART);
+ // Going through all the mime:part elements
+ for (int i = 0; i < mimeParts.size(); i++)
+ {
+ // Collecting all the mime:multipartRelated elements of this mime:part
+ List elems = getMimeMultipartElements((Element) mimeParts.get(i));
+ // Adding the elements to the list being returned
+ mimeMultipartElements.addAll(elems);
+ }
+ }
+ // Getting the next child
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+
+ return mimeMultipartElements;
+ }
+
+ /**
+ * Looks for an element's child element.
+ * @param parent a parent element.
+ * @param childName a qualified element name being found.
+ * @return an element or null if it is not found.
+ */
+ private Element getChildElement(Element parent, QName childName)
+ {
+ // Getting the first parent's child
+ Element child = XMLUtils.getFirstChild(parent);
+ while (child != null)
+ {
+ // If the child has the required qualified name
+ if (child.getNamespaceURI().equals(childName.getNamespaceURI())
+ && child.getLocalName().equals(childName.getLocalPart()))
+ {
+ // return the child
+ return child;
+ }
+ // Getting the next child
+ child = XMLUtils.getNextSibling(child);
+ }
+ return null;
+ }
+
+ /**
+ * Collects element's child elements.
+ * @param parent a parent element.
+ * @param childName a qualified element name being found.
+ * @return a list of elements found.
+ */
+ private List getChildElements(Element parent, QName childName)
+ {
+ List children = new ArrayList();
+ if (parent != null)
+ {
+ // Getting the first parent's child
+ Element child = XMLUtils.getFirstChild(parent);
+ while (child != null)
+ {
+ // If the child has the required qualified name
+ if (child.getNamespaceURI().equals(childName.getNamespaceURI())
+ && child.getLocalName().equals(childName.getLocalPart()))
+ {
+ // Adding the child to the list
+ children.add(child);
+ }
+ // Getting the next binding's child
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+ return children;
+ }
+
+ /**
+ * Looks for wsdl:binding element.
+ * @param definitions a wsdl:definitions element.
+ * @param bindingName a name of wsdl:binding element.
+ * @return a wsdl:binding element or null if it is not found.
+ */
+ private Element getBindingElement(Element definitions, String bindingName)
+ {
+ // Getting the first definitions' child
+ Element child = XMLUtils.getFirstChild(definitions);
+ while (child != null)
+ {
+ // If definitions' child is wsdl:binding element
+ // and is the same that is being processed by WSDLValidator
+ if (child.getNamespaceURI().equals(WSDL_BINDING.getNamespaceURI())
+ && child.getLocalName().equals(WSDL_BINDING.getLocalPart())
+ && child.getAttribute(WSIConstants.ATTR_NAME).equals(bindingName))
+ {
+ // return the wsdl:binding element
+ return child;
+ }
+ // Getting the next definitions' child
+ child = XMLUtils.getNextSibling(child);
+ }
+ // return null, is there is no such wsdl:binding
+ return null;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2909.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2909.java
new file mode 100644
index 000000000..b9cc4bab8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2909.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2909
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>Multiple mime:content child elements of a mime:part element
+ * in a desciption reference the same wsdl:part.</assertionDescription>
+ */
+public class AP2909 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ // A variable that indicates a binding contains
+ // multiple mime:content elements
+ private boolean multipleContentFound;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2909(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Resetting the variable
+ multipleContentFound = false;
+
+ try
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:part elements from wsdl:input and wsdl:output
+ List inputMimeParts = getMimeParts(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeParts = getMimeParts(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If there is a mime:part containing multiple mime:contentS
+ // which reference different wsdl:partS, the assertion failed
+ if (containsInvalidMimePart(inputMimeParts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+
+ // If there is a mime:part containing multiple mime:contentS
+ // which reference different wsdl:partS, the assertion failed
+ if (containsInvalidMimePart(outputMimeParts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+
+ }
+ // If the binding does not contain a mime:part with multiple
+ // mime:content elements, the assertion is not applicable
+ if (!multipleContentFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Validates mime:part elements.
+ * @param mimeParts a list of mime:part elements.
+ * @return true if multiple mime:contentS of a mime:part
+ * reference different wsdl:partS, false otherwise.
+ */
+ private boolean containsInvalidMimePart(List mimeParts)
+ {
+ // Going through a list of mime:part elements
+ for (int i = 0; i < mimeParts.size(); i++)
+ {
+ // A variable that indicates the mime:part contains
+ // at least one mime:content element
+ boolean mimeContentFound = false;
+ String mimeContentPart = null;
+
+ // Going through mime:part extensibility elements
+ List extElems = ((MIMEPart) mimeParts.get(i)).getExtensibilityElements();
+ for (int j = 0; j < extElems.size(); j++)
+ {
+ // If an extensibility element is mime:content
+ if (((ExtensibilityElement)extElems.get(j))
+ .getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ MIMEContent mimeContent = (MIMEContent) extElems.get(j);
+ // If a mime:content element was already found in this mime:part
+ if (mimeContentFound)
+ {
+ multipleContentFound = true;
+ // If a mime:content references other wsdl:part than the
+ // previous mime:content do, return true
+ if (mimeContent.getPart() == null
+ || !mimeContent.getPart().equals(mimeContentPart))
+ {
+ return true;
+ }
+ }
+ // This is the first mime:content element of mime:part
+ else
+ {
+ mimeContentFound = true;
+ mimeContentPart = mimeContent.getPart();
+ }
+ }
+ }
+ }
+ // There are no invalid mime:part elements, return false
+ return false;
+ }
+
+ /**
+ * Collects all mime:part elements.
+ * @param extElems a list of extensibility elements that can contain mime:part elements.
+ * @return the list of mime:part elements found.
+ */
+ private List getMimeParts(List extElems)
+ {
+ List mimeParts = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ mimeParts.addAll(mParts);
+ // Going through all the mime:part elements
+ for (int j = 0; j < mParts.size(); j++)
+ {
+ List elems = getMimeParts(
+ ((MIMEPart) mParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeParts.addAll(elems);
+ }
+ }
+ }
+ }
+ return mimeParts;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2910.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2910.java
new file mode 100644
index 000000000..4ce3a66b0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2910.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2910
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>A mime:content in a DESCRIPTION references
+ * a wsdl:part that is defined using either the type attribute
+ * or the element attribute.</assertionDescription>
+ */
+public class AP2910 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2910(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:content element
+ boolean mimeContentsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ // If there is no the corresponding wsdl:input in wsdl:portType
+ // or the wsdl:input does not specify a message attribute,
+ // the assertion failed
+ if (portTypeInput == null || portTypeInput.getMessage() == null)
+ throw new AssertionFailException(
+ "The corresponging operation in the wsdl:portType for the \""
+ + bindingOperation.getName() + "\" binding operation is invalid.");
+ // Getting a mime:content referencing an invalid wsdl:part
+ String part = getInvalidMimeContentPart(
+ inputMimeContents, portTypeInput.getMessage());
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the input of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If there is no the corresponding wsdl:output in wsdl:portType
+ // or the wsdl:output does not specify a message attribute,
+ // the assertion failed
+ if (portTypeOutput == null || portTypeOutput.getMessage() == null)
+ throw new AssertionFailException(
+ "The corresponging operation in the wsdl:portType for the \""
+ + bindingOperation.getName() + "\" binding operation is invalid.");
+ // Getting a mime:content referencing an invalid wsdl:part
+ String part = getInvalidMimeContentPart(
+ outputMimeContents, portTypeOutput.getMessage());
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the output of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+ }
+
+ // If the binding does not contain mime:content elements,
+ // the assertion is not applicable
+ if (!mimeContentsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Validates every mime:content element. If it references a wsdl:part that
+ * is defined using neither the type attribute nor the element attribute
+ * or using them together, it is invalid.
+ * @param mimeContents a list of mime:content elements.
+ * @param message the corresponding wsdl:message element for mime:contentS.
+ * @return a value of the part attribute of an invalid mime:content
+ * or null if all the mime:content elements are valid.
+ */
+ private String getInvalidMimeContentPart(List mimeContents, Message message) {
+ // Going throug all the mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ // Getting a value of the part attribute from a mime:element
+ String partName = ((MIMEContent) mimeContents.get(i)).getPart();
+ // Getting the corresponging wsdl:part
+ Part part = message.getPart(partName);
+ // if it is defined and use neither the type attribute
+ // nor the element attribute or use them together, return part value
+ if (part != null
+ && ((part.getTypeName() == null && part.getElementName() == null)
+ || (part.getTypeName() != null && part.getElementName() != null)))
+ {
+ return partName;
+ }
+ }
+ // Return null if no one part is found
+ return null;
+ }
+
+ /**
+ * Collects all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2911.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2911.java
new file mode 100644
index 000000000..8ea214944
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2911.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2911
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>The mime:multipartRelated elements in wsdl:input and wsdl:ouput elements
+ * of operations in a wsdl:binding, contain exactly one mime:part child element that contains
+ * a soapbind:body child element.</assertionDescription>
+ */
+public class AP2911 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2911(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:multipartRelated element
+ boolean multipartsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:multipartRelated elements from wsdl:input and wsdl:output
+ List inputMultiparts = getMimeMultipartElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMultiparts = getMimeMultipartElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:multipartRelated elements
+ if (!inputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is not exactly one mime:part element containing
+ // a soapbind:body child, the assertion failed
+ if (!containsOneSoapBody(inputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:multipartRelated element is in the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+
+ // If the wsdl:output contains mime:multipartRelated elements
+ if (!outputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is not exactly one mime:part element containing
+ // a soapbind:body child, the assertion failed
+ if (!containsOneSoapBody(outputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:multipartRelated element is in the wsdl:output of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+
+ }
+ // If the binding contains no one mime:multipartRelated element,
+ // the assertion is not applicable
+ if (!multipartsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for mime:part elements containing a soap:body child
+ * for each of mime:multipartRelated element.
+ * @param multiparts a list of mime:multipartRelated elements.
+ * @return true if there is exactly one mime:part containing a soap:body
+ * child, false otherwise.
+ */
+ private boolean containsOneSoapBody(List multiparts)
+ {
+ // A variable indicates that a soap:body element is found
+ boolean soapBodyFound = false;
+
+ // Going through a list of mime:multipartRelated elements
+ for (int i = 0; i < multiparts.size(); i++)
+ {
+ // Getting a list of mime:part elements
+ List mimeParts =
+ ((MIMEMultipartRelated) multiparts.get(i)).getMIMEParts();
+
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Getting a list of extensibility elements of a mime:part
+ List extElems =
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements();
+ // Going through the extensibility elements
+ for (int k = 0; k < extElems.size(); k++)
+ {
+ // If an extensibility element is a soap:body
+ if (((ExtensibilityElement)extElems.get(k))
+ .getElementType().equals(WSDL_SOAP_BODY))
+ {
+ // If a soap:body element was already found,
+ // return true
+ if (soapBodyFound)
+ {
+ return false;
+ }
+ // else set the variable to the true value
+ else
+ {
+ soapBodyFound = true;
+ }
+ }
+ }
+ }
+ }
+
+ return soapBodyFound;
+ }
+
+ /**
+ * Collects all mime:multipartRelated elements.
+ * @param extElems a list of extensibility elements that can contain mime:multipartRelated elements.
+ * @return the list of mime:multipartRelated elements found.
+ */
+ private List getMimeMultipartElements(List extElems)
+ {
+ List mimeMultipartElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Adding the element to the list being returned
+ mimeMultipartElements.add(extElem);
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:multipartRelated elements of this mime:part
+ List elems = getMimeMultipartElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeMultipartElements.addAll(elems);
+ }
+ }
+ }
+ }
+
+ return mimeMultipartElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2930.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2930.java
new file mode 100644
index 000000000..912ff6416
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2930.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2930
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>A wsdl:fault element in a description does not have
+ * mime:multipartRelated element as its child element.</assertionDescription>
+ */
+public class AP2930 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2930(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates a binding contains at least one
+ // wsdl:fault element
+ boolean faultsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:fault elements
+ Collection faults = bindingOperation.getBindingFaults().values();
+ if (!faults.isEmpty())
+ {
+ faultsFound = true;
+ // If there is at least one mime:multipartRelated element,
+ // the assertion failed
+ if (containsMimeMultiparts(faults))
+ throw new AssertionFailException("The binding operation is \""
+ + bindingOperation.getName() + "\".");
+ }
+ }
+
+ // If the binding does not contain wsdl:fault elements,
+ // the assertion is not applicable
+ if (!faultsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Validates wsdl:fault elements.
+ * @param faults a collection of wsdl:fault elements.
+ * @return true if any wsdl:fault has a mime:multipartRelated child
+ * element, false otherwise.
+ */
+ private boolean containsMimeMultiparts(Collection faults)
+ {
+ // Going through all the wsdl:faultS
+ Iterator i = faults.iterator();
+ while (i.hasNext())
+ {
+ // Getting wsdl:fault's extensibility elements
+ List extElems = ((BindingFault) i.next()).getExtensibilityElements();
+ for (int j = 0; j < extElems.size(); j++)
+ {
+ // If there is a mime:multipartRelated element, return true
+ if (((ExtensibilityElement)extElems.get(j))
+ .getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ return true;
+ }
+ }
+ }
+ // There are no mime:multipartRelated elements, return false
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2940.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2940.java
new file mode 100644
index 000000000..39ef32745
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2940.java
@@ -0,0 +1,450 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.impl.dv.XSSimpleType;
+import org.apache.xerces.xs.XSAttributeUse;
+import org.apache.xerces.xs.XSComplexTypeDefinition;
+import org.apache.xerces.xs.XSConstants;
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSModelGroup;
+import org.apache.xerces.xs.XSObjectList;
+import org.apache.xerces.xs.XSParticle;
+import org.apache.xerces.xs.XSTerm;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.w3c.dom.Element;
+
+/**
+ * AP2940
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>In a description, a wsdl:part defined with the
+ * ref:swaRef schema type is bound to a soapbind:body, or a soapbind:header
+ * in a MIME binding.</assertionDescription>
+ */
+public class AP2940 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2940(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates wsdl:portType references at least one
+ // wsdl:part defined with the ref:swaRef schema type
+ boolean swaRefFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If the corresponding wsdl:input exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeInput != null && portTypeInput.getMessage() != null)
+ {
+ // Collecting all the message's parts defined with ref:swaRef
+ List swaRefParts = getSwaRefParts(portTypeInput.getMessage());
+ if (!swaRefParts.isEmpty())
+ {
+ swaRefFound = true;
+ // Getting a wsdl:part that is unbound
+ String unboundPart = getUnboundPart(swaRefParts,
+ portTypeInput.getMessage().getQName(),
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ // If such wsdl:part exists, assertion failed
+ if (unboundPart != null)
+ throw new AssertionFailException("The part \"" + unboundPart
+ + "\" is not bound properly to the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+
+ // If the corresponding wsdl:output exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeOutput != null && portTypeOutput.getMessage() != null)
+ {
+ // Collecting all the message's parts defined with ref:swaRef
+ List swaRefParts = getSwaRefParts(portTypeOutput.getMessage());
+ if (!swaRefParts.isEmpty())
+ {
+ swaRefFound = true;
+ // Getting a wsdl:part that is unbound
+ String unboundPart = getUnboundPart(swaRefParts,
+ portTypeOutput.getMessage().getQName(),
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+ // If such wsdl:part exists, assertion failed
+ if (unboundPart != null)
+ throw new AssertionFailException("The part \"" + unboundPart
+ + "\" is not bound properly to the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+ }
+
+ // If there is no wsdl:partS defined with the ref:swaRef
+ // schema type, the assertion is not applicable
+ if (!swaRefFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ // The assertion is "recommended", using the "warning" result
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for a wsdl:part that is not bound to either soap:body or soap:header
+ * in a MIME binding.
+ * @param swaRefParts a list of wsdl:part names that are defined with the
+ * ref:swaRef schema type.
+ * @param messageName the qualified name of the wsdl:message being validated.
+ * @param extElems a list of extensibility elements of either wsdl:input or
+ * wsdl:output of the corresponding binding operation.
+ * @return a wsdl:part name that is not bound properly, or null.
+ */
+ private String getUnboundPart(List swaRefParts, QName messageName, List extElems) {
+ // Going through wsdl:part names
+ for (int i = 0; i < swaRefParts.size(); i++)
+ {
+ String part = (String) swaRefParts.get(i);
+ boolean boundProperly = false;
+ if (extElems != null)
+ {
+ // Going through extensibility elements
+ for (int j = 0; j < extElems.size() && !boundProperly; j++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(j);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Getting the first mime:part element where soap:body
+ // and soap:header could appear
+ if (mimeParts.size() > 0)
+ {
+ List elems = ((MIMEPart) mimeParts.get(0)).getExtensibilityElements();
+ // Going through all the MIME part's extensibility elements
+ for (int k = 0; k < elems.size(); k ++)
+ {
+ ExtensibilityElement elem = (ExtensibilityElement) elems.get(k);
+ // If that is a soap:body
+ if (elem.getElementType().equals(WSDL_SOAP_BODY))
+ {
+ List pts = ((SOAPBody) elem).getParts();
+ // If the part is bound by this element
+ if (pts == null || pts.contains(part))
+ {
+ boundProperly = true;
+ break;
+ }
+ }
+ // else if that is a soap:header
+ else if (elem.getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ if (elem instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader) elem;
+ // If the part is bound by this element
+ if (messageName.equals(header.getMessage())
+ && header.getPart() != null
+ && header.getPart().equals(part))
+ {
+ boundProperly = true;
+ break;
+ }
+ }
+ // WSDL4J 1.4 does not recognize soap:header elements that
+ // are enclosed in mime:multipartRelated, so using a workaround
+ else
+ {
+ Element header =
+ ((UnknownExtensibilityElement) elem).getElement();
+ // If a header references the corresponding message
+ // and the part is bound by this element
+ if (referencesMessage(header, messageName)
+ && header.getAttribute("part").equals(part))
+ {
+ boundProperly = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // If this part is unbound properly, return it
+ if (!boundProperly)
+ return part;
+ }
+ // All the parts are bound properly, return null
+ return null;
+ }
+
+ /**
+ * Validates whether an element contains a message attribute that references
+ * a message that have the qualified name specified.
+ * @param elem an element to be validated.
+ * @param messageName the qualified name of a message.
+ * @return true if an element is valid, false otherwise.
+ */
+ private boolean referencesMessage(Element elem, QName messageName)
+ {
+ // Getting the element's message attribute
+ String message = elem.getAttribute("message");
+ // finding the colon delimiter
+ int colonPos = message.indexOf(":");
+ String ns = null;
+ // Getting a local part
+ String lp = colonPos > -1 ? message.substring(colonPos + 1) : message;
+ // If the delimiter is found
+ if (colonPos > -1)
+ {
+ // Retrieving a namespace URI
+ ns = validator.wsdlDocument.getDefinitions()
+ .getNamespace(message.substring(0, colonPos));
+ }
+ // If the local part and the namespace URI are the same as a message have
+ if (messageName.getLocalPart().equals(lp)
+ && messageName.getNamespaceURI().equals(ns))
+ {
+ // element is valid, return true
+ return true;
+ }
+ // element is not valid, return false
+ return false;
+ }
+
+ /**
+ * Collects all the wsdl:part defined with the ref:swaRef schema type.
+ * @param message a message containig wsdl:part elements.
+ * @return a list of wsdl:part names.
+ */
+ private List getSwaRefParts(Message message)
+ {
+ List swaRefParts = new ArrayList();
+
+ // Going through message's parts
+ Iterator it = message.getParts().values().iterator();
+ while (it.hasNext())
+ {
+ Part part = (Part) it.next();
+ QName ref;
+ short type;
+ // Getting either part's element reference or type reference
+ if ((ref = part.getTypeName()) != null)
+ {
+ type = XSConstants.TYPE_DEFINITION;
+ }
+ else if ((ref = part.getElementName()) != null)
+ {
+ type = XSConstants.ELEMENT_DECLARATION;
+ }
+ // The part does conatins neither element nor type attribute,
+ // proceeding with the next part
+ else
+ {
+ continue;
+ }
+ // Getting a list of schemas defined
+ Map schemas = validator.wsdlDocument.getSchemas();
+ // Going through the schemas
+ Iterator it2 = schemas.values().iterator();
+ while (it2.hasNext())
+ {
+ XSModel xsModel = (XSModel) it2.next();
+ XSTypeDefinition partType = null;
+ // Getting the corresponding part type
+ if (type == XSConstants.ELEMENT_DECLARATION)
+ {
+ XSElementDeclaration elem = xsModel.getElementDeclaration(
+ ref.getLocalPart(), ref.getNamespaceURI());
+ if (elem != null)
+ partType = elem.getTypeDefinition();
+ }
+ else
+ {
+ partType = xsModel.getTypeDefinition(
+ ref.getLocalPart(), ref.getNamespaceURI());
+ }
+ // If the part type is defined using the ref:swaRef schema type
+ if (referencesSwaRef(partType, new ArrayList()))
+ {
+ // Adding the part's name to the list being returned
+ swaRefParts.add(part.getName());
+ }
+ }
+ }
+ // Return the list
+ return swaRefParts;
+ }
+
+ /**
+ * Check schema type whether it contains ref:swaRef simple schema type
+ * or has an attribute of this schema type.
+ * @param xsType a schema type definition element
+ * @return true, if schema type contains ref:swaRef, false otherwise.
+ */
+ private boolean referencesSwaRef(XSTypeDefinition xsType, List types)
+ {
+ if ((xsType != null) && (!types.contains(xsType)))
+ {
+ types.add(xsType);
+ // If this is a complex type
+ if (xsType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
+ {
+ XSComplexTypeDefinition xsComplexType =
+ (XSComplexTypeDefinition) xsType;
+ // If it contains mixed context
+ // check whether the context contains ref:swaRef
+ if (xsComplexType.getParticle() != null
+ && referencesSwaRef(xsComplexType.getParticle().getTerm(), types))
+ {
+ return true;
+ }
+ // Getting the type's attributes
+ XSObjectList attrList = xsComplexType.getAttributeUses();
+ for (int i = 0; i < attrList.getLength(); i++)
+ {
+ XSAttributeUse xsAttrUse = (XSAttributeUse) attrList.item(i);
+ // If an attribute is defined using ref:swaRef, return true
+ if (referencesSwaRef(
+ xsAttrUse.getAttrDeclaration().getTypeDefinition(), types))
+ {
+ return true;
+ }
+ }
+ }
+ // else if this is a simple type
+ else if (xsType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE)
+ {
+ XSSimpleType xsSimpleType = (XSSimpleType) xsType;
+ // If this type is ref:swaRef, return true
+ if (xsSimpleType.getNamespace().equals(WSIConstants.NS_URI_SWA_REF)
+ && xsSimpleType.getName().equals(WSIConstants.SCHEMA_TYPE_SWA_REF))
+ {
+ return true;
+ }
+ }
+ }
+ // The schema type does not contain any element defined with the ref:swaRef
+ // return false
+ return false;
+ }
+
+ /**
+ * Checks a term whether it is defined with ref:swaRef.
+ * @param term a term that can be one of a model group or an
+ * element declaration.
+ * @return true if a term is defined with ref:swaRef, false otherwise.
+ */
+ private boolean referencesSwaRef(XSTerm term, List types)
+ {
+ // If a term is an element declaration
+ if (term.getType() == XSConstants.ELEMENT_DECLARATION)
+ {
+ // If element's type is defined with the ref:swaRef, return true
+ if (referencesSwaRef(
+ ((XSElementDeclaration) term).getTypeDefinition(), types))
+ {
+ return true;
+ }
+ }
+ // else if a term is a model group
+ else if(term.getType() == XSConstants.MODEL_GROUP)
+ {
+ // Getting a list of Particle schema components
+ XSObjectList list = ((XSModelGroup) term).getParticles();
+ for (int i = 0; i < list.getLength(); i++)
+ {
+ // If the term of a particle is defined with the ref:swaRef,
+ // return true
+ if (referencesSwaRef(((XSParticle) list.item(i)).getTerm(), types))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2941.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2941.java
new file mode 100644
index 000000000..da00ec185
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2941.java
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+/**
+ * AP2941
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>A wsdl:binding in a description binds every wsdl:part
+ * of a wsdl:message in the wsdl:portType to which it refers to one of
+ * soapbind:body, soapbind:header, soapbind:fault , soapbind:headerfault,
+ * or mime:content.</assertionDescription>
+ */
+public class AP2941 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2941(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If the corresponding wsdl:input exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeInput != null && portTypeInput.getMessage() != null)
+ {
+ // Getting the list of all the parts bound by wsdl:input's child elements
+ List inputParts = getBindingParts(
+ bindingOperation.getBindingInput().getExtensibilityElements(),
+ portTypeInput.getMessage());
+ // If not true that all the wsdl:partS are bound,
+ // the assertion failed
+ if (!inputParts
+ .containsAll(portTypeInput.getMessage().getParts().keySet()))
+ {
+ throw new AssertionFailException("The wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation does not "
+ + "bind all the corresponding wsdl:partS.");
+ }
+ }
+
+ // If the corresponding wsdl:output exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeOutput != null && portTypeOutput.getMessage() != null)
+ {
+ // Getting the list of all the parts bound by wsdl:output's child elements
+ List outputParts = getBindingParts(
+ bindingOperation.getBindingOutput().getExtensibilityElements(),
+ portTypeOutput.getMessage());
+ // If not true that all the wsdl:partS are bound,
+ // the assertion failed
+ if (!outputParts
+ .containsAll(portTypeOutput.getMessage().getParts().keySet()))
+ {
+ throw new AssertionFailException("The wsdl:output of the \""
+ + bindingOperation.getName() + "\" binding operation does not "
+ + "bind all the corresponding wsdl:partS.");
+ }
+ }
+
+ // IF there are wsdl:faultS in the wsdl:portType operation
+ if (!bindingOperation.getOperation().getFaults().isEmpty())
+ {
+ // Collecting all the soap:fault names
+ List faultNames = new ArrayList();
+ Collection faults = bindingOperation.getBindingFaults().values();
+ // Going through all the wsdl:faultS
+ Iterator it = faults.iterator();
+ while (it.hasNext())
+ {
+ // Getting wsdl:fault's extensibility elements
+ List extElems = ((BindingFault) it.next()).getExtensibilityElements();
+ for (int j = 0; j < extElems.size(); j++)
+ {
+ if (((ExtensibilityElement)extElems.get(j))
+ .getElementType().equals(WSDL_SOAP_FAULT))
+ {
+ faultNames.add(((SOAPFault)extElems.get(j)).getName());
+ }
+ }
+ }
+ // If not true that all the wsdl:faultS are bound,
+ // the assertion failed
+ if (!faultNames.containsAll(
+ bindingOperation.getOperation().getFaults().keySet()))
+ {
+ throw new AssertionFailException("The binding operation \""
+ + bindingOperation.getName() + "\" does not "
+ + "bind all the corresponding wsdl:faultS.");
+ }
+ }
+ }
+ }
+ catch (AssertionFailException afe)
+ {
+ // The assertion is "recommended", using the "warning" result
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Collects all the parts bound by extensibility elements.
+ * @param extElems a lit of extensibility elements.
+ * @param message the wsdl:message element corresponging
+ * to the extensibility elements.
+ * @return a list of wsdl:part names bound.
+ */
+ private List getBindingParts(List extElems, Message message)
+ {
+ List parts = new ArrayList();
+ if (extElems != null)
+ {
+ // Going through the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If that is a soap:body
+ if (extElem.getElementType().equals(WSDL_SOAP_BODY))
+ {
+ // Adding all the parts bound to the list
+ List pts = ((SOAPBody) extElem).getParts();
+ if (pts != null)
+ {
+ parts.addAll(pts);
+ }
+ // else the parts attribute is omitted,
+ // all parts defined by the message are assumed to be included
+ // in the SOAP Body portion.
+ else
+ {
+ parts.addAll(message.getParts().keySet());
+ }
+ }
+ // else if that is a soap:header
+ else if (extElem.getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ List headerFaults = null;
+ if (extElem instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader) extElem;
+ // If a header references the corresponding message,
+ // adding part name to the list
+ if (message.getQName().equals(header.getMessage()))
+ parts.add(header.getPart());
+
+ headerFaults = header.getSOAPHeaderFaults();
+ }
+ // WSDL4J 1.4 does not recognize soap:header elements that are enclosed
+ // in mime:multipartRelated, so using a workaround
+ else
+ {
+ Element header =
+ ((UnknownExtensibilityElement) extElem).getElement();
+ // If a header references the corresponding message,
+ // adding part name to the list
+ if (referencesMessage(header, message.getQName()))
+ parts.add(header.getAttribute("part"));
+ // Collecting soap:headerfault elements for the header
+ headerFaults = getHeaderFaults(header);
+ }
+ // Going through the soap:headerfaultS
+ for (int j = 0; j < headerFaults.size(); j++)
+ {
+ if (headerFaults.get(j) instanceof SOAPHeaderFault)
+ {
+ SOAPHeaderFault shf = (SOAPHeaderFault) headerFaults.get(j);
+ // If a soap:headerfault references the corresponding
+ // message, adding part name to the list
+ if (message.equals(shf.getMessage()))
+ parts.add(shf.getPart());
+ }
+ // the same workaround...
+ else
+ {
+ Element shf = (Element) headerFaults.get(j);
+ // If a soap:headerfault references the corresponding
+ // message, adding part name to the list
+ if (referencesMessage(shf, message.getQName()))
+ parts.add(shf.getAttribute("part"));
+ }
+ }
+ }
+ // else if that is a mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // adding part name to the list
+ parts.add(((MIMEContent) extElem).getPart());
+ }
+ // else if that is a mime:multipartRelated
+ else if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the values of part attributes
+ // of mime:part's extensibility elements
+ parts.addAll(getBindingParts(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements(),
+ message));
+ }
+ }
+ }
+ }
+ return parts;
+ }
+
+ /**
+ * Validates whether an element contains a message attribute that references
+ * a message that have the qualified name specified.
+ * @param elem an element to be validated.
+ * @param messageName the qualified name of a message.
+ * @return true if an element is valid, false otherwise.
+ */
+ private boolean referencesMessage(Element elem, QName messageName)
+ {
+ // Getting the element's message attribute
+ String message = elem.getAttribute("message");
+ // finding the colon delimiter
+ int colonPos = message.indexOf(":");
+ String ns = null;
+ // Getting a local part
+ String lp = colonPos > -1 ? message.substring(colonPos + 1) : message;
+ // If the delimiter is found
+ if (colonPos > -1)
+ {
+ // Retrieving a namespace URI
+ ns = validator.wsdlDocument.getDefinitions()
+ .getNamespace(message.substring(0, colonPos));
+ }
+ // If the local part and the namespace URI are the same as a message have
+ if (messageName.getLocalPart().equals(lp)
+ && messageName.getNamespaceURI().equals(ns))
+ {
+ // element is valid, return true
+ return true;
+ }
+ // element is not valid, return false
+ return false;
+ }
+
+ /**
+ * Collects all the element's child elements of the soap:headerfault type.
+ * @param element an element that can have soap:headerfault elements.
+ * @return the list of soap:headerfault elements found.
+ */
+ private List getHeaderFaults(Element element)
+ {
+ List headerFaults = new ArrayList();
+ if (element != null)
+ {
+ // Getting the first header's child
+ Element child = XMLUtils.getFirstChild(element);
+ while (child != null)
+ {
+ // If the child is soap:headerfault
+ if (child.getNamespaceURI().equals(WSDL_SOAP_HEADERFAULT.getNamespaceURI())
+ && child.getLocalName().equals(WSDL_SOAP_HEADERFAULT.getLocalPart()))
+ {
+ // Adding the child to the list
+ headerFaults.add(child);
+ }
+ // Getting the next header's child
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+ return headerFaults;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2944.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2944.java
new file mode 100644
index 000000000..8ed6c1809
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2944.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2944
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>In a DESCRIPTION, if a wsdl:part element refers to a
+ * global element declaration (via the element attribute of the wsdl:part element)
+ * then the value of the type attribute of a mime:content element that binds that part
+ * is a content type suitable for carrying an XML serialization.</assertionDescription>
+ */
+public class AP2944 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ // A variable that indicates a binding contains mime:content elements
+ // that bind wsdl:partS defined with the element attribute
+ private boolean mimeContentFound;
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2944(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Resetting the variable
+ mimeContentFound = false;
+
+ try
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ // If the corresponding wsdl:input exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeInput != null && portTypeInput.getMessage() != null)
+ {
+ // If there is an invalid mime:content element
+ MIMEContent imc = getInvalidMimeContent(
+ inputMimeContents, portTypeInput.getMessage());
+ if (imc != null)
+ {
+ throw new AssertionFailException("The mime:content element in "
+ + "the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" that binds the \"" + imc.getPart()
+ + "\" wsdl:part uses the invalid content type \""
+ + imc.getType() + "\". ");
+ }
+ }
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If the corresponding wsdl:output exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeOutput != null && portTypeOutput.getMessage() != null)
+ {
+ // If there is an invalid mime:content element
+ MIMEContent imc = getInvalidMimeContent(
+ outputMimeContents, portTypeOutput.getMessage());
+ if (imc != null)
+ {
+ throw new AssertionFailException("The mime:content element in "
+ + "the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" that binds the \"" + imc.getPart()
+ + "\" wsdl:part uses the invalid content type \""
+ + imc.getType() + "\". ");
+ }
+ }
+ }
+ }
+ // If mime:content elements are not found,
+ // the assertion is not applicable
+ if (!mimeContentFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checks whether any mime:content element binds wsdl:part that is defined
+ * with the element attribute and uses the content type "text/xml".
+ * @param mimeContents a list of mime:content elements of binding operation.
+ * @param message the corresponding wsdl:message element.
+ * @return a mime:content element that uses a content type other than
+ * "text/xml", null if no one such element is found.
+ */
+ private MIMEContent getInvalidMimeContent(List mimeContents, Message message)
+ {
+ // Going through a list of mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ MIMEContent mimeContent = (MIMEContent) mimeContents.get(i);
+ // Getting the corresponding wsdl:part
+ Part part = message.getPart(mimeContent.getPart());
+ // If the part is defined with the element attribute
+ if (part != null && part.getElementName() != null)
+ {
+ mimeContentFound = true;
+ // If the type attribute value is other than "text/xml"
+ if (!WSIConstants.CONTENT_TYPE_TEXT_XML.equals(mimeContent.getType()))
+ {
+ // return the invalid element
+ return mimeContent;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Collects all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2946.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2946.java
new file mode 100644
index 000000000..54c4f99d4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/AP2946.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * AP2946
+ *
+ * <context>For a candidate wsdl:binding with at least one mime:content element</context>
+ * <assertionDescription>In a DESCRIPTION, a mime:content element
+ * includes the part attribute.</assertionDescription>
+ */
+public class AP2946 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2946(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ try
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:content element
+ boolean mimeContentsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ // If there is a mime:content that does not include
+ // the part attribute, the assertion failed
+ if (hasInvalidMimeContent(inputMimeContents))
+ throw new AssertionFailException("The invalid mime:content element"
+ + " is in the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ // If there is a mime:content that does not include
+ // the part attribute, the assertion failed
+ if (hasInvalidMimeContent(outputMimeContents))
+ throw new AssertionFailException("The invalid mime:content element"
+ + " is in the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+ }
+
+ // If the binding contains no mime:content elements,
+ // the assertion is not applicable
+ if (!mimeContentsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Collects all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+
+ /**
+ * Validates mime:content elements.
+ * @param mimeContents a list of mime:content elements.
+ * @return true if any mime:content does not include the part attribute,
+ * false otherwise
+ */
+ private boolean hasInvalidMimeContent(List mimeContents)
+ {
+ // Going through a list of mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ // If a mime:content does not include the part attribute, return true
+ if (((MIMEContent) mimeContents.get(i)).getPart() == null)
+ return true;
+ }
+ // There are no invalid mime:contentS, return false
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2010.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2010.java
new file mode 100644
index 000000000..8e585f8ed
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2010.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+* BP2010.
+* "Name" attributes of Operations are unique across the wsdl:portType definition
+*
+* @version 1.0.1 27.06.2003
+* @author Vitali Fedosenko
+**/
+public class BP2010 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2010(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // Get the portType from the entry context
+ PortType portType = (PortType) entryContext.getEntry().getEntryDetail();
+
+ // Check the operations names for uniqueness within the candidate Port Type in the WSDL
+ Iterator ops;
+ HashSet namesSeen = new HashSet();
+ HashSet duplicates = new HashSet();
+ try
+ {
+ List opsList = portType.getOperations();
+ if (opsList == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ // no operations found in portType
+ }
+ else
+ {
+ ops = opsList.iterator(); // will use Candidate.getOperations()
+ while (ops.hasNext())
+ {
+ Operation op = (Operation) ops.next();
+ String opName = op.getName();
+ if (namesSeen.contains(opName))
+ {
+ duplicates.add(opName);
+ }
+ else
+ {
+ namesSeen.add(opName);
+ }
+ }
+ }
+
+ if (!duplicates.isEmpty())
+ {
+ StringBuffer failInfo =
+ new StringBuffer(
+ "Duplicate operation names in portType "
+ + portType.getQName()
+ + ": ");
+ Iterator i = duplicates.iterator();
+ while (i.hasNext())
+ {
+ failInfo.append((String) i.next() + "; ");
+ }
+ throw new AssertionFailException(failInfo.toString());
+ }
+ }
+ catch (NullPointerException e)
+ { // ?? no operations found, but does not fail the assertion.
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(e.getMessage(), entryContext, portType);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2011.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2011.java
new file mode 100644
index 000000000..f81d23c2f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2011.java
@@ -0,0 +1,343 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.StringTokenizer;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2011.
+ * The imported XML schema is a well-formed XML 1.0 document and if it contains an
+ * XML declaration, it is version 1.0.
+ *
+ * @version 1.0.1 27.06.2003
+ * @author Vitali Fedosenko
+**/
+public class BP2011 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2011(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ private final char[] OMMITED_XML_DECLARATION_DELIMITERS =
+ new char[] { 0x20, 0x9, 0xD, 0xA, '\'', '\"' };
+ private final char[] XML_DECLARATION_DELIMITERS = new char[] { '=' };
+ private final String VERSION_TOKEN = "version";
+ private final String VERSION = "1.0";
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ //Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ Types types = (Types) entryContext.getEntry().getEntryDetail();
+
+ List exts = null;
+ //if (def.getTypes()!=null)
+ if (types != null)
+ {
+ exts = types.getExtensibilityElements();
+ }
+ if (exts != null)
+ {
+ Definition definition = null;
+ if ((definition =
+ validator.analyzerContext.getCandidateInfo().getDefinition(types))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement)
+ searchForSchema(((UnknownExtensibilityElement) el).getElement(),
+ definition.getDocumentBaseURI());
+ }
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ } /*else
+ result = AssertionResult.RESULT_PASSED;*/
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /* Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param n - UnknownExtencibilityElement
+ */
+ private void searchForSchema(Node n, String context)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ // if xsd:schema element is found -> process schema
+ if (XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ processSchema(n, context);
+ else
+ // if xsd:import element is found -> load schema and process schema
+ // FIXED: if xsd:import is found and parent element is xsd:schema
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT)
+ && XMLUtils.equals(n.getParentNode(), ELEM_XSD_SCHEMA))
+ loadSchema(n, context);
+ else
+ // else iterate element recursively
+ searchForSchema(n.getFirstChild(), context);
+ }
+ n = n.getNextSibling();
+ }
+ }
+
+ /*
+ * It loads xsd schema and then check the version 1.0 and looking for xsd:schema element for next process.
+ * @param importNode xsd schema
+ */
+ private void loadSchema(Node importNode, String context)
+ {
+ Element im = (Element) importNode;
+ Attr schemaLocation = XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ {
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ String decl =
+ readXMLDeclarationStatement(schemaLocation.getValue(), context);
+ if (!validVersion(decl))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ errors.add((a != null) ? a.getValue() : "");
+ }
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+ if (XMLUtils.equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ processSchema(schema.getDocumentElement(),
+ XMLUtils.createURLString(schemaLocation.getValue(), context));
+ }
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+ // else if there is only the namespace attribute, the import relates to inline schema
+ else if (XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE) != null)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+
+ /**
+ * Reads an XML declaration statement.
+ * @param location
+ * @return String
+ */
+ private String readXMLDeclarationStatement(String location, String baseURI)
+ {
+ String result = null;
+ try
+ {
+ new URL(location);
+ }
+ catch (Throwable t)
+ {
+ // nothing
+ int i = baseURI.lastIndexOf('/');
+ int j = baseURI.lastIndexOf('\\');
+ if (j > i)
+ i = j;
+ location = baseURI.substring(0, i + 1) + location;
+ }
+
+ if (location != null)
+ {
+ URL url = null;
+ Reader reader = null;
+
+ try
+ {
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // we should try to access location as file
+ }
+
+ if (url != null)
+ {
+ reader = new InputStreamReader(url.openStream());
+ }
+ else
+ {
+ reader = new InputStreamReader(new FileInputStream(location));
+ }
+
+ int charCode;
+ boolean end = false;
+ if (reader.ready())
+ {
+ charCode = reader.read();
+
+ while (reader.ready() && !(charCode == '<'))
+ {
+ charCode = reader.read();
+ }
+
+ StringBuffer buf = new StringBuffer();
+ if (charCode == '<')
+ {
+ buf.append((char) charCode);
+ while (reader.ready() && !end)
+ {
+ charCode = reader.read();
+ buf.append((char) charCode);
+
+ end = charCode == '>';
+ }
+ }
+ else
+ {
+ // NOTE: This result does not get propogated back!
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "Cannot read the XML declaration statement.";
+ }
+
+ result = buf.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * @param xmlDecl - xml declaration
+ * @return if xml declaration contains version="1.0" it retirns true.
+ */
+ private boolean validVersion(String xmlDecl)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st =
+ new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS,
+ XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+
+ if (token.equalsIgnoreCase(VERSION_TOKEN))
+ {
+ found = true;
+
+ tokens.nextElement();
+ String ver = (String) tokens.nextElement();
+
+ result = VERSION.equals(ver);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * It's loking for xsd import and load it if find.
+ * @param schema xsd schema
+ */
+ private void processSchema(Node schema, String context)
+ {
+ Node n = schema.getFirstChild();
+ while (n != null)
+ {
+ if (Node.ELEMENT_NODE == n.getNodeType()
+ && XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ loadSchema(n, context);
+
+ n = n.getNextSibling();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2012.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2012.java
new file mode 100644
index 000000000..c25e7ba65
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2012.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl.WSDLValidatorImpl.BindingMatch;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2012.
+ * Example:
+ *
+ * <message name="getConfigurationOptionsRequest">
+ * <part name="refresh" element="cfg:refresh" />
+ * </message>
+ * <portType name="ConfiguratorPortType">
+ * <operation name="getConfigurationOptions">
+ * <input message="tns:getConfigurationOptionsRequest" />
+ * <output ..... />
+ * <fault ..... />
+ * </operation>
+ * </portType>
+ * <binding name="ConfiguratorBinding" type="tns:ConfiguratorPortType">
+ * <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ * <operation name="getConfigurationOptions">
+ * <soap:operation soapAction="http://www.zzz.com/zzz.wsdl/getConfigurationOptions" />
+ * <input>
+ * <soap:body use="literal" namespace="http://www.zzz.com/zzz.wsdl" />
+ * </input>
+ * <output>.....</output>
+ * <fault>......</fault>
+ * </operation>
+ * </binding>
+ *
+ * Above, the test for this assertion might be that the element attribute is specified in the "refresh"
+ * part of the getConfigurationOptionsRequest message.
+ *
+ * Context : for <binding> "ConfiguratorBinding", <soap:binding> style=document; <soap:body> use=literal
+ * for the <input> of binding operation "getConfigurationOptions".
+ * (<input> is an example. Could be <output> or <fault> equally).
+ * Action: check the part(s) of the message specified in the <input> element (in example) of the <portType>,
+ * namely tns:getConfigurationOptionsRequest, that the element attribute is specified. In this case we have
+ * <part name="refresh" element="cfg:refresh" />, so the test passes.
+ * All such parts associated with the assertion candidate binding(s) must be similarly checked for this assertion
+ * to pass.
+ */
+public class BP2012 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2012(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Get binding from entry context
+
+ // Oleg's & Graham's version:
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // to use original version require a binding array
+ //Binding[] binding = {(Binding) entryContext.getEntry().getEntryDetail()};
+
+ // get list of candidate matches
+ BindingMatch[] bindingMatch =
+ this.validator.getBindingMatches(
+ binding,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT);
+ if (bindingMatch.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ try
+ {
+ if (!this.validator.checkPartAttributes(bindingMatch, "useInput", "useElement")
+ || !this.validator.checkPartAttributes(bindingMatch, "useOutput", "useElement"))
+ {
+ // this should never happen
+ throw new AssertionFailException("diagnostic: internal processing error!");
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(e.getMessage(), entryContext, binding);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2013.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2013.java
new file mode 100644
index 000000000..054b03ea1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2013.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl.WSDLValidatorImpl.BindingMatch;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2013.
+ * The binding (in soapbind:body elements) only refers to part elements that have been defined using the "type" attribute.
+ *
+ * @version 1.0.1 27.06.2003
+ * @author Vitali Fedosenko
+ */
+public class BP2013 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2013(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Get binding from entry context
+
+ // Oleg's & Graham's version:
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // to use original version require a binding array
+ //Binding[] binding = {(Binding) entryContext.getEntry().getEntryDetail()};
+
+ // get list of candidate matches
+ BindingMatch[] bindingMatch =
+ this.validator.getBindingMatches(
+ binding,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT);
+ if (bindingMatch.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ try
+ {
+ if (!this.validator.checkPartAttributes(bindingMatch, "useInput", "useType")
+ || !this.validator.checkPartAttributes(bindingMatch, "useOutput", "useType"))
+ {
+ // this should never happen
+ throw new AssertionFailException("diagnostic: internal processing error!");
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(e.getMessage(), entryContext, binding);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2014.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2014.java
new file mode 100644
index 000000000..d553f1103
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2014.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2014.
+ * Context:
+ * For a candidate wsdl:operation, if referred to by a candidate rpc-literal wsdl:binding element
+ * If the parameterOrder attribute is present, it omits at most 1 part from output wsdl:message.
+ **/
+public class BP2014 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2014(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * @param binding - binding
+ * @return It returns style of soap binding of binding. If style omitted returns "document" style.
+ */
+ private String getSOAPBindingStyle(Binding binding)
+ {
+ String style = null;
+ List list = binding.getExtensibilityElements();
+ for (int i = 0; i < list.size(); i++)
+ {
+ if (list.get(i) instanceof SOAPBinding)
+ {
+ style = ((SOAPBinding) list.get(i)).getStyle();
+ break;
+ }
+ }
+ if (style == null)
+ style = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ return style;
+ }
+
+ /*
+ * @param list - List of extencibility elements from binding output
+ * @return first soap body in list.
+ */
+ private SOAPBody getSOAPBody(List list)
+ {
+ for (int i = 0; i < list.size(); i++)
+ if (list.get(i) instanceof SOAPBody)
+ return (SOAPBody) list.get(i);
+ return null;
+ }
+
+ /*
+ * @param list - List of extencibility elements of binding operation
+ * @return First soap operation in list.
+ */
+ private SOAPOperation getSOAPOperation(List list)
+ {
+ for (int i = 0; i < list.size(); i++)
+ if (list.get(i) instanceof SOAPOperation)
+ return (SOAPOperation) list.get(i);
+ return null;
+ }
+
+ /*
+ * @param oper - operation
+ * @param binding - binding
+ * @return if style of soap binding of binding is rpc and use of soap body of binding output of binding operation is literal then it returns true.
+ */
+ private boolean checkRpcLiteral(BindingOperation oper, Binding binding)
+ {
+ List list = oper.getExtensibilityElements();
+ SOAPOperation sop = getSOAPOperation(list);
+ if (sop == null)
+ return false;
+ String style =
+ (sop.getStyle() == null
+ ? getSOAPBindingStyle(binding)
+ : sop.getStyle());
+ if (!style.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC))
+ return false;
+ list = oper.getBindingOutput().getExtensibilityElements();
+ SOAPBody body = getSOAPBody(list);
+ if (body == null)
+ return false;
+ String use = body.getUse();
+ if (use == null)
+ return false;
+
+ return use.equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT);
+ }
+
+ /* It checks operation contains more than one part in parameter order
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Operation obj, Object parent, WSDLTraversalContext ctx)
+ {
+ Binding[] bindings = validator.analyzerContext.getCandidateInfo().getBindings();
+ if (obj.getParameterOrdering() == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ if (bindings == null || obj == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ if (obj.getOutput() == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ if (obj.getOutput().getMessage() == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ // For each binding
+ for (int i = 0; i < bindings.length; i++)
+ {
+ List list = bindings[i].getBindingOperations();
+ // For each binding operation
+ for (int j = 0; j < list.size(); j++)
+ {
+ BindingOperation oper = (BindingOperation) list.get(j);
+
+ // If the input operation name and binding operatino name are not null
+ if (obj.getName() != null && oper.getName() != null)
+ {
+ // If the operation names are equal
+ if (obj.getName().equals(oper.getName()))
+ {
+ // If the operation is RPC literal
+ if (checkRpcLiteral(oper, bindings[i]))
+ {
+ // Get the list of parts in the parameterOrder attribute
+ List parts = obj.getParameterOrdering();
+
+ Output output = null;
+ Message message = null;
+ Map messageParts = null;
+
+ // Get the list of parts for the output message
+ if ((output = obj.getOutput()) != null)
+ {
+ if ((message = output.getMessage()) != null)
+ {
+ messageParts = message.getParts();
+ }
+ }
+
+ // If there are parts in the parameterOrder attribute
+ // and there are output message parts, then process assertion
+ if (parts != null && messageParts != null)
+ {
+ int partCount = 0;
+
+ String partName;
+ Iterator iterator = parts.iterator();
+ while (iterator.hasNext())
+ {
+ // Get part name from parameterOrder list
+ partName = (String) iterator.next();
+
+ // Check each output message part to see if there is a match
+ if (messageParts.containsKey(partName))
+ partCount++;
+ }
+
+ if ((partCount == messageParts.size())
+ || (partCount == messageParts.size() - 1))
+ result = AssertionResult.RESULT_PASSED;
+ else
+ {
+ errors.add(obj.getName());
+ ctx.cancelOperationProcessing();
+ }
+ return;
+ }
+
+ else
+ {
+ if (parts == null)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ else
+ result = AssertionResult.RESULT_PASSED;
+ return;
+ }
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+ }
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+ }
+ }
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.ignoreImport();
+ traversal.traverse((Operation) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ errors.toString(),
+ entryContext,
+ entryContext.getEntry().getEntryDetail());
+ }
+ //else
+ // result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2017.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2017.java
new file mode 100644
index 000000000..8586e3589
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2017.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2017.
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>The "style" attribute of each operation in the contained soap:binding has the same value of "document" or "rpc", for all operations of the wsdl:binding.</assertionDescription>
+ */
+public class BP2017 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2017(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ //String firstStyle = null; // GT: is this needed??
+ Vector failureDetailList = new Vector();
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+ if (binding == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return validator.createAssertionResult(testAssertion, result, failureDetailList);
+ }
+ SOAPBinding soapB = WSDLValidatorImpl.getSoapBinding(binding);
+ if (soapB == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return validator.createAssertionResult(testAssertion, result, failureDetailList);
+ }
+ String styleB =
+ (soapB.getStyle() == null
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : soapB.getStyle());
+
+ // Try to get the SOAP operations
+ HashMap soapOperationList = validator.getSoapOperations(binding);
+
+ if (soapOperationList.isEmpty())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check that they all have the same style element value
+ String style = null;
+ String checkStyle;
+ SOAPOperation soapOperation;
+ Iterator iterator = soapOperationList.keySet().iterator();
+ while (iterator.hasNext())
+ {
+ soapOperation = (SOAPOperation) iterator.next();
+ checkStyle = soapOperation.getStyle();
+ if (checkStyle == null)
+ checkStyle = styleB;
+ if (checkStyle != null
+ && !checkStyle.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC)
+ && !checkStyle.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailList.add(
+ this.validator.createFailureDetail(
+ "Operation Name: "
+ + soapOperationList.get(soapOperation)
+ + "\nSOAP Operation: "
+ + soapOperation.toString(),
+ entryContext,
+ soapOperation));
+ // REMOVE: Need to process all operations
+ //break;
+ }
+
+ if (style == null)
+ {
+ style = checkStyle;
+ }
+ else if (!style.equals(checkStyle) || !style.equals(styleB))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailList.add(
+ this.validator.createFailureDetail(
+ "Operation Name: "
+ + soapOperationList.get(soapOperation)
+ + "\nSOAP Operation: "
+ + soapOperation.toString(),
+ entryContext,
+ soapOperation));
+ // REMOVE: Need to process all operations
+ //break;
+ }
+ }
+
+ if (style == null)
+ {
+ // no style attribute was found in the SOAP operation(s) of the binding.
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailList);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2018.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2018.java
new file mode 100644
index 000000000..55d2702a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2018.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * BP2018.
+ * <context>For a candidate Web service definition</context>
+ * <assertionDescription>The wsdl:types element occurs either as the first child in the WSDL namespace of the wsdl:definitions element if no wsdl:documentation or wsdl:import element is present; or immediately following the wsdl:documentation element(s) if they are present but wsdl:import(s) are not, or immediately following both the wsdl:documentation and wsdl:import elemen(s) if present.</assertionDescription>
+ */
+public class BP2018 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2018(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /*
+ * @param el - xml element
+ * @return if element is extensibility element returns true.
+ */
+ private boolean isExtensibilityElement(Element el)
+ {
+ boolean isEx = true;
+ isEx = isEx && !XMLUtils.equals(el, WSDL_BINDING);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DEFINITIONS);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DOCUMENTATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_FAULT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_IMPORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_INPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_MESSAGE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OPERATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OUTPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PART);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORTTYPE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_SERVICE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_TYPES);
+
+ return isEx;
+ }
+
+ /*
+ * Create failed report.
+ * @param el - xml element
+ * @param entryContext - Entry context
+ */
+ private void createFailed(
+ String message,
+ Element el,
+ EntryContext entryContext)
+ {
+ QName context =
+ (el != null)
+ ? new QName(el.getNamespaceURI(), el.getLocalName())
+ : new QName("definition");
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(message, entryContext);
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the location of the WSDL document
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+ try
+ {
+ // Parse the WSDL document as an XML file
+ Document doc =
+ validator.parseXMLDocumentURL(definition.getDocumentBaseURI(), null);
+
+ Element root = doc.getDocumentElement(); // get definition
+
+ Element types = XMLUtils.findChildElement((Element) root, WSDL_TYPES);
+
+ if (types != null)
+ {
+ Element el = XMLUtils.findPreviousSibling(types);
+ while (isExtensibilityElement(el) && el != null)
+ if (el != null)
+ el = XMLUtils.findPreviousSibling(el);
+
+ boolean documentIsPresent =
+ (XMLUtils.findChildElement((Element) root, WSDL_DOCUMENTATION)
+ != null);
+ boolean importIsPresent =
+ (XMLUtils.findChildElement((Element) root, WSDL_IMPORT) != null);
+
+ if (importIsPresent)
+ if (!XMLUtils.equals(el, WSDL_IMPORT))
+ {
+ createFailed(
+ "Types element can not follow import element.",
+ el,
+ entryContext);
+ return validator.createAssertionResult(
+ testAssertion,
+ result,
+ failureDetail);
+ }
+ else
+ el = XMLUtils.findPreviousSibling(el);
+
+ while (isExtensibilityElement(el) && el != null)
+ if (el != null)
+ el = XMLUtils.findPreviousSibling(el);
+
+ if (documentIsPresent)
+ if (!XMLUtils.equals(el, WSDL_DOCUMENTATION))
+ {
+ createFailed(
+ "Types element must follow only a documentation element.",
+ el,
+ entryContext);
+ return validator.createAssertionResult(
+ testAssertion,
+ result,
+ failureDetail);
+ }
+ else
+ el = XMLUtils.findPreviousSibling(el);
+
+ if (!importIsPresent && !documentIsPresent && el != null)
+ createFailed(
+ "Types element must follow only a documentation element.",
+ el,
+ entryContext);
+
+ if (importIsPresent
+ && documentIsPresent
+ && el != null
+ && !XMLUtils.equals(el, WSDL_DEFINITIONS)
+ && el.getNamespaceURI().equals(WSIConstants.NS_URI_WSDL))
+ createFailed(
+ "Types element must not follow the "
+ + el.getTagName()
+ + " element.",
+ el,
+ entryContext);
+ }
+ }
+
+ catch (Throwable t)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "An error occurred while processing the document at "
+ + definition.getDocumentBaseURI()
+ + ".\n\n"
+ + Utils.getExceptionDetails(t),
+ entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2019.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2019.java
new file mode 100644
index 000000000..206802fc7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2019.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.Utils;
+
+
+/**
+ * BP2019.
+ * <context>For a candidate wsdl:binding element, if the contained soap:binding element has a "style" attribute equal to "document" and soap:operations have "use" attribute equal to "literal":</context>
+ * <assertionDescription>The "namespace" attribute is not specified in any contained soapbind:body, soapbind:header, soapbind::headerfault, soapbind:fault elements </assertionDescription>
+ * @version 1.0.1 27.06.2003
+ * @author Vitali Fedosenko
+ */
+public class BP2019 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2019(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ boolean docLitFound = false;
+ String errantElements = new String("");
+ String soapExtensibleWithNamespace = null;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ if (soapBinding != null)
+ {
+ String style =
+ (soapBinding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : soapBinding.getStyle();
+ if (style.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC))
+ {
+ Vector soapElements = Utils.arrayToVector(this.validator.getSoapBodies(binding));
+ soapElements.addAll(Utils.arrayToVector(this.validator.getSoapFaults(binding)));
+ soapElements.addAll(Utils.arrayToVector(this.validator.getSoapHeaders(binding)));
+ soapElements.addAll(
+ Utils.arrayToVector(this.validator.getSoapHeaderFaults(binding)));
+
+ Iterator i = soapElements.iterator();
+ while (i.hasNext())
+ {
+ ExtensibilityElement soapElement =
+ (ExtensibilityElement) (i.next());
+ try
+ {
+ if (this.validator.isLiteral(soapElement))
+ {
+ docLitFound = true;
+ if (this.validator.namespaceFoundInSoapLiteral(soapElement))
+ {
+ errantElements += "\n--- " + (soapElement.toString());
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ } // continue with clenched teeth
+ }
+ }
+ }
+
+ if (!docLitFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // If a namespace was not found then test assertion passed
+ if (errantElements.length() != 0)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "Failing elements:" + errantElements,
+ entryContext);
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2020.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2020.java
new file mode 100644
index 000000000..4d76f5972
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2020.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+
+import org.apache.xerces.util.URI;
+import org.apache.xerces.util.URI.MalformedURIException;
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+* BP2020.
+* <context>For a candidate wsdl:binding element, if the style attribute of the contained soapbind:binding is "rpc"
+* and the use attribute is "literal".</context>
+* <assertionDescription>The namespace attribute is specified on all soapbind:body elements and the value of the
+* namespace attribute is an absolute URI. </assertionDescription>
+* @version 1.0.1 27.06.2003
+* @author Vitali Fedosenko
+**/
+public class BP2020 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2020(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+ boolean rpcLitFound = false;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ // Test the assertion
+ // Check style to make sure that it is rpc - the subject of the assertion
+ String style = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ if (soapBinding != null)
+ style =
+ (soapBinding.getStyle() == null
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : soapBinding.getStyle());
+
+ if ((soapBinding != null)
+ && (style.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC)))
+ {
+ // Get the list of SOAP body elements
+ SOAPBody[] soapBodies = this.validator.getSoapBodies(binding);
+
+ // Check for Soap operation namespace
+ boolean assertionFailure = false;
+ String namespaceURI = null;
+ for (int i = 0; i < soapBodies.length && !(assertionFailure); i++)
+ {
+ SOAPBody soapBody = soapBodies[i];
+ // Added check for null use value, since the default value is literal
+ if (soapBody.getUse() == null
+ || soapBody.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ rpcLitFound = true;
+ // If there is no namespace, then flag as a failure
+ if ((namespaceURI = soapBody.getNamespaceURI()) == null)
+ {
+ assertionFailure = true;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "--- SOAP BODY:\n"
+ + soapBody.toString()
+ + "\n--- BINDING QNAME:\n"
+ + binding.getQName(),
+ entryContext);
+ }
+
+ // Else, verify that the namespace is an absolute URI
+ else
+ {
+ try
+ {
+ //URL url = new URL(namespaceURI);
+ URI uri = new URI(namespaceURI);
+ if (uri.getScheme() == null)
+ {
+ // no scheme implies not an absolute URI
+ assertionFailure = true;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "--- SOAP BODY:\n"
+ + soapBody.toString()
+ + "\n--- BINDING QNAME:\n"
+ + binding.getQName(),
+ entryContext);
+ }
+ }
+ catch (MalformedURIException mue)
+ {
+ assertionFailure = true;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "--- SOAP BODY:\n"
+ + soapBody.toString()
+ + "\n--- BINDING QNAME:\n"
+ + binding.getQName(),
+ entryContext);
+ }
+
+ }
+ }
+ }
+ if (!rpcLitFound)
+ {
+ // style is rpc but no document use elements
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail = null;
+ }
+ else if (!assertionFailure)
+ { // If no assertion failure, then set result to passed
+ result = AssertionResult.RESULT_PASSED;
+ failureDetail = null;
+ }
+ }
+ else
+ {
+ // style is not rpc
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail = null;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2021.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2021.java
new file mode 100644
index 000000000..924484e52
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2021.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+
+
+/**
+* BP2021.
+* <context>For a candidate wsdl:binding element</context>
+* <assertionDescription>The wsdl:input element and wsdl:output element of each operation uses the attribute name "part" with a Schema type of "NMTOKEN" and does not use "parts", for both soapbind:header elements and soapbind:headerfault elements. </assertionDescription>
+*
+* @version 1.0.1 27.06.2003
+* @author Vitali Fedosenko
+**/
+public class BP2021 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2021(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ //Operation operation = null;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get SOAP headers for this binding
+ SOAPHeader[] soapHeaders = this.validator.getSoapHeaders(binding);
+
+ if (soapHeaders.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // Check each header to see if it has part element with NMTOKEN type
+ for (int header = 0;
+ header < soapHeaders.length
+ && result.equals(AssertionResult.RESULT_PASSED);
+ header++)
+ {
+ if ((soapHeaders[header].getPart() == null)
+ || (!XMLUtils.isNmtoken(soapHeaders[header].getPart())))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(soapHeaders[header].toString(), entryContext);
+ }
+ // Else, check the headerfault if there is one
+ else
+ {
+ List soapHeaderFaultList =
+ soapHeaders[header].getSOAPHeaderFaults();
+ Iterator iterator = soapHeaderFaultList.iterator();
+
+ // Check each header fault to see if it has part element with NMTOKEN type
+ while (iterator.hasNext()
+ && result.equals(AssertionResult.RESULT_PASSED))
+ {
+ SOAPHeaderFault soapHeaderFault =
+ (SOAPHeaderFault) iterator.next();
+ if ((soapHeaderFault.getPart() == null)
+ || (!XMLUtils.isNmtoken(soapHeaderFault.getPart())))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(soapHeaderFault.toString(), entryContext);
+ }
+ }
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2022.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2022.java
new file mode 100644
index 000000000..ecb173596
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2022.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPFault;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2022.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>the name attribute is specified on the soapbind:fault element.</assertionDescription>
+**/
+public class BP2022 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2022(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get list of SOAP faults for the binding
+ SOAPFault[] soapFaults = this.validator.getSoapFaults(binding);
+
+ if (soapFaults == null || soapFaults.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ // check all soap:faults.
+ // MUST have a name attribute
+ for (int i = 0; i < soapFaults.length; i++)
+ {
+ SOAPFault soapFault = soapFaults[i];
+ if (soapFault.getName() == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "soapbind:fault element : " + soapFault.toString(),
+ entryContext);
+ break;
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2023.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2023.java
new file mode 100644
index 000000000..172544bdd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2023.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPFault;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2023.
+ * <context>For a candidate wsdl:binding element, with the "use" attribute present on the soapbind:fault element</context>
+ * <assertionDescription>The value of the attribute is "literal".</assertionDescription>
+ */
+public class BP2023 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2023(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get list of SOAP faults for the binding
+ SOAPFault[] soapFaults = this.validator.getSoapFaults(binding);
+
+ if (soapFaults == null || soapFaults.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ // check all soap:faults.
+ // MUST have a name attribute, and if a use attribute is specified, it MUST be value "literal"
+ for (int i = 0; i < soapFaults.length; i++)
+ {
+ SOAPFault soapFault = soapFaults[i];
+ if ((soapFault.getUse() != null)
+ && (!soapFault
+ .getUse()
+ .equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT)))
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ failureDetail =
+ this.validator.createFailureDetail(soapFault.toString(), entryContext);
+ break;
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2032.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2032.java
new file mode 100644
index 000000000..2149341d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2032.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.extensions.soap.SOAPFault;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2032.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>the name attribute that is specified on the soapbind:fault element matches the value specified on the parent element wsdl:fault.</assertionDescription>
+ */
+public class BP2032 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2032(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get list of Binding faults for the binding
+ BindingFault[] bindingFaults = this.validator.getAllBindingFaults(binding);
+
+ if (bindingFaults == null || bindingFaults.length == 0)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ else
+ {
+ // for each binding fault, compare the child soap:fault name with the binding fault name
+
+ for (int i = 0; i < bindingFaults.length; i++)
+ {
+ BindingFault bindingFault = bindingFaults[i];
+ SOAPFault soapFault = this.validator.getSoapFault(bindingFault);
+ if (soapFault == null
+ || soapFault.getName() == null
+ || bindingFault.getName() == null
+ || !bindingFault.getName().equals(soapFault.getName()))
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ failureDetail = this.validator.createFailureDetail(
+ soapFault == null ? null : soapFault.toString(), entryContext);
+ break;
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2034.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2034.java
new file mode 100644
index 000000000..75d84c0a1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2034.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+/**
+ * BP2034
+ *
+ * <context>For a candidate description within a WSDL document</context>
+ * <assertionDescription>The candidate description does not contain the namespace declaration xmlns:xml="http://www.w3.org/XML/1998/namespace".</assertionDescription>
+ */
+public class BP2034 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2034(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ // Getting wsdl:definition element
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ Types types;
+ // Getting the namespace declaration xmlns:xml
+ String xmlNs = (String) def.getNamespaces().get("xml");
+ // If it exists and equals to "http://www.w3.org/XML/1998/namespace"
+ if (xmlNs != null && xmlNs.equals(WSIConstants.NS_URI_XML))
+ {
+ // setting assertion result to warning
+ result = AssertionResult.RESULT_WARNING;
+ }
+ // there is no namespace declaration xmlns:xml in the wsdl:definition
+ // element, checking whether the definition has wsdl:type element
+ else if ((types = def.getTypes()) != null)
+ {
+ // Getting the list of wsdl:schemaS
+ List extElems = types.getExtensibilityElements();
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ // Getting wsdl:schema element
+ UnknownExtensibilityElement schema =
+ (UnknownExtensibilityElement) extElems.get(i);
+ // Getting a value of the attribute xmlns:xml
+ String attrValue = schema.getElement().getAttributeNS(
+ WSIConstants.NS_URI_XMLNS, "xml");
+ // If it equals to "http://www.w3.org/XML/1998/namespace",
+ if (WSIConstants.NS_URI_XML.equals(attrValue))
+ {
+ // setting assertion result to warning
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail("The namespace "
+ + "declaration nested in wsdl:schema element.", entryContext);
+ break;
+ }
+ }
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2098.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2098.java
new file mode 100644
index 000000000..8edec5603
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2098.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Import;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+
+
+/**
+ * BP2098.
+ * <context>For a candidate wsdl:import element</context>
+ * <assertionDescription>The "location" attribute is specified for the wsdl:import element, and has a non-empty value.</assertionDescription>
+ */
+public class BP2098 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2098(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Import im = (Import) entryContext.getEntry().getEntryDetail();
+ // suppose that if location is invalid, the definition equals to null
+ if (im.getLocationURI() == null || im.getLocationURI() == "")
+ errors.add(im.getNamespaceURI(), im.getLocationURI());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2101.java
new file mode 100644
index 000000000..27e5736fb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2101.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.TestUtils;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.w3c.dom.Document;
+
+
+/**
+ * BP2101.
+ * <context>For a candidate wsdl:definition, if it contains wsdl:import statements</context>
+ * <assertionDescription>Each wsdl:import statement is only used to import another WSDL description.</assertionDescription>
+ */
+public class BP2101 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2101(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ boolean importFound = false;
+
+ /* Create falure report if import contains reference to non WSDL description.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Import, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Import im, Object parent, WSDLTraversalContext ctx)
+ {
+ importFound = true;
+
+ // by the way : WSDL4J throws Exception if imported WSDL is not resolved
+ // but documentation says that im.getDefinition() will be equal to null
+ if (im.getDefinition() == null)
+ errors.add(
+ im.getNamespaceURI()
+ + ":"
+ + im.getLocationURI()
+ + "\nImport element does not reference a WSDL definition.");
+ else
+ try
+ {
+ // try to parse WSDL according to the WSDL schema
+ Document doc =
+ validator.parseXMLDocumentURL(
+ im.getLocationURI(),
+ ((Definition)parent).getDocumentBaseURI(),
+ TestUtils.getWSDLSchemaLocation());
+ }
+ catch (Throwable t)
+ {
+ errors.add(
+ im.getNamespaceURI()
+ + ":"
+ + im.getLocationURI()
+ + "\n"
+ + Utils.getExceptionDetails(t));
+ }
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+ traversal.ignoreReferences();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2102.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2102.java
new file mode 100644
index 000000000..3bf34b417
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2102.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2102.
+ * <context>For a candidate wsdl:types element, with XML schema import elements</context>
+ * <assertionDescription>Each XML schema import statement (xsd:import) is only used to directly reference an XML schema definition, which has "schema" from XML namespace "http://www.w3.org/2001/XMLSchema" as root element. It does not contain a reference to another document embedding the XML schema definition (e.g. WSDL).</assertionDescription>
+ */
+public class BP2102 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2102(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean importFound = false;
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // parse WSDL as XML
+ try
+ {
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+ List exts = t.getExtensibilityElements();
+
+ Definition definition = null;
+ if ((definition = validator.analyzerContext.getCandidateInfo().getDefinition(t))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ if (exts != null)
+ {
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement
+ && el.getElementType().equals(ELEM_XSD_SCHEMA))
+ testNode(((UnknownExtensibilityElement) el).getElement(),
+ definition.getDocumentBaseURI());
+
+ if (result.equals(AssertionResult.RESULT_FAILED))
+ {
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+ }
+ }
+
+ if (!importFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ catch (Throwable tt)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "WSDL document can not be processed",
+ entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Check node is xsd import and it is
+ * only used to directly reference an XML schema definition, which has "schema"
+ * from XML namespace "http://www.w3.org/2001/XMLSchema" as root element.
+ * And it does not contain a reference to another document embedding the XML schema
+ * definition (e.g. WSDL).
+ * @param n - Unknown extensibility element
+ */
+ private void testNode(Node n, String context)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ importFound = true;
+
+ Element im = (Element) n;
+ // Getting the schemaLocation and the namespace attributes
+ Attr schemaLocation =
+ XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ Attr namespace = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ // If there is only the namespace attribute of import element
+ if (schemaLocation == null && namespace != null)
+ {
+ // Getting all the inline schemas of the wsdl definition
+ Map schemasMap = validator.wsdlDocument.getSchemas();
+ // If an inline schema imported is defined
+ if (schemasMap.keySet().contains(namespace.getValue()))
+ {
+ // If an inline schema imported is defined
+ // (that means the schema is valid),
+ // continue with the next element
+ n = n.getNextSibling();
+ continue;
+ }
+
+ // no schemaLocation so try the namespace
+ schemaLocation = namespace;
+ }
+
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ {
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ // !! ATTENTION
+ // root XSD SCHEMA SCHEMA is not valid
+ //Document schema = XMLUtils.parseXMLDocumentURL(schemaLocation.getValue(), XSD_SCHEMALOCATION, context);
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+
+ // If the import is valid, then check its contents
+ if (XMLUtils
+ .equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ // Check content of imported document
+ testNode(schema.getDocumentElement().getFirstChild(),
+ XMLUtils.createURLString(schemaLocation.getValue(), context));
+ }
+
+ else
+ {
+ throw new Exception();
+ }
+ }
+ catch (Throwable t)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = schemaLocation.getValue();
+ break;
+ }
+ }
+ else
+ {
+ //result = AssertionResult.RESULT_FAILED;
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetailMessage =
+ "schemaLocation == null and namespace == null";
+ break;
+ }
+ }
+ testNode(n.getFirstChild(), context);
+ }
+ n = n.getNextSibling();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2103.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2103.java
new file mode 100644
index 000000000..c3d9e2f26
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2103.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2103.
+ * <context>For each a candidate wsdl:definitions</context>
+ * <assertionDescription>For the referenced definitions as well as all imported
+ * descriptions, The XML schema import statement is only used within an xsd:schema
+ * element.</assertionDescription>
+ */
+public class BP2103 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2103(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* Check all unknown extensibility elements it is not xsd import.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ ExtensibilityElement el,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (el instanceof UnknownExtensibilityElement)
+ searchForImport(((UnknownExtensibilityElement) el).getElement());
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ //processWSDL(entryContext.getWSDLDocument().getFilename());
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.ignoreImport();
+ traversal.visitExtensibilityElement(true);
+
+ traversal.ignoreReferences();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Create falure report if node is xsd import.
+ * @param n - node
+ */
+ private void searchForImport(Node n)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ Attr a =
+ XMLUtils.getAttribute((Element) n, ATTR_XSD_SCHEMALOCATION);
+ String schemaLocation = (a != null) ? a.getValue() : "";
+ a = XMLUtils.getAttribute((Element) n, ATTR_XSD_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ errors.add(new QName(namespace, schemaLocation));
+ }
+
+ else
+ {
+ // if xsd:schema element is found -> process schema
+ if (!XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ searchForImport(n.getFirstChild());
+ }
+ }
+
+ n = n.getNextSibling();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2104.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2104.java
new file mode 100644
index 000000000..309e09e87
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2104.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.NullUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2104.
+ * <context>For a candidate wsdl:import</context>
+ * <assertionDescription>The targetNamespace attribute on the wsdl:definitions element for the imported WSDL description has the same value as the namespace attribute on the wsdl:import element that imported the WSDL description.</assertionDescription>
+ */
+public class BP2104 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2104(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ private boolean importFound = false;
+
+ /* Create falure report if namespace of wsdl:import does not equal targetnamespace in referenced wsdl.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Import, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Import im, Object parent, WSDLTraversalContext ctx)
+ {
+ importFound = true;
+ Definition def = im.getDefinition();
+ if (def != null)
+ {
+ if (!NullUtil.equals(im.getNamespaceURI(), def.getTargetNamespace()))
+ errors.add(
+ new QName(im.getNamespaceURI(), im.getLocationURI()),
+ new QName(def.getTargetNamespace(), def.getDocumentBaseURI()));
+ }
+ }
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+ traversal.ignoreReferences();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2105.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2105.java
new file mode 100644
index 000000000..775a47463
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2105.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2105.
+ * <context>For a candidate wsdl:definitions</context>
+ * <assertionDescription>For the referenced definitions, as well as all imported descriptions, in the WSDL namespace under the wsdl:defintitions element, the wsdl:import element is either directly after the wsdl:documentation element or is the first child element if the wsdl:documentation element is not present.</assertionDescription>
+ */
+public class BP2105 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2105(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ private boolean importFound = false;
+
+ /*
+ * Check wsld import element is either directly after the wsdl:documentation element
+ * or is the first child element if the wsdl:documentation element is not present.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Import, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Import im, Object parent, WSDLTraversalContext ctx)
+ {
+ importFound = true;
+ if (im.getDefinition() != null && im.getLocationURI() != null)
+ processWSDL(im.getDefinition().getDocumentBaseURI());
+ }
+
+ /*
+ * Check element is extensibility.
+ * @param el - xml element
+ * @return boolean
+ */
+ private boolean isExtensibilityElement(Element el)
+ {
+ boolean isEx = true;
+ isEx = isEx && !XMLUtils.equals(el, WSDL_BINDING);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DEFINITIONS);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DOCUMENTATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_FAULT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_IMPORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_INPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_MESSAGE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OPERATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OUTPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PART);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORTTYPE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_SERVICE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_TYPES);
+
+ return isEx;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ // Get the definition element that will be analyzed
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ // If it doesn't contain any imports, then the result is notApplicable
+ if ((definition.getImports() == null)
+ || (definition.getImports().size() == 0))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Else analyze the
+ else
+ {
+ processWSDL(definition.getDocumentBaseURI());
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse(
+ (Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * the method loads WSDL and check structure
+ * @param location
+ */
+ private void processWSDL(String location)
+ {
+ try
+ {
+ // parses WSDL
+ Document doc = validator.parseXMLDocumentURL(location, null);
+ checkWSDL(doc.getDocumentElement()); // get definition
+ }
+ catch (Throwable t)
+ {
+ // ADD: add exception handling
+ //System.err.println("2105 - WSDL load failed");
+ errors.add(t.toString());
+ }
+ }
+
+ /*
+ * Create falure report contains information of node.
+ * @param root
+ */
+ private void createFailed(Node root)
+ {
+ Attr a = XMLUtils.getAttribute((Element) root, ATTR_WSDL_LOCATION);
+ String schemaLocation = (a != null) ? a.getValue() : "";
+ a = XMLUtils.getAttribute((Element) root, ATTR_WSDL_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ errors.add(new QName(namespace, schemaLocation));
+ }
+
+ /*
+ * Check wsdl correspons assertion description.
+ * @param root - definition
+ */
+ private void checkWSDL(Node root)
+ {
+ if (root != null)
+ {
+ // Find the first import element
+ Element im = XMLUtils.findChildElement((Element) root, WSDL_IMPORT);
+
+ // Determine if a documentation element is present in the WSDL document
+ boolean documentIsPresent =
+ (XMLUtils.findChildElement((Element) root, WSDL_DOCUMENTATION)
+ != null);
+
+ // Verify that all import elements occur after a documentation element
+ while (im != null)
+ {
+ // Find elements that are previous to the import element
+ Element el = XMLUtils.findPreviousSibling(im);
+ if (el != null)
+ while (isExtensibilityElement(el) && el != null)
+ if (el != null)
+ el = XMLUtils.findPreviousSibling(el);
+
+ // If the wsdl:document elemnt is present
+ if (documentIsPresent && el != null)
+ {
+ if (!XMLUtils.equals(el, WSDL_DOCUMENTATION) && !XMLUtils.equals(el, WSDL_IMPORT))
+ createFailed(root);
+ }
+
+ // Else check if it is another wsdl: element
+ else if (el != null)
+ {
+ // If not the definitions element, then check for other wsdl: element
+ if (!XMLUtils.equals(el, WSDL_DEFINITIONS) && !XMLUtils.equals(el, WSDL_IMPORT))
+ {
+ if (el.getNamespaceURI().equals(WSIConstants.NS_URI_WSDL))
+ createFailed(root);
+ }
+ }
+
+ // Get the next import element
+ im = XMLUtils.findElement(im, WSDL_IMPORT);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2107.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2107.java
new file mode 100644
index 000000000..ace270048
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2107.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2107.
+ * <context>For a candidate wsdl:types element containing an xsd:schema element</context>
+ * <assertionDescription>The xsd:schema element contains a targetNamespace attribute with a valid and non-null value unless the xsd:schema element has xsd:import and/or xsd:annotation as its only child element(s).</assertionDescription>
+ */
+public class BP2107 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2107(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean schemaFound = false;
+ private ErrorList errors = new ErrorList();
+ private String context;
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+ List exts = t.getExtensibilityElements();
+ if (exts != null)
+ {
+ context =
+ entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI();
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement)
+ searchForSchema(((UnknownExtensibilityElement) el).getElement());
+ }
+ }
+
+ // context = entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI();
+ // processWSDL(entryContext.getWSDLDocument().getFilename());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!schemaFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Check node schema or load schema from inmport if it exists and process it.
+ * @param n - node
+ */
+ private void searchForSchema(Node n)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ // if xsd:schema element is found -> process schema
+ if (XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ {
+ schemaFound = true;
+ processSchema(n, null);
+ }
+
+ else
+ {
+ // if xsd:import element is found -> load schema and process schema
+ //if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ // loadSchema(n);
+ //else
+ // else iterate element recursively
+ searchForSchema(n.getFirstChild());
+ }
+ }
+
+ n = n.getNextSibling();
+ }
+ }
+
+ /*
+ * Load schema and process it.
+ * @param importNode - xsd:import element
+ */
+ private void loadSchema(Node importNode)
+ {
+ Element im = (Element) importNode;
+ Attr schemaLocation = XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+ if (XMLUtils.equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ processSchema(schema.getDocumentElement(), namespace);
+ }
+ }
+ catch (Throwable t)
+ {
+ // nothing. it's not a schema
+ }
+ }
+
+ /*
+ * Create falure report if it's not correspons assertion description.
+ * @param schema - xsd:schema
+ * @param namespace - namespace of schema
+ */
+ private void processSchema(Node schema, String namespace)
+ {
+ Attr a =
+ XMLUtils.getAttribute((Element) schema, ATTR_XSD_TARGETNAMESPACE);
+ String targetNamespace = (a != null) ? a.getValue() : null;
+
+ Node n = schema.getFirstChild();
+ // !! we suppose that xsd:import element is occured only within xsd:schema element
+ boolean containsOnlyImportAndAnnotation = true;
+ while (n != null)
+ {
+ if (n.getNodeType() == Node.ELEMENT_NODE)
+ {
+ containsOnlyImportAndAnnotation
+ &= (XMLUtils.equals(n, ELEM_XSD_IMPORT)
+ || XMLUtils.equals(n, ELEM_XSD_ANNOTATION));
+ }
+
+ //if (Node.ELEMENT_NODE == n.getNodeType() && XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ // loadSchema(n);
+
+ n = n.getNextSibling();
+ }
+
+ // If the target namespace is not set and there are elements in addition to import and annotation, then error
+ if ((targetNamespace == null || targetNamespace.length() == 0)
+ && (!containsOnlyImportAndAnnotation))
+ {
+ errors.add(targetNamespace, XMLUtils.serialize((Element) schema));
+ }
+
+ if (namespace != null && !namespace.equals(targetNamespace))
+ {
+ errors.add(namespace, XMLUtils.serialize((Element) schema));
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2108.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2108.java
new file mode 100644
index 000000000..cb203ce78
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2108.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+
+
+/**
+ * BP2108.
+ * <context>For a candidate wsdl:types, with Array declarations either locally defined or from an imported description</context>
+ * <assertionDescription>The type soapenc:Array does not appear in these declarations, and the wsdl:arrayType attribute is not used in the type declaration.</assertionDescription>
+ */
+public class BP2108 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2108(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+
+ // Search the definitions in CandidateInfo to locate the definition element that contains the specified types element
+ Definition definition = null;
+ if ((definition = validator.analyzerContext.getCandidateInfo().getDefinition(t))
+ == null)
+ {
+ // This should never happen, but if it does then throw an execption
+ throw new WSIException("Could not locate types element definition.");
+ }
+
+ else
+ {
+ TypesRegistry registry =
+ new TypesRegistry(
+ t,
+ definition.getDocumentBaseURI(),
+ validator);
+
+ Iterator it = registry.getArrayTypes().iterator();
+ while (it.hasNext())
+ errors.add((QName) it.next());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2110.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2110.java
new file mode 100644
index 000000000..6ed79109a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2110.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+
+
+/**
+ * BP2110.
+ * <context>For a candidate wsdl:types</context>
+ * <assertionDescription>Array declaration wrapper elements does not use the naming convention ArrayOfXXX.</assertionDescription>
+ */
+public class BP2110 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2110(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_WARNING;
+
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+
+ // Search the definitions in CandidateInfo to locate the definition element that contains the specified types element
+ Definition definition = null;
+ if ((definition = validator.analyzerContext.getCandidateInfo().getDefinition(t))
+ == null)
+ {
+ // This should never happen, but if it does then throw an execption
+ throw new WSIException("Could not locate types element definition.");
+ }
+
+ else
+ {
+ TypesRegistry registry =
+ new TypesRegistry(
+ t,
+ definition.getDocumentBaseURI(),
+ validator);
+
+ Iterator it = registry.getElementList().iterator();
+ while (it.hasNext())
+ {
+ QName type = (QName) it.next();
+ if (type.getLocalPart().startsWith("ArrayOf"))
+ errors.add(type);
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2111.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2111.java
new file mode 100644
index 000000000..4d641dbfb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2111.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2111.
+ * <context>For a candidate wsdl:binding, which contains a document-literal soap:binding</context>
+ *
+ * <assertionDescription>If the "parts" attribute is present, then the soapbind:body element(s) have at most one part listed in the parts attribute.</assertionDescription>
+ */
+public class BP2111 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2111(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean docLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * Put in context soap binding's style
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /*
+ * Verify style of soap operation is "document" if not then it's canceled process.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+
+ /*
+ * If use of soap body is "literal" and parts of soap body is more than one it creates falure report.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // assert style == "document"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse()))
+ {
+ docLiteralFound = true;
+
+ List parts = body.getParts();
+ if (parts != null && parts.size() > 1)
+ //how to pick out one body from another one ?
+ errors.add(body.getElementType(), body.getNamespaceURI());
+ }
+ }
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);;
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!docLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2112.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2112.java
new file mode 100644
index 000000000..494d8bbc9
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2112.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2112.
+ * <context>For a candidate wsdl:binding, with a style "rpc" attribute and containing at least a soapbind:body element</context>
+ * <assertionDescription>No wsdl:part referred by such a soapbind:body element is defined using the "element" attribute.</assertionDescription>
+ */
+public class BP2112 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2112(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean rpcLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+ private Message message = null;
+
+ /*
+ * Put in context soap binding's style
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("bindingStyle", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.BindingOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ BindingOperation op,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ ctx.removeParameter("operationStyle");
+ }
+
+ /*
+ * Verify style of soap operation is "rpc" if not then it's canceled process.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ ctx.addParameter("operationStyle", operation.getStyle());
+ }
+
+ /*
+ * If use of soap body is "literal" and if at least one part is define using "element" attribute it creates falure report.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ String opStyle = (String) ctx.getParameter("operationStyle");
+ String bStyle = (String) ctx.getParameter("bindingStyle");
+
+ if ((opStyle == null
+ && !WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(bStyle))
+ || (opStyle != null
+ && !WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(opStyle)))
+ {
+ ctx.cancelBindingOperationProcessing();
+ return;
+ }
+ // assert use == "literal"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse()))
+ {
+ rpcLiteralFound = true;
+
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+ // if some links are broken, cancel processing
+ if (op == null
+ || (parent instanceof BindingInput && op.getInput() == null)
+ || (parent instanceof BindingOutput && op.getOutput() == null))
+ return;
+
+ Message m =
+ (parent instanceof BindingInput)
+ ? op.getInput().getMessage()
+ : op.getOutput().getMessage();
+ // REMOVE: current message should equals to message given as entry
+ //if (m == null || message != m)
+ if (m == null)
+ return;
+
+ List parts =
+ WSDLUtil.getParts(
+ op,
+ m,
+ body,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC);
+ if (parts == null)
+ return;
+
+ /* check whether parts list contains a parts which uses
+ * element attribute. If so, part name will be added into
+ * errors set.
+ */
+ Iterator it = parts.iterator();
+ while (it.hasNext())
+ {
+ Part part = (Part) it.next();
+ if (part.getElementName() != null)
+ errors.add(part.getName());
+ }
+ }
+ }
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+ // save message
+ //message = (Message)entryContext.getEntry().getEntryDetail();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);;
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitBindingOperation(true);
+ traversal.visitSOAPOperation(true);
+ traversal.visitSOAPBody(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!rpcLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2113.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2113.java
new file mode 100644
index 000000000..7aef537ca
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2113.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2113.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The soapbind:header, soapbind:headerfault and soapbind:fault elements only refer to wsdl:part element(s) that have been defined using the "element" attribute.</assertionDescription>
+ */
+public class BP2113 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2113(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * Verify soap header uses part is define using "element" attribute
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ Definition d = (Definition) ctx.getParameter("definition");
+ Message m = d.getMessage(header.getMessage());
+ if (m != null)
+ checkPart(m.getPart(header.getPart()), ctx.getBinding());
+ }
+
+ /*
+ * Verify soap headerfault uses part is define using "element" attribute
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault fault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ Definition d = (Definition) ctx.getParameter("definition");
+ Message m = d.getMessage(fault.getMessage());
+ // if message or part is not found - NOT_APPLICABLE ????
+ if (m != null)
+ checkPart(m.getPart(fault.getPart()), ctx.getBinding());
+ }
+
+ /*
+ * Verify soap fault uses part is define using "element" attribute
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
+ {
+ String faultName = fault.getName();
+ if (faultName == null)
+ faultName = ctx.getBindingFault().getName();
+ Operation op = ctx.getBindingOperation().getOperation();
+ if (op == null /* || faultName == null*/
+ ) // may be it's possible to have legal fault with null name
+ return;
+ // we suppose that SOAPFault.getName() corresponds to the abstract operation's fault name
+ Fault f = op.getFault(faultName);
+ if (f == null)
+ return;
+ Message m = f.getMessage();
+ // message should have only one part
+ if (m == null || m.getParts() == null || m.getParts().size() != 1)
+ return;
+ checkPart((Part) m.getOrderedParts(null).get(0), ctx.getBinding());
+ }
+
+ /*
+ * Verify part is define using "element" attribute.
+ * @param p - part
+ * @param b - binding
+ */
+ // refactoring
+ private void checkPart(Part p, Binding b)
+ {
+ if (p != null && p.getElementName() == null)
+ errors.add(b.getQName(), p.getName());
+ }
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);;
+ traversal.setVisitor(this);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+
+ Map m = new HashMap();
+ Definition def = entryContext.getWSDLDocument().getDefinitions();
+ WSDLUtil.expandDefinition(def);
+ m.put("definition", def);
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail(), m);
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2114.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2114.java
new file mode 100644
index 000000000..7987053cb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2114.java
@@ -0,0 +1,278 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2114.
+ * <context>For a candidate wsdl:binding element</context>
+ *
+ *
+ * <assertionDescription>Every wsdl:part from each wsdl:message in the associated
+ * wsdl:portType is referenced either by the soapbind:body, soapbind:header,
+ * soapbind:fault, or soapbind:headerfault.</assertionDescription>
+ */
+public class BP2114 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2114(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ // map Message QName -> set(Part name)
+ public Map messages = new HashMap();
+
+ /*
+ * Add to Map parts which used by message
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message m, Object parent, WSDLTraversalContext ctx)
+ {
+ if (m != null
+ && !messages.containsKey(m)
+ && m.getOrderedParts(null) != null)
+ {
+ Set s = new HashSet();
+ Iterator it = m.getOrderedParts(null).iterator();
+ while (it.hasNext())
+ s.add(((Part) it.next()).getName());
+
+ //messages.put(m.getQName(), s);
+ if (s.size() > 0)
+ {
+ messages.put(m.getQName(), s);
+ }
+ }
+ }
+
+ /*
+ * Put in context style of soap binding
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style != null)
+ ctx.addParameter("style", style);
+ }
+
+ /*
+ * Remove parts of soap body from Map.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // String style = (String)ctx.getParameter("style");
+
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+ // if some links are broken, cancel processing
+ if (op == null)
+ return;
+ Message m = null;
+ if (parent instanceof BindingInput)
+ {
+ if (op.getInput() == null)
+ return;
+ m = op.getInput().getMessage();
+ }
+ else if (parent instanceof BindingOutput)
+ {
+ if (op.getOutput() == null)
+ return;
+ m = op.getOutput().getMessage();
+ }
+ if (m == null)
+ return;
+
+ // get parts
+ List parts = WSDLUtil.getParts(op, m, body, null);
+ if (parts == null)
+ return;
+
+ // iterate all parts and check
+ Iterator it = parts.iterator();
+ while (it.hasNext())
+ removePart(m.getQName(), ((Part) it.next()).getName());
+ }
+
+ /*
+ * Remove parts of soap header from Map.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // we suppose that it possible to have legal message and part with null names
+ // ATTENTION
+ // should we add message which is referenced by header or headerfault to messages ?
+ removePart(header.getMessage(), header.getPart());
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault fault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // we suppose that it possible to have legal message and patr with null names
+ QName messageName = fault.getMessage();
+ if (messageName == null)
+ messageName = ctx.getSOAPHeader().getMessage();
+ removePart(messageName, fault.getPart());
+ }
+
+ /*
+ * Remove parts of soap fault from Map.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
+ {
+ String faultName = fault.getName();
+ if (faultName == null)
+ faultName = ctx.getBindingFault().getName();
+ Operation op = ctx.getBindingOperation().getOperation();
+ if (op == null)
+ return;
+
+ // we suppose that SOAPFault.getName() corresponds to the abstract operation's fault name
+ Fault f = op.getFault(faultName);
+
+ // fault message should have 1 part
+ if (f == null
+ || f.getMessage() == null
+ || f.getMessage().getParts().size() != 1)
+ return;
+
+ Part p = (Part) f.getMessage().getOrderedParts(null).get(0);
+ removePart(f.getMessage().getQName(), p.getName());
+ }
+
+ /*
+ * Remove part from Map.
+ * @param messageName - message
+ * @param partName - part
+ */
+ // refatoring
+ private void removePart(QName messageName, String partName)
+ {
+ Set parts = (Set) messages.get(messageName);
+ if (parts != null)
+ {
+ parts.remove(partName);
+ if (parts.size() == 0)
+ messages.remove(messageName);
+ }
+ }
+
+ /*
+ * Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_WARNING;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitMessage(true);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+ traversal.visitSOAPOperation(true);
+
+ Binding b = (Binding) entryContext.getEntry().getEntryDetail();
+ traversal.traverse(b);
+
+ if (messages.size() > 0)
+ errors.add(b.getQName());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2115.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2115.java
new file mode 100644
index 000000000..85626a071
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2115.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2115.
+ * <context>For a candidate wsdl:message</context>
+ * <assertionDescription>An "element" attribute on any wsdl:part element refers to a global element declaration.</assertionDescription>
+ */
+public class BP2115 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2115(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private TypesRegistry registry = null;
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Part, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Part part, Object parent, WSDLTraversalContext ctx)
+ {
+ if (part.getElementName() != null
+ && registry.getType(part.getElementName()) == null)
+ {
+ errors.add(ctx.getMessage().getQName());
+ ctx.cancelMessageProcessing();
+ }
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ registry =
+ new TypesRegistry(
+ entryContext.getWSDLDocument().getDefinitions(),
+ validator);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitPart(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Message) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2116.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2116.java
new file mode 100644
index 000000000..810e74d60
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2116.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2116.
+ * <context>For a candidate wsdl:message element</context>
+ * <assertionDescription>The wsdl:message element does not contain part elements that use both "type" and "element" attributes.</assertionDescription>
+ */
+public class BP2116 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2116(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Part, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Part part, Object parent, WSDLTraversalContext ctx)
+ {
+ if (part.getElementName() != null && part.getTypeName() != null)
+ {
+ errors.add(ctx.getMessage().getQName());
+ ctx.cancelMessageProcessing();
+ }
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitPart(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Message) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2117.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2117.java
new file mode 100644
index 000000000..00fa22c46
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2117.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2117.
+ * <context>For a candidate wsdl:binding element, referred to by an rpc-literal soap:binding</context>
+ * <assertionDescription>The rpc-literal binding does not have a namespace attribute specified on a contained soapbind:header, soapbind:headerfault, and soapbind:fault element.</assertionDescription>
+ */
+public class BP2117 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2117(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean rpcLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /*
+ * If use of soap body is "literal" and if at least one part is define using "element" attribute it creates falure report.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // assert use == "literal"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse())
+ && ((String) ctx.getParameter("style")).equals(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC))
+ {
+ rpcLiteralFound = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ check(header.getUse(), header.getNamespaceURI(), ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault fault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ check(fault.getUse(), fault.getNamespaceURI(), ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
+ {
+ check(fault.getUse(), fault.getNamespaceURI(), ctx);
+ }
+
+ // refactoring
+ // check LITERAL use and != namespace
+ // canceling further processing
+ private void check(String use, String namespace, WSDLTraversalContext ctx)
+ {
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(use)
+ && namespace != null)
+ {
+ errors.add(ctx.getBinding().getQName());
+ // suppresses subsequent processing, because error list contains only failed binding
+ ctx.cancelProcessing();
+ }
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+ traversal.visitSOAPOperation(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!rpcLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2118.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2118.java
new file mode 100644
index 000000000..ef814613d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2118.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Operation;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2118.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The list (or set) of wsdl:operation elements for the contained wsdl:binding is the same as the list of wsdl:operations for the referred wsdl:portType.</assertionDescription>
+ */
+public class BP2118 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2118(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Operation op, Object parent, WSDLTraversalContext ctx)
+ {
+ // assert parent instanceof BindingOperation
+ if (op == null)
+ {
+ errors.add(ctx.getBinding().getQName());
+ // suppresses subsequent processing, because error list contains only failed binding
+ ctx.cancelBindingProcessing();
+ ctx.cancelBindingOperationProcessing();
+ }
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Binding b = (Binding) entryContext.getEntry().getEntryDetail();
+ // if operations count in port type and binding is differ -> error
+ if (b.getPortType() == null
+ || b.getPortType().getOperations().size()
+ != b.getBindingOperations().size())
+ errors.add(b.getQName());
+ else
+ {
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.traverse(b);
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2119.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2119.java
new file mode 100644
index 000000000..94aff8c62
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2119.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Operation;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2119.
+ * <context>For a candidate wsdl:binding, which is of type document-literal</context>
+ * <assertionDescription>If it does not specify the parts attribute on a soapbind:body element, the corresponding abstract wsdl:message defines zero or one wsdl:part.</assertionDescription>
+ */
+public class BP2119 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2119(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean docLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ String use =
+ (body.getUse() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT
+ : body.getUse();
+
+ // assert style == "document"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(use))
+ {
+ docLiteralFound = true;
+ if (body.getParts() == null)
+ {
+ Operation op = ctx.getBindingOperation().getOperation();
+ if (op == null)
+ return;
+
+ Map parts = null;
+ if (parent instanceof BindingInput)
+ {
+ if (op.getInput() == null || op.getInput().getMessage() == null)
+ return;
+ parts = op.getInput().getMessage().getParts();
+ }
+ else if (parent instanceof BindingOutput)
+ {
+ if (op.getOutput() == null || op.getOutput().getMessage() == null)
+ return;
+ parts = op.getOutput().getMessage().getParts();
+ }
+
+ if (parts != null && parts.size() > 1)
+ {
+ errors.add(ctx.getBinding().getQName());
+ // suppresses subsequent processing, because error list contains only failed binding
+ ctx.cancelBindingProcessing();
+ ctx.cancelBindingOperationProcessing();
+ ctx.cancelBindingInputProcessing();
+ ctx.cancelBindingOutputProcessing();
+ }
+ }
+ }
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!docLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2120.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2120.java
new file mode 100644
index 000000000..5416e6e2a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2120.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2120.
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>Each operation referenced by the binding results in a unique wire signature.</assertionDescription>
+ */
+public class BP2120 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2120(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private Set wares = new HashSet();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style != null)
+ ctx.addParameter("style", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ List signature = new LinkedList();
+
+ String style = (String) ctx.getParameter("style");
+
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+
+ // if some links are broken, cancel processing
+ if (op == null
+ || op.getInput() == null
+ || op.getInput().getMessage() == null)
+ return;
+ Message m = op.getInput().getMessage();
+
+ List parts = WSDLUtil.getParts(op, m, body, style);
+ if (parts == null)
+ return;
+ // !! ATTENTION
+ // may be required to add types instead of part into signature ?
+
+ // create signature
+ signature.addAll(parts);
+
+ // suppose that wire signature for
+ // - rpc style = operation name + parts' qname
+ // - document style = parts' qname
+ if (WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(style))
+ signature.add(0, op.getName());
+
+ if (sameSignature(wares, signature))
+ errors.add(op.getName());
+ else
+ wares.add(signature);
+ }
+
+ /**
+ * Check if the signature is in the set match.
+ */
+ private boolean sameSignature(Set signatureSet, List signature)
+ {
+ boolean same = false;
+
+ // Get iterator for set
+ Iterator set = signatureSet.iterator();
+ while (set.hasNext() && !same)
+ {
+ // Get next signature from the set
+ List nextSignature = (List) set.next();
+
+ // Only continue if the signatures are the same size
+ if (nextSignature.size() == signature.size())
+ {
+ Iterator iterator1 = nextSignature.iterator();
+ Iterator iterator2 = signature.iterator();
+
+ // Assume same until a difference is found
+ same = true;
+
+ // Process each list until a difference is found
+ while (iterator1.hasNext() && iterator2.hasNext() && same)
+ {
+ // Get the next elements
+ Object element1 = iterator1.next();
+ Object element2 = iterator2.next();
+
+ // If the element is a string, then if equal check parts
+ if ((element1 instanceof String)
+ && (element2 instanceof String)
+ && (((String) element1).equals((String) element2)))
+ {
+ same = true;
+ }
+
+ // If the elements are parts, then check if they are equal
+ else if ((element1 instanceof Part) && (element2 instanceof Part))
+ {
+ same = sameParts((Part) element1, (Part) element2);
+ }
+
+ else
+ {
+ same = false;
+ }
+ }
+ }
+ }
+
+ return same;
+ }
+
+ /**
+ * Check if two parts are the same.
+ */
+ private boolean sameParts(Part part1, Part part2)
+ {
+ boolean same = false;
+
+ // If the part has an element then see if they are the same
+ if (part1.getElementName() != null
+ && part2.getElementName() != null
+ && part1.getElementName().equals(part2.getElementName()))
+ {
+ same = true;
+ }
+
+ // If the part has an type then see if they are the same
+ else if (
+ part1.getTypeName() != null
+ && part2.getTypeName() != null
+ && part1.getTypeName().equals(part2.getTypeName()))
+ {
+ same = true;
+ }
+
+ else
+ {
+ same = false;
+ }
+
+ return same;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+ traversal.ignoreBindingOutput();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ // !! ATTENTION
+ // Analyze soapbind:body:namespace and service targetNamespace
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2121.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2121.java
new file mode 100644
index 000000000..8cb92ee8c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2121.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.util.WSDLUtil;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2121.
+ * Context:
+ * For a wsdl:binding element which is referenced directly or associated
+ * with a specified wsdl:port.
+ *
+ * Assertion Description:
+ * Each operation referenced by a document-literal binding must have a
+ * message definition where the wsdl:part references a global element
+ * definition.
+ */
+public class BP2121 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2121(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private TypesRegistry registry = null;
+
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // !! ATTENTION
+ // we suppose that soapbody child elements is its parts.
+ // assert style == "document"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse()))
+ {
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+ // if some links are broken, cancel processing
+ if (op == null
+ || (parent instanceof BindingInput && op.getInput() == null)
+ || (parent instanceof BindingOutput && op.getOutput() == null))
+ return;
+
+ Message m =
+ (parent instanceof BindingInput)
+ ? op.getInput().getMessage()
+ : op.getOutput().getMessage();
+ if (m == null)
+ return;
+
+ // find parts which are involved in the given body
+ List parts =
+ WSDLUtil.getParts(
+ op,
+ m,
+ body,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC);
+ if (parts == null)
+ return;
+
+ // check parts
+ Iterator it = parts.iterator();
+ while (it.hasNext())
+ {
+ Part p = (Part) it.next();
+ // check whether p declared as global element
+ if (p.getElementName() == null
+ || registry.getType(p.getElementName()) == null)
+ {
+ errors.add(op.getName());
+ // suppresses subsequent processing, because error list contains only failed operation
+ ctx.cancelBindingOperationProcessing();
+ }
+ }
+ }
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ registry =
+ new TypesRegistry(
+ entryContext.getWSDLDocument().getDefinitions(),
+ validator);
+
+ // collect all types from messages to checkedParts map
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2122.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2122.java
new file mode 100644
index 000000000..c4a5afb16
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2122.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+
+
+/**
+ * BP2122.
+ * <context>For a candidate wsdl:types element</context>
+ * <assertionDescription>The data type definition if any within the wsdl:types element is an XML schema definition defined in the XML Schema 1.0 Recommendation with the namespace URI "http://www.w3.org/2001/XMLSchema".</assertionDescription>
+ */
+public class BP2122 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2122(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private String context;
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+ ErrorList errorList = new ErrorList();
+
+ // Get the types from the entry context
+ Types types = (Types) entryContext.getEntry().getEntryDetail();
+
+ Definition definition = null;
+
+ if (types != null)
+ {
+ if ((definition =
+ validator.analyzerContext.getCandidateInfo().getDefinition(types))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ context = definition.getDocumentBaseURI();
+
+ ExtensibilityElement extElement;
+ List extElements = types.getExtensibilityElements();
+
+ // Process each ext. element
+ for (int i = 0; i < extElements.size(); i++)
+ {
+ // If it is an unknown ext. element and it is a schema, then check it
+ if ((extElement = (ExtensibilityElement) extElements.get(i))
+ instanceof UnknownExtensibilityElement)
+ {
+ if (!extElement.getElementType().equals(WSITag.ELEM_XSD_SCHEMA))
+ {
+ // If it is not a schema definition, then it is an error
+ errorList.add(
+ extElement.getElementType().toString()
+ + " can not be a child of the wsdl:types element.");
+ }
+ }
+ }
+ }
+
+ // If XMLSchemaValidator could not find any errors, check errors from the inline schema validator
+ if (errorList.isEmpty())
+ errorList.add(validator.wsdlDocument.getSchemasValidationErrors());
+
+ if (!errorList.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errorList.toString(), entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2123.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2123.java
new file mode 100644
index 000000000..392d06f4e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2123.java
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+
+/**
+ * BP2123.
+ * <context>For a candidate wsdl:definitions, if it contains a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message</context>
+ * <assertionDescription>Contained WSDL extension elements do not use the wsdl:required attribute value of "true".</assertionDescription>
+ */
+public class BP2123 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2123(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean claimFound = false;
+
+ private static final String PORT_KEY = "port";
+ private static final String BINDING_KEY = "binding";
+ private static final String PORT_TYPE_KEY = "port type";
+ private static final String OPERATION_KEY = "operation";
+ private static final String MESSAGE_KEY = "message";
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port != null)
+ {
+ if (containsLegalClaim(port.getDocumentationElement()))
+ {
+ claimFound = true;
+ ctx.addParameter(PORT_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ ctx.addParameter(PORT_KEY, Boolean.FALSE);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Binding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Binding binding, Object parent, WSDLTraversalContext ctx)
+ {
+ if (binding != null)
+ {
+ Boolean port = (Boolean) ctx.getParameter(PORT_KEY);
+
+ if (port.booleanValue())
+ {
+ ctx.addParameter(BINDING_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(binding.getDocumentationElement());
+ ctx.addParameter(
+ BINDING_KEY,
+ new Boolean(containsLegalClaim(binding.getDocumentationElement())));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.PortType, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(PortType type, Object parent, WSDLTraversalContext ctx)
+ {
+ if (type != null)
+ {
+ Boolean binding = (Boolean) ctx.getParameter(BINDING_KEY);
+
+ if (binding.booleanValue())
+ {
+ ctx.addParameter(PORT_TYPE_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(type.getDocumentationElement());
+ ctx.addParameter(
+ PORT_TYPE_KEY,
+ new Boolean(containsLegalClaim(type.getDocumentationElement())));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ Operation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (operation != null)
+ {
+ Boolean type = (Boolean) ctx.getParameter(PORT_TYPE_KEY);
+
+ if (type.booleanValue())
+ {
+ ctx.addParameter(OPERATION_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(operation.getDocumentationElement());
+ ctx.addParameter(
+ OPERATION_KEY,
+ new Boolean(
+ containsLegalClaim(operation.getDocumentationElement())));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx)
+ {
+ if (message != null)
+ {
+ Boolean operation = (Boolean) ctx.getParameter(OPERATION_KEY);
+
+ if (operation.booleanValue())
+ {
+ ctx.addParameter(MESSAGE_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(message.getDocumentationElement());
+ ctx.addParameter(
+ MESSAGE_KEY,
+ new Boolean(containsLegalClaim(message.getDocumentationElement())));
+ }
+ }
+ }
+
+ /*
+ public void visit(BindingOperation operation, Object parent, WSDLTraversalContext ctx) {
+ if (operation != null) {
+ if (containsLegalClaim(operation.getDocumentationElement())) {
+ System.out.println("binding operation found");
+ } else {
+
+ }
+ }
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+
+ public void visit(
+ ExtensibilityElement el,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ boolean required =
+ el != null
+ && el.getRequired() != null
+ && el.getRequired().booleanValue();
+
+ if (isParentConforms(parent, ctx))
+ {
+ if (required)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetailMessage = el.toString();
+ }
+ }
+ }
+
+ /**
+ * Indicates whether the parent element conforms to the basic profile.
+ * @param parent
+ * @param ctx
+ * @return boolean
+ */
+ private boolean isParentConforms(Object parent, WSDLTraversalContext ctx)
+ {
+ boolean result = false;
+
+ if (parent instanceof Port)
+ {
+ result = ((Boolean) ctx.getParameter(PORT_KEY)).booleanValue();
+ }
+ else if (
+ parent instanceof Binding
+ || parent instanceof BindingOperation
+ || parent instanceof BindingInput
+ || parent instanceof BindingOutput
+ || parent instanceof BindingFault)
+ {
+ result = ((Boolean) ctx.getParameter(BINDING_KEY)).booleanValue();
+ }
+ else if (parent instanceof PortType)
+ {
+ result = ((Boolean) ctx.getParameter(PORT_TYPE_KEY)).booleanValue();
+ }
+ else if (
+ parent instanceof Operation
+ || parent instanceof Input
+ || parent instanceof Output
+ || parent instanceof Fault)
+ {
+ result = ((Boolean) ctx.getParameter(OPERATION_KEY)).booleanValue();
+ }
+ else if (parent instanceof Message || parent instanceof Part)
+ {
+ result = ((Boolean) ctx.getParameter(MESSAGE_KEY)).booleanValue();
+ }
+
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Expect wsdl:defintions
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ //((Service)def.getServices().values().toArray()[0]).getPorts()
+ // Traverse WSDL
+ WSDLTraversal traversal = new WSDLTraversal();
+ // VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.visitBinding(true);
+ traversal.visitMessage(true);
+ traversal.visitPort(true);
+ traversal.visitPortType(true);
+ traversal.visitExtensibilityElement(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreDefinition2Binding();
+ traversal.ignoreDefinition2Element();
+ traversal.ignoreDefinition2ExtensibilityElement();
+ traversal.ignoreDefinition2Message();
+ traversal.ignoreDefinition2PortType();
+ traversal.ignoreDefinition2Types();
+
+ traversal.traverse(def);
+
+ if (!claimFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else if (result.equals(AssertionResult.RESULT_WARNING))
+ {
+ failureDetail = this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim with
+ * legal schema definition URI.
+ * legal is 'http://ws-i.org/schemas/conformanceClaim/'
+ * @param el
+ * @return boolean
+ */
+ private boolean containsClaim(Element el)
+ {
+ if (el == null)
+ return false;
+ // find claim
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+ if (el != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim with
+ * legal schema definition URI.
+ * legal is 'http://ws-i.org/schemas/conformanceClaim/'
+ * @param el
+ * @return boolean
+ */
+ private boolean containsLegalClaim(Element el)
+ {
+ if (el == null)
+ return false;
+ // find claim
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+ while (el != null)
+ {
+ String value = el.getAttribute(ATTR_CLAIM_CONFORMSTO.getLocalPart());
+ if (value != null
+ && value.equalsIgnoreCase(WSIConstants.ATTRVAL_UDDI_CLAIM_KEYVALUE))
+ {
+ return true;
+ }
+
+ el = XMLUtils.findElement(el, WSI_CLAIM);
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2201.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2201.java
new file mode 100644
index 000000000..fdabb10ce
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2201.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+
+import javax.wsdl.Definition;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.StringTokenizer;
+
+/**
+ * BP2201.
+ * <context>For a candidate Web service definition within a WSDL document with a XML declaration statement. </context>
+ * <assertionDescription>The XML declaration statement uses UTF-8 or UTF-16 for the encoding. </assertionDescription>
+ */
+public class BP2201 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2201(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private final char[] OMMITED_XML_DECLARATION_DELIMITERS = new char[]{0x20,
+ 0x9, 0xD, 0xA, '\'', '\"'};
+ private final char[] XML_DECLARATION_DELIMITERS = new char[]{'='};
+ private final String UTF_8_ENCODING = "UTF-8";
+ private final String UTF_16_ENCODING = "UTF-16";
+ private final String ENCODING_TOKEN = "encoding";
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion,
+ * org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(TestAssertion testAssertion,
+ EntryContext entryContext) throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+ Definition definition = (Definition) entryContext.getEntry()
+ .getEntryDetail();
+ String location = definition.getDocumentBaseURI();
+ String xmlDecl = readXMLDeclarationStatement(location);
+ if (xmlDecl == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ } else
+ {
+ if (!validEncoding(xmlDecl))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(xmlDecl, entryContext);
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+ /**
+ * Reads an XML declaration statement.
+ *
+ * @param location
+ * @return String
+ */
+ private String readXMLDeclarationStatement(String location)
+ {
+ String result = null;
+ if (location != null)
+ {
+ URL url = null;
+ Reader reader = null;
+ try
+ {
+ try
+ {
+ url = new URL(location);
+ } catch (MalformedURLException e)
+ {
+ // we should try to access location as file
+ }
+ if (url != null)
+ {
+ reader = new InputStreamReader(url.openStream());
+ } else
+ {
+ reader = new InputStreamReader(new FileInputStream(location));
+ }
+ int charCode;
+ boolean end = false;
+ if (reader.ready())
+ {
+ charCode = reader.read();
+ while (reader.ready() && !(charCode == '<'))
+ {
+ charCode = reader.read();
+ }
+ char[] c = new char[4];
+ reader.read(c);
+ StringBuffer buf = new StringBuffer();
+ if (new String(c).toLowerCase().equals("?xml"))
+ {
+ buf.append("<?xml");
+ while (reader.ready() && !end)
+ {
+ charCode = reader.read();
+ buf.append((char) charCode);
+ end = charCode == '>';
+ }
+ } else
+ {
+ // NOTE: This result does not get propogated back!
+ this.result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return null;
+ }
+ result = buf.toString();
+ }
+ } catch (Exception e)
+ {
+ //VERBOSE
+ if (validator.verboseOption)
+ {
+ System.err.println(" [WSI2201] Exception: " + e.getMessage());
+ }
+ } finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ } catch (Throwable e)
+ {
+ }
+ }
+ }
+ }
+ return result;
+ }
+ /*
+ * Verify xml declaration contains utf-16 or utf-8 encoding. @param xmlDecl -
+ * xml declaration @return
+ */
+ private boolean validEncoding(String xmlDecl)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st = new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS, XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+ if (token.equals(ENCODING_TOKEN))
+ {
+ found = true;
+ tokens.nextElement();
+ String enc = (String) tokens.nextElement();
+ result = UTF_8_ENCODING.equalsIgnoreCase(enc)
+ || UTF_16_ENCODING.equalsIgnoreCase(enc);
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2202.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2202.java
new file mode 100644
index 000000000..1078c7be2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2202.java
@@ -0,0 +1,423 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.util.StringTokenizer;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2202.
+ * <context>For a candidate wsdl:types element within a WSDL document which imports an XML schema directly or indirectly.</context>
+ * <assertionDescription>The imported schema uses UTF-8 or UTF-16 for the encoding.</assertionDescription>
+ */
+public class BP2202 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private boolean importFound = false;
+
+ private final char[] OMMITED_XML_DECLARATION_DELIMITERS =
+ new char[] { 0x20, 0x9, 0xD, 0xA, '\'', '\"' };
+ private final char[] XML_DECLARATION_DELIMITERS = new char[] { '=' };
+ private final String UTF_8_ENCODING = "UTF-8";
+ private final String UTF_16_ENCODING = "UTF-16";
+
+ private final String ENCODING_TOKEN = "encoding";
+ private final String VERSION_TOKEN = "version";
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ //Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ Types types = (Types) entryContext.getEntry().getEntryDetail();
+ List exts = null;
+ //if (def.getTypes() != null)
+ if (types != null)
+ //exts = def.getTypes().getExtensibilityElements();
+ exts = types.getExtensibilityElements();
+ if (exts != null)
+ {
+ Definition definition = null;
+ if ((definition =
+ validator.analyzerContext.getCandidateInfo().getDefinition(types))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement
+ && el.getElementType().equals(ELEM_XSD_SCHEMA))
+ searchForSchema(((UnknownExtensibilityElement) el).getElement(),
+ definition.getDocumentBaseURI());
+ }
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param n - node
+ */
+ private void searchForSchema(Node n, String context)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ // if xsd:schema element is found -> process schema
+ if (XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ {
+ processSchema(n, context);
+ }
+ else
+ {
+ // if xsd:import element is found -> load schema and process schema
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ importFound = true;
+ loadSchema(n, context);
+ }
+ else
+ // else iterate element recursively
+ searchForSchema(n.getFirstChild(), context);
+ }
+ }
+ n = n.getNextSibling();
+ }
+ }
+
+ /*
+ * It loads xsd schema and then check valid encoding and looking for xsd:schema element for next process.
+ * @param importNode - xsd schema
+ */
+ private void loadSchema(Node importNode, String context)
+ {
+ Element im = (Element) importNode;
+ Attr schemaLocation = XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ String decl =
+ readXMLDeclarationStatement(schemaLocation.getValue(), context);
+ if (!validDeclaration(decl,
+ ENCODING_TOKEN,
+ new String[] { UTF_8_ENCODING, UTF_16_ENCODING }))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ errors.add((a != null) ? a.getValue() : "");
+ }
+
+ if (!validDeclaration(decl, "version", new String[] { "1.0" }))
+ {
+ errors.add(
+ "Version number in XML declaration is not 1.0. XML schema file: "
+ + schemaLocation.getValue());
+ }
+
+ // DEBUG:
+ // System.out.println(schemaLocation.getValue() + ":" + context);
+
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+
+ if (XMLUtils.equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ processSchema(schema.getDocumentElement(),
+ XMLUtils.createURLString(schemaLocation.getValue(), context));
+ }
+ result = result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+
+ /**
+ * Reads an XML declaration statement.
+ * @param location
+ * @return String
+ */
+ private String readXMLDeclarationStatement(String location, String baseURI)
+ {
+ String result = null;
+ try
+ {
+ new URL(location);
+ }
+ catch (Throwable t)
+ {
+ // nothing
+ int i = baseURI.lastIndexOf('/');
+ int j = baseURI.lastIndexOf('\\');
+ if (j > i)
+ i = j;
+ location = baseURI.substring(0, i + 1) + location;
+ }
+
+ if (location != null)
+ {
+ URL url = null;
+ Reader reader = null;
+
+ try
+ {
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // we should try to access location as file
+ }
+
+ if (url != null)
+ {
+ reader = new InputStreamReader(url.openStream());
+ }
+ else
+ {
+ reader = new InputStreamReader(new FileInputStream(location));
+ }
+
+ int charCode;
+ boolean end = false;
+ if (reader.ready())
+ {
+ charCode = reader.read();
+
+ while (reader.ready() && !(charCode == '<'))
+ {
+ charCode = reader.read();
+ }
+
+ StringBuffer buf = new StringBuffer();
+ if (charCode == '<')
+ {
+ buf.append((char) charCode);
+ while (reader.ready() && !end)
+ {
+ charCode = reader.read();
+ buf.append((char) charCode);
+
+ end = charCode == '>';
+ }
+ }
+ else
+ {
+ // NOTE: This result does not get propogated back!
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "Cannot read the XML declaration statement.";
+ }
+
+ result = buf.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ errors.add(e.getMessage());
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * @param xmlDecl - xml declaration
+ * @return if xml declaration contains encoding="utf-16" or encoding="utf-8" it retirns true.
+ */
+
+ private boolean validEncoding(String xmlDecl)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st =
+ new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS,
+ XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+
+ if (token.equals(ENCODING_TOKEN))
+ {
+ found = true;
+
+ tokens.nextElement();
+ String enc = (String) tokens.nextElement();
+
+ result =
+ UTF_8_ENCODING.equalsIgnoreCase(enc)
+ || UTF_16_ENCODING.equalsIgnoreCase(enc);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @param xmlDecl - xml declaration
+ * @return if xml declaration contains valid version number then true is returned.
+ */
+ private boolean validDeclaration(
+ String xmlDecl,
+ String tokenName,
+ String[] checkValueList)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st =
+ new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS,
+ XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+
+ if (tokens.hasMoreElements())
+ {
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+
+ if (token.equals(tokenName))
+ {
+ found = true;
+ result = false;
+
+ tokens.nextElement();
+ String tokenValue = (String) tokens.nextElement();
+
+ for (int i = 0; i < checkValueList.length && !result; i++)
+ {
+ if (checkValueList[i].equalsIgnoreCase(tokenValue))
+ result = true;
+ }
+ }
+ }
+ }
+
+ // If there are no tokens then it is not a valid declaraction
+ else
+ {
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * It's looking for xsd import and load it if find.
+ * @param schema - xsd schema
+ * @param namespace - namespace of schema
+ */
+ private void processSchema(Node schema, String context)
+ {
+ Node n = schema.getFirstChild();
+ while (n != null)
+ {
+ if (Node.ELEMENT_NODE == n.getNodeType()
+ && XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ importFound = true;
+ loadSchema(n, context);
+ }
+
+ n = n.getNextSibling();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2208.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2208.java
new file mode 100644
index 000000000..57fc3fa99
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2208.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Operation;
+import javax.wsdl.OperationType;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2208.
+ * <context>For a candidate wsdl:operation in a wsdl:portType definition</context>
+ * <assertionDescription>The wsdl:operation element is either a WSDL request/response or a one-way operation (no Notification or Sollicit-Response).</assertionDescription>
+ */
+public class BP2208 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2208(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Operation operation =
+ (Operation) entryContext.getEntry().getEntryDetail();
+ OperationType opType = operation.getStyle();
+ if ((opType == null)
+ || (!opType.equals(OperationType.ONE_WAY)
+ && !opType.equals(OperationType.REQUEST_RESPONSE)))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ if (opType == null)
+ failureDetail =
+ this.validator.createFailureDetail(
+ "Could not determine the operation type for "
+ + operation.getName()
+ + ".",
+ entryContext);
+ else
+ failureDetail = null; // none defined in TAD at present
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2402.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2402.java
new file mode 100644
index 000000000..6068be631
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2402.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2402.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The wsdl:binding element has a soapbind:binding child element.</assertionDescription>
+ */
+public class BP2402 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2402(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ // Get the port from the entry context
+ //Port port = (Port) entryContext.getEntry().getEntryDetail();
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ // Test the assertion
+ // Check that there is at least one SOAP Binding
+ if (soapBinding != null)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ failureDetail = null;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2404.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2404.java
new file mode 100644
index 000000000..9e60fa0b6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2404.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2404.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The contained soap:binding element has a "transport" attribute, which has value: http://schemas.xmlsoap.org/soap/http.</assertionDescription>
+ */
+public class BP2404 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2404(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ // Test the assertion
+ // Check for Soap binding namespace
+ if ((soapBinding == null)
+ || (soapBinding.getTransportURI() == null)
+ || !soapBinding.getTransportURI().equals(WSIConstants.NS_URI_SOAP_HTTP))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ this.validator.createFailureDetail(
+ soapBinding == null
+ ? "WSDL document does not contain SOAP binding element."
+ : soapBinding.toString(),
+ entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2406.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2406.java
new file mode 100644
index 000000000..cd3917d6e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2406.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2406.
+ * <context>For a candidate wsdl:binding element, if the use attribute is specified on the soapbind:body, soapbind:fault, soapbind:header, or soapbind:headerfault elements.</context>
+ * <assertionDescription>The use attribute has a value of "literal".</assertionDescription>
+ */
+public class BP2406 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2406(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get SOAP body elements
+ SOAPBody[] soapBodies = this.validator.getSoapBodies(binding);
+
+ // ADD: What happens if there are no soap body elements? Right now the TA result is NA.
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapBodies.length; i++)
+ {
+ SOAPBody soapBody = soapBodies[i];
+ if (soapBody.getUse() != null
+ && !soapBody.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(soapBody.toString(), entryContext);
+ break;
+ }
+ }
+
+ // Get SOAP fault elements
+ SOAPFault[] soapFaults = this.validator.getSoapFaults(binding);
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapFaults.length; i++)
+ {
+ SOAPFault soapFault = soapFaults[i];
+ if (soapFault.getUse() != null
+ && !soapFault.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ (failureDetailMessage == null
+ ? soapFault.toString()
+ : failureDetailMessage + "\n\n" + soapFault.toString());
+ if (failureDetail == null)
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ else
+ failureDetail.setFailureMessage(failureDetailMessage);
+ break;
+ }
+ }
+
+ // Get SOAP header elements
+ SOAPHeader[] soapHeaders = this.validator.getSoapHeaders(binding);
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapHeaders.length; i++)
+ {
+ SOAPHeader soapHeader = soapHeaders[i];
+ if (soapHeader.getUse() != null
+ && !soapHeader.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ (failureDetailMessage == null
+ ? soapHeader.toString()
+ : failureDetailMessage + "\n\n" + soapHeader.toString());
+ if (failureDetail == null)
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ else
+ failureDetail.setFailureMessage(failureDetailMessage);
+ break;
+ }
+ }
+
+ // Get SOAP header fault elements
+ SOAPHeaderFault[] soapHeaderFaults = this.validator.getSoapHeaderFaults(binding);
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapHeaderFaults.length; i++)
+ {
+ SOAPHeaderFault soapHeaderFault = soapHeaderFaults[i];
+ if (soapHeaderFault.getUse() != null
+ && !soapHeaderFault.getUse().equals(
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ (failureDetailMessage == null
+ ? soapHeaderFault.toString()
+ : failureDetailMessage + "\n\n" + soapHeaderFault.toString());
+ if (failureDetail == null)
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ else
+ failureDetail.setFailureMessage(failureDetailMessage);
+ break;
+ }
+ }
+
+ // If the result is passed, but there was nothing to check then set to notApplicable
+ if (result == AssertionResult.RESULT_PASSED
+ && (soapBodies == null || soapBodies.length == 0)
+ && (soapFaults == null || soapFaults.length == 0)
+ && (soapHeaders == null || soapHeaders.length == 0)
+ && (soapHeaderFaults == null || soapHeaderFaults.length == 0))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2416.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2416.java
new file mode 100644
index 000000000..9db9cd284
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2416.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+* BP2416.
+* <context>For a candidate wsdl:definitions</context>
+* <assertionDescription>Every QName in the WSDL document and its imports, is referencing an element in a namespace that has either been imported or defined in the WSDL document that contains the reference.</assertionDescription>
+*/
+public class BP2416 extends AssertionProcessVisitor
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2416(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private static final String NS_LIST_KEY = "namespaces";
+
+ /**
+ * Checks whether the namespace is defined or imported in the definition.
+ * @param qname
+ * @param ctx
+ */
+ private void checkNamespace(QName qname, WSDLTraversalContext ctx)
+ {
+ if (qname != null)
+ {
+ String namespace = qname.getNamespaceURI();
+
+ if (namespace != null)
+ {
+ List namespaces = (List) ctx.getParameter(NS_LIST_KEY);
+
+ if (!namespaces.contains(namespace))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = namespace;
+
+ ctx.cancelProcessing();
+ }
+ } // ??? should we do something otherwise
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port != null)
+ {
+ Binding binding = port.getBinding();
+ if (binding != null)
+ {
+ checkNamespace(binding.getQName(), ctx);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Binding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Binding binding, Object parent, WSDLTraversalContext ctx)
+ {
+ if (binding != null)
+ {
+ PortType pType = binding.getPortType();
+ if (pType != null)
+ {
+ checkNamespace(pType.getQName(), ctx);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ Operation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (operation != null)
+ {
+ Input input = operation.getInput();
+ if (input != null && input.getMessage() != null)
+ {
+ checkNamespace(input.getMessage().getQName(), ctx);
+ }
+
+ Output output = operation.getOutput();
+ if (output != null && output.getMessage() != null)
+ {
+ checkNamespace(output.getMessage().getQName(), ctx);
+ }
+
+ Map faults = operation.getFaults();
+ for (Iterator iter = faults.values().iterator(); iter.hasNext();)
+ {
+ Fault fault = (Fault) iter.next();
+
+ if (fault.getMessage() != null)
+ {
+ checkNamespace(fault.getMessage().getQName(), ctx);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ /* REMOVE: This is already done in WSI2417
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx) {
+ if (message != null) {
+ Map parts = message.getParts();
+ for (Iterator iter = parts.values().iterator(); iter.hasNext();) {
+ Part part = (Part) iter.next();
+
+ checkNamespace(part.getElementName(), ctx);
+ checkNamespace(part.getTypeName(), ctx);
+ }
+ }
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ // get list of namespaces imported and defined in the definition
+ List namespaces = this.validator.getWSDLTargetNamespaceList(definition);
+
+ // REMOVE:
+ //Map namespaces = definition.getNamespaces();
+
+ // traverse definition to check namespaces
+ Map params = new HashMap();
+ params.put(NS_LIST_KEY, namespaces);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ // VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.visitBinding(true);
+ traversal.visitMessage(true);
+ traversal.visitPort(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreReferences();
+ traversal.traverse(definition, params);
+
+ if (result.equals(AssertionResult.RESULT_FAILED))
+ {
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2417.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2417.java
new file mode 100644
index 000000000..f5ec3b4d0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2417.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2417.
+ * <context>For a candidate wsdl:definitions</context>
+ * <assertionDescription>Every QName in the WSDL document and its imports and that
+ * is referring to a schema component, uses the namespace defined in the targetNamespace
+ * attribute on the xs:schema element, or a namespace defined in the namespace attribute
+ * on an xs:import element within the xs:schema element.</assertionDescription>
+ */
+public class BP2417 extends AssertionProcessVisitor
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2417(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errorList = new ErrorList();
+ private static final String NS_LIST_KEY = "namespaces";
+
+ /**
+ * Checks whether the namespace is defined or imported in the definition.
+ * @param qname
+ * @param ctx
+ */
+ private void checkNamespace(QName qname, WSDLTraversalContext ctx)
+ {
+ if (qname != null)
+ {
+ String namespace = qname.getNamespaceURI();
+
+ if (namespace != null)
+ {
+ List namespaceList = (List) ctx.getParameter(NS_LIST_KEY);
+
+ if ((namespaceList != null) && !namespaceList.contains(namespace))
+ {
+ errorList.add(qname);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx)
+ {
+ if (message != null)
+ {
+ Map parts = message.getParts();
+
+ for (Iterator iter = parts.values().iterator(); iter.hasNext();)
+ {
+ Part part = (Part) iter.next();
+
+ checkNamespace(part.getElementName(), ctx);
+ checkNamespace(part.getTypeName(), ctx);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ // Get a list of all schema targetNamespaces
+ List tnsList = null;
+ try
+ {
+ if ((tnsList = this.validator.getSchemaNamespaceList(definition)) == null)
+ tnsList = new Vector();
+ }
+
+ catch (WSIException e)
+ {
+ // This exception would indicate that the schema definition had a problem
+ tnsList = new Vector();
+ }
+
+ // Always add XML schema namespace to cover built-in types
+ tnsList.add(WSIConstants.NS_URI_XSD);
+
+ // Traverse definition to check schema namespaces
+ Map params = new HashMap();
+ params.put(NS_LIST_KEY, tnsList);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitMessage(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreReferences();
+ traversal.traverse(definition, params);
+
+ // If there were no errors, then the assertion passed
+ if (errorList.isEmpty())
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ // Otherwise it failed / create the failure detail using the QNames that were in error
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errorList.toString(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2700.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2700.java
new file mode 100644
index 000000000..e3837ed4e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2700.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.xml.sax.SAXException;
+
+/**
+ * BP2700.
+ * <context>For a candidate wsdl:definitions element within a WSDL document.</context>
+ * <assertionDescription>The wsdl:definitions is a well-formed XML 1.0 document.</assertionDescription>
+ */
+public class BP2700 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2700(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ try
+ {
+ //String wsdlURI = entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI();
+ // TEMP: Need to define a better way to get the WSDL URI
+ String wsdlURI = entryContext.getEntry().getReferenceID();
+ // non-validating parse
+ XMLUtils.parseXMLDocument(wsdlURI);
+ }
+
+ catch (WSIException e)
+ {
+ if (e.getTargetException() instanceof SAXException)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ Utils.getExceptionDetails(e.getTargetException()),
+ entryContext);
+ }
+ }
+
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(Utils.getExceptionDetails(e), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2701.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2701.java
new file mode 100644
index 000000000..9797964f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2701.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2701.
+ * <context>For a candidate wsdl:definitions element within a WSDL document.</context>
+ * <assertionDescription>The wsdl:definitions namespace has value: http://schemas.xmlsoap.org/wsdl/.</assertionDescription>
+ */
+public class BP2701 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2701(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+
+ /*
+ if (def != null) {
+ QName qname = def.getQName();
+
+ if (qname != null) {
+ //if (def.getNamespace("").equals(WSIConstants.NS_URI_WSDL) {
+ if (qname.getNamespaceURI().equals(WSIConstants.NS_URI_WSDL)) {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+ }
+ */
+
+ try
+ {
+ String schemaUsed = this.validator.getSchemaUsed(def);
+ if (schemaUsed.equals(WSIConstants.NS_URI_WSDL))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+ }
+
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ //ADD: failure description?
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2703.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2703.java
new file mode 100644
index 000000000..5557d21f6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2703.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.TestUtils;
+import org.eclipse.wst.wsi.internal.util.Utils;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.xml.sax.SAXException;
+
+
+/**
+ * BP2703.
+ * <context>For a candidate description within a WSDL document, if it uses the WSDL namespace</context>
+ * <assertionDescription>The definition conforms to the WSDL schema located at http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd</assertionDescription>
+ */
+public class BP2703 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2703(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ try
+ {
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+
+ if (def == null)
+ {
+ throw new AssertionFailException("Definition null");
+ }
+
+ String wsdlURI = entryContext.getEntry().getReferenceID();
+
+ Map namespaces = def.getNamespaces();
+ for (Iterator iter = namespaces.values().iterator(); iter.hasNext();)
+ {
+ String ns = (String) iter.next();
+
+ if (WSIConstants.NS_URI_WSDL.equalsIgnoreCase(ns))
+ {
+ XMLUtils.parseXMLDocument(wsdlURI, TestUtils.getWSDLSchemaLocation());
+ }
+
+ if (WSIConstants.NS_URI_WSDL_SOAP.equalsIgnoreCase(ns))
+ {
+ XMLUtils.parseXMLDocument(wsdlURI, TestUtils.getWSDLSOAPSchemaLocation());
+ }
+ }
+ }
+
+ catch (WSIException e)
+ {
+ if (e.getTargetException() instanceof SAXException)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ Utils.getExceptionDetails(e.getTargetException()),
+ entryContext);
+ }
+ }
+
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(Utils.getExceptionDetails(e), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2803.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2803.java
new file mode 100644
index 000000000..ce9bf9509
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP2803.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.net.URI;
+
+import javax.wsdl.Import;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionNotApplicableException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcess;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+
+
+/**
+ * BP2803
+ * <context>For a candidate wsdl:import element</context>
+ * <assertionDescription>The "namespace" attribute is specified for the wsdl:import element, and the attribute's value is not a relative URI.</assertionDescription>
+ */
+public class BP2803 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2803(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+
+ // Getting wsdl:import
+ Import im = (Import) entryContext.getEntry().getEntryDetail();
+
+ try
+ {
+ // If there is no the "namespace" attribute in the import,
+ // the assertion is not applicable
+ if (im.getNamespaceURI() == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // If a namespace URI is relative or invalid, the assertion failed
+ URI uri = new URI(im.getNamespaceURI());
+ if (!uri.isAbsolute())
+ {
+ throw new AssertionFailException(
+ im.getNamespaceURI() + " is relative URI.");
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ e.getMessage(), entryContext);
+ }
+
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4200.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4200.java
new file mode 100644
index 000000000..23cb4b783
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4200.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * BP4200.
+ * <context>For a candidate wsdl:definitions that contains a wsdl extension element or attribute from a namespace other than "http://schemas.xmlsoap.org/wsdl/soap/".</context>
+ * <assertionDescription>Contained WSDL extension elements that do not belong to the "http://schemas.xmlsoap.org/wsdl/soap/" namespaces may require out of band negotiation.</assertionDescription>
+*/
+public class BP4200 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+ private ErrorList errorList = new ErrorList();
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP4200(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(ExtensibilityElement obj, Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // If a child element of wsdl:types is from a namespace other than
+ // "http://www.w3.org/2001/XMLSchema"
+ if (parent instanceof Types)
+ {
+ //if (!obj.getElementType().getNamespaceURI().equals(
+ // WSIConstants.NS_URI_XSD))
+ //{
+ // Add element name to error list
+ // errorList.add(obj.getElementType());
+ //}
+ }
+ // or any other ext element coming from a namespace other than
+ // "http://schemas.xmlsoap.org/wsdl/soap/"
+ else if (!obj.getElementType().getNamespaceURI().equals(WSIConstants.NS_URI_WSDL_SOAP)
+ && !obj.getElementType().getNamespaceURI().equals(WSIConstants.NS_URI_WSDL))
+ {
+ // Add element name to error list
+ errorList.add(obj.getElementType());
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(TestAssertion testAssertion,
+ EntryContext entryContext) throws WSIException
+ {
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+
+ traversal.visitExtensibilityElement(true);
+ traversal.visitElement(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreReferences();
+ traversal.traverse(definition);
+
+ try
+ {
+ // getting WSDL document.
+ Document doc = XMLUtils.parseXMLDocument(definition.getDocumentBaseURI());
+ if (doc != null)
+ {
+ checkElement(doc.getDocumentElement());
+
+ if (errorList.isEmpty())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription() + "\n\n" + errorList.toString(),
+ entryContext);
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checking on wsdl elements recursively whether they contain extension attributes.
+ * @param elem Element.
+ */
+ private void checkElement(Element elem)
+ {
+ while (elem != null)
+ {
+ String elemNS = elem.getNamespaceURI();
+ NamedNodeMap attrs = elem.getAttributes();
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.getLength(); i++)
+ {
+ Attr attr = (Attr) attrs.item(i);
+ String attrNS = attr.getNamespaceURI();
+ if (attrNS != null
+ && !attrNS.equals(WSIConstants.NS_URI_XMLNS)
+ && !attrNS.equals(WSIConstants.NS_URI_WSDL)
+ && !attrNS.equals(WSIConstants.NS_URI_WSDL_SOAP))
+ {
+ errorList.add("Extensibility attribute " + attr.getName()
+ + "for the " + elem.getNodeName() + " element is found.");
+ }
+ }
+ }
+
+ if (!elemNS.equals(WSIConstants.NS_URI_XSD))
+ {
+ checkElement(XMLUtils.getFirstChild(elem));
+ }
+ elem = XMLUtils.getNextSibling(elem);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4201.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4201.java
new file mode 100644
index 000000000..81aaa5991
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4201.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.net.URISyntaxException;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPAddress;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+* BP4201.
+* <context>For a candidate wsdl:import element, where the location attribute or the namespace attribute has a value that is a relative URI, or a for soap:address element where the location attribute is a relative URI.</context>
+* <assertionDescription>The use of a relative URI as the value for a wsdl:import location or namespace attribute, or for a soap:address location attribute may require out of band coordination.</assertionDescription>
+*/
+public class BP4201 extends AssertionProcessVisitor
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP4201(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+ private ErrorList errorList = new ErrorList();
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Import, Object, WSDLTraversalContext)
+ */
+ public void visit(Import obj, Object parent, WSDLTraversalContext ctx)
+ {
+ if(obj != null)
+ {
+ if(isRelativeURI(obj.getNamespaceURI()) ||
+ isRelativeURI(obj.getLocationURI()))
+ {
+ errorList.add(obj.getNamespaceURI(), obj.getLocationURI());
+ }
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Port, Object, WSDLTraversalContext)
+ */
+ public void visit(Port obj, Object parent, WSDLTraversalContext ctx)
+ {
+ if(obj != null)
+ {
+ Iterator it = obj.getExtensibilityElements().iterator();
+ while (it.hasNext())
+ {
+ Object e = (Object) it.next();
+ // for each SOAPAddress elements check LocationURI
+ if(e instanceof SOAPAddress) {
+ if(isRelativeURI(((SOAPAddress) e).getLocationURI()))
+ {
+ errorList.add(((SOAPAddress) e).getElementType() +
+ ":" + ((SOAPAddress) e).getLocationURI());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+ traversal.visitPort(true);
+ traversal.ignoreReferences();
+ traversal.traverse(definition);
+
+ if (errorList.isEmpty())
+ {
+ return validator.createAssertionResult(testAssertion,
+ AssertionResult.RESULT_NOT_APPLICABLE, (String) null);
+ }
+
+ failureDetail = this.validator.createFailureDetail(testAssertion.getFailureMessage() +
+ "\n\n" + errorList.toString(), entryContext);
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+ /**
+ * Returns true if URI is relative
+ * @param s - URI
+ * @return true - if URI is relative, false - in other case
+ */
+ private boolean isRelativeURI(String s)
+ {
+ if(s == null)
+ return false;
+ try
+ {
+ if(new java.net.URI(s).isAbsolute())
+ {
+ return false;
+ }
+ } catch (URISyntaxException e)
+ {
+ return false;
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4202.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4202.java
new file mode 100644
index 000000000..715c20726
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/BP4202.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLDocumentCache;
+import org.eclipse.wst.wsi.internal.xml.schema.XMLSchemaProcessor;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP4202.
+ * <context>For an XML schema definition defined in the wsdl:types element, or imported directly or indirectly by a schema definition defined in the wsdl:types element, which contains any schema annotation elements.</context>
+ * <assertionDescription>An XML schema definition defined in the wsdl:types element, or imported directly or indirectly by a schema definition defined in the wsdl:types element, may use schema annotation elements as an extensibility mechanism.</assertionDescription>
+ */
+ public class BP4202 extends AssertionProcessVisitor implements WSITag
+ {
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP4202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private static final String ANNOTATION_KEY = "annotation";
+
+ private ErrorList errorList = new ErrorList();
+ private AnnotationProcessor processor;
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Message, Object, WSDLTraversalContext)
+ */
+ public void visit(ExtensibilityElement obj, Object parent, WSDLTraversalContext ctx)
+ {
+ if((obj != null) && (obj instanceof UnknownExtensibilityElement))
+ {
+ UnknownExtensibilityElement el = (UnknownExtensibilityElement) obj;
+ try {
+ processor.processAllSchema(el.getElement());
+ } catch (WSIException e) {}
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the types from the entry context
+ Types types =
+ (Types) entryContext.getEntry().getEntryDetail();
+
+ processor = new AnnotationProcessor(
+ entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI(),
+ validator.getDocumentList());
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitExtensibilityElement(true);
+ traversal.ignoreReferences();
+ traversal.traverse(types);
+
+ if (errorList.isEmpty())
+ {
+ return validator.createAssertionResult(testAssertion,
+ AssertionResult.RESULT_NOT_APPLICABLE, (String) null);
+ }
+
+ failureDetail = this.validator.createFailureDetail(testAssertion.getFailureMessage() +
+ "\n\n" + errorList.toString(), entryContext);
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Class for parse schema and search annotation elements
+ */
+ class AnnotationProcessor extends XMLSchemaProcessor
+ {
+ public AnnotationProcessor(
+ String context,
+ XMLDocumentCache documentList)
+ {
+ super(context, documentList, false);
+ }
+
+ protected void processSchema(Element element)
+ {
+ checkForAnnotation(element);
+ }
+
+ private void checkForAnnotation(Node node)
+ {
+ if((node.getLocalName() != null) && (node.getLocalName().equals(ANNOTATION_KEY))) {
+ errorList.add(node.toString());
+ }
+ for (int i = 0; i < node.getChildNodes().getLength(); i++)
+ {
+ checkForAnnotation(node.getChildNodes().item(i));
+ }
+ }
+ }
+ } \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2209.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2209.java
new file mode 100644
index 000000000..85d602375
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2209.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+
+/**
+ * SSBP2209
+ *
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The wsdl:binding binds every wsdl:part of a wsdl:message in the wsdl:portType to which it refers to one of soapbind:body, soapbind:header, soapbind:fault or soapbind:headerfault.</assertionDescription>
+ */
+public class SSBP2209 extends BP2114
+{
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public SSBP2209(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2402.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2402.java
new file mode 100644
index 000000000..ee49a3f68
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2402.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * SSBP2402
+ */
+public class SSBP2402 extends BP2402
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public SSBP2402(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2403.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2403.java
new file mode 100644
index 000000000..f5c0bdce5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/SSBP2403.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLTraversal;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * SSBP2403.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>Descendant elements and attributes in the wsdl:binding are not from the namespaces for the WSDL MIME, HTTP GET/POST or DIME binding extensions.</assertionDescription>
+ */
+public class SSBP2403 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public SSBP2403(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+
+ private ErrorList errors = new ErrorList();
+
+ /**
+ * Returns true if the the namespace specifies any WSDL MIME,
+ * HTTP GET/POST or DIME binding extensions.
+ * @param namespace a namespace.
+ * @return true if the the namespace specifies any WSDL MIME,
+ * HTTP GET/POST or DIME binding extensions.
+ */
+ private boolean isNonConformantBindingExtension(String namespace)
+ {
+ boolean result = false;
+ if (namespace != null)
+ {
+ if (namespace.equals(WSIConstants.NS_NAME_WSDL_MIME)
+ || namespace.equals(WSIConstants.NS_NAME_WSDL_HTTP)
+ || namespace.equals(WSIConstants.NS_NAME_WSDL_DIME))
+ result = true;
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ ExtensibilityElement exel,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (isNonConformantBindingExtension(exel
+ .getElementType()
+ .getNamespaceURI()))
+ errors.add(exel.getElementType());
+ else
+ {
+ // extensibility element is ok, check the descendants
+ if (exel instanceof UnknownExtensibilityElement)
+ {
+ Element el = ((UnknownExtensibilityElement) exel).getElement();
+
+ // traverse all of the descendants and check for non compliant binding extensions
+ XMLTraversalCheckingExtensions traversal =
+ new XMLTraversalCheckingExtensions();
+ traversal.visit(el);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitElement(true);
+ traversal.visitExtensibilityElement(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+
+ /**
+ * A specialized XMLTraversal class to check if the wsdl:binding element has any
+ * descendant elements/attributes from the namespaces for the WSDL MIME,
+ * HTTP GET/POST or DIME binding extensions.
+ */
+ private class XMLTraversalCheckingExtensions extends XMLTraversal
+ {
+ boolean nonConformantExtensionFound = false;
+
+ /* (non-Javadoc)
+ * @see org.wsi.xml.XMLTraversal#action(org.w3c.dom.Node)
+ */
+ public boolean action(Node n)
+ {
+ return !nonConformantExtensionFound;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.xml.XMLVisitor#visit(org.w3c.dom.Attr)
+ */
+ public void visit(Attr node)
+ {
+ if (action(node))
+ {
+ if (isNonConformantBindingExtension(node.getNamespaceURI()))
+ {
+ errors.add(node.getName());
+ nonConformantExtensionFound = true;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.xml.XMLVisitor#visit(org.w3c.dom.Element)
+ */
+ public void visit(Element node)
+ {
+ if (action(node))
+ {
+ if (isNonConformantBindingExtension(node.getNamespaceURI()))
+ {
+ errors.add(node.getNodeName());
+ nonConformantExtensionFound = true;
+ }
+ else
+ {
+ // element is compliant, check attributes and descendants
+ visit(node.getAttributes());
+ for (Node n = node.getFirstChild();
+ n != null;
+ n = n.getNextSibling())
+ {
+ doVisit(n);
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSDLValidatorImpl.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSDLValidatorImpl.java
new file mode 100644
index 000000000..7293901cf
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSDLValidatorImpl.java
@@ -0,0 +1,2319 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.eclipse.wst.wsi.internal.WSIConstants;
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSIRuntimeException;
+import org.eclipse.wst.wsi.internal.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.analyzer.CandidateInfo;
+import org.eclipse.wst.wsi.internal.analyzer.ServiceReference;
+import org.eclipse.wst.wsi.internal.analyzer.config.WSDLElement;
+import org.eclipse.wst.wsi.internal.profile.ProfileArtifact;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.WSDLValidator;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.BaseValidatorImpl;
+import org.eclipse.wst.wsi.internal.report.Entry;
+import org.eclipse.wst.wsi.internal.report.EntryContainer;
+import org.eclipse.wst.wsi.internal.report.FailureDetail;
+import org.eclipse.wst.wsi.internal.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.report.Reporter;
+import org.eclipse.wst.wsi.internal.util.EntryType;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLDocument;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLElementList;
+import org.eclipse.wst.wsi.internal.wsdl.WSDLUtils;
+import org.eclipse.wst.wsi.internal.xml.dom.ElementLocation;
+import org.eclipse.wst.wsi.internal.xml.schema.TargetNamespaceProcessor;
+import org.eclipse.wst.wsi.internal.xml.schema.XMLSchemaValidator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * The WSDL validator will verify that the WSDL and associated XML schema definitions
+ * are in conformance with the profile.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ * @author Graham Turrell (gturrell@uk.ibm.com)
+ */
+public class WSDLValidatorImpl
+ extends BaseValidatorImpl
+ implements WSDLValidator
+{
+ /**
+ * WSDL URL.
+ */
+ protected String wsdlURL;
+
+ /**
+ * WSDL document.
+ */
+ protected WSDLDocument wsdlDocument = null;
+
+ /**
+ * Entry container map.
+ */
+ protected HashMap containerMap = new HashMap();
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.WSDLValidator#init(org.wsi.test.analyzer.AnalyzerContext, org.wsi.test.profile.ProfileArtifact, org.wsi.test.report.ReportArtifact, java.lang.String, org.wsi.wsdl.WSDLDocument, org.wsi.test.report.Reporter)
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact profileArtifact,
+ ReportArtifact reportArtifact,
+ String wsdlURL,
+ WSDLDocument wsdlDocument,
+ Reporter reporter)
+ throws WSIException
+ {
+ // BaseValidatorImpl
+ super.init(analyzerContext, profileArtifact, reportArtifact, reporter);
+
+ this.wsdlDocument = wsdlDocument;
+ if (wsdlDocument != null)
+ this.wsdlURL = wsdlDocument.getLocation();
+
+ if (wsdlURL != null)
+ this.wsdlURL = wsdlURL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.WSDLValidator#validate()
+ */
+ public WSDLDocument validate() throws WSIException
+ {
+ //WSDLDocument wsdlDocument = null;
+ Entry entry = null;
+
+ Service service = null;
+ Port port = null;
+ Binding binding = null;
+ PortType portType = null;
+ Operation operation = null;
+ Message message = null;
+
+ // it depricated after refactoring
+ // now the inner classes moved out from validator
+ //String classPrefix = this.getClass().getName() + "$";
+ String classPrefix = this.getClass().getPackage().getName()+".";
+
+ try
+ {
+ // Validate the WSDL service description
+ if (this.wsdlDocument == null)
+ this.wsdlDocument = new WSDLDocument(wsdlURL);
+ }
+
+ catch (Exception e)
+ {
+ // ADD: Certain exceptions should result in validation errors
+
+ throw new WSIException(e.getMessage(), e);
+ }
+
+ // Get the definition element
+ Definition definition = wsdlDocument.getDefinitions();
+
+ // Get service reference from analyzer context
+ ServiceReference serviceReference = analyzerContext.getServiceReference();
+
+ // Create normalized data about the service under test.
+ CandidateInfo candidate = new CandidateInfo(serviceReference, wsdlDocument);
+
+ analyzerContext.setCandidateInfo(candidate);
+
+ // Set prereq type to entry container
+ reporter.setPrereqType(Reporter.PREREQ_TYPE_ENTRY_CONTAINER);
+
+ // always process Import, Definitions & Types assertions
+ // TEMP:
+ processDefinitionAssertions(classPrefix, candidate);
+ processTypesAssertions(classPrefix, candidate);
+ processImportAssertions(classPrefix, candidate);
+
+ // Process the element hierarchy in the WSDL document starting with the one that was specified
+ // FIX: Element finding already completed by CandidateInfo constructor - so use that rather than retest here
+
+ // ---------------------------
+ // wsdl:port
+ // ---------------------------
+ if (serviceReference.getWSDLElement().isPort())
+ {
+ // Find the service element
+ if ((service =
+ definition.getService(
+ serviceReference.getWSDLElement().getParentElementQName()))
+ == null)
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL service: "
+ + serviceReference.getWSDLElement().getParentElementName());
+ }
+
+ // Find the port element
+ if ((port = service.getPort(serviceReference.getWSDLElement().getName()))
+ == null)
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL port: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ // TEMP: Remove until there are port test assertions
+ //processPortAssertions(port, serviceReference, classPrefix, wsdlDocument);
+
+ // Next, process the binding
+ if (((binding = port.getBinding()) == null) || (binding.isUndefined()))
+ {
+ //throw new WSIRuntimeException("Could not locate WSDL binding for port: " + port.getName());
+ // Set missingInput for all binding, portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ processBindingAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Next, process the portType
+ if (((portType = binding.getPortType()) == null)
+ || (portType.isUndefined()))
+ {
+ //throw new WSIRuntimeException("Could not locate WSDL portType for binding: " + binding.getQName().getLocalPart());
+ // Set missingInput for all portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ processMessageAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processPortTypeAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processOperationAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processMessageAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+
+ }
+
+ // ---------------------------
+ // wsdl:binding
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isBinding())
+ {
+ WSDLElement wsdlElement = serviceReference.getWSDLElement();
+ // Find the binding element
+ if (wsdlElement.getQName() != null
+ && wsdlElement.getQName().getLocalPart() != null
+ && wsdlElement.getQName().getLocalPart().length() > 0)
+ {
+ if (((binding =
+ definition.getBinding(serviceReference.getWSDLElement().getQName()))
+ == null)
+ || (binding.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL binding: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ processBindingAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processMessageAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Next, process the portType
+ if (((portType = binding.getPortType()) == null)
+ || (portType.isUndefined()))
+ {
+ //throw new WSIRuntimeException("Could not locate WSDL PortType for Binding: " + binding.getQName().getLocalPart());
+
+ // Set missingInput for all portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ processPortTypeAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processOperationAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Process each message within each operation of the portType associated with the binding
+ processMessageAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+
+ // There was a problem with the binding element specification. This can
+ // happen when a UDDI tModel did not have a valid binding reference.
+ else
+ {
+ // Set missingInput for all binding, portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+ }
+
+ // ---------------------------
+ // wsdl:portType
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isPortType())
+ {
+ // Find the PortType element
+ if (((portType =
+ definition.getPortType(serviceReference.getWSDLElement().getQName()))
+ == null)
+ || (portType.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL PortType: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ // Set missingInput for all binding test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+
+ processPortTypeAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processOperationAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Process each message within each operation of the portType
+ processMessageAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+
+ // ---------------------------
+ // wsdl:operation
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isOperation())
+ {
+ // Find the operation
+ // get portType from config parent element
+ if (((portType =
+ definition.getPortType(
+ serviceReference.getWSDLElement().getParentElementQName()))
+ == null)
+ || (portType.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL portType: "
+ + serviceReference.getWSDLElement().getParentElementQName());
+ }
+
+ if (((operation =
+ getOperationFromPortType(
+ portType,
+ serviceReference.getWSDLElement().getName()))
+ == null)
+ || (operation.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL Operation: "
+ + serviceReference.getWSDLElement().getName()
+ + "in portType: "
+ + portType.getQName());
+ }
+
+ // Set missingInput for all binding and portType test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+
+ processOperationAssertions(
+ operation,
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processMessageAssertions(
+ operation,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+
+ // ---------------------------
+ // wsdl:message
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isMessage())
+ {
+ // Find the message
+ if (((message =
+ definition.getMessage(serviceReference.getWSDLElement().getQName()))
+ == null)
+ || (message.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL Message: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ // Set missingInput for all binding, portType, and operation test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+
+ processMessageAssertions(
+ message,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+
+ else
+ {
+ throw new WSIRuntimeException(
+ "The following WSDL type is not supported: "
+ + serviceReference.getWSDLElement().getType());
+ }
+
+ // Cleanup
+ cleanup();
+
+ // Return WSDL document
+ return this.wsdlDocument;
+ }
+
+ /**
+ * Get entry container using the filename for WSDL document.
+ * @param filename a file name.
+ * @return entry container using the filename for WSDL document.
+ */
+ protected EntryContainer getEntryContainer(String filename)
+ {
+ EntryContainer entryContainer = null;
+
+ // If the entry container already exists, then use it
+ if ((entryContainer = (EntryContainer) containerMap.get(filename)) == null)
+ {
+ // Create new entry container
+ entryContainer = this.reporter.createEntryContainer();
+
+ // Set container id using the filename for the WSDL document
+ entryContainer.setId(filename);
+
+ // Put the new entry container into the container map
+ containerMap.put(filename, entryContainer);
+ }
+
+ return entryContainer;
+ }
+
+ /**
+ * Get operation from port type.
+ * @param portType port type.
+ * @param operationName operation name.
+ * @return operation from port type.
+ */
+ protected Operation getOperationFromPortType(
+ PortType portType,
+ String operationName)
+ {
+ // FIX: wsdl4j available method call below implies that only
+ // name+inputname+outputname uniquely defines operation
+ // Use this instead for now: - get the first operation we find...
+ Operation op = null;
+ if (portType.getOperations() != null)
+ {
+ Iterator opIt = portType.getOperations().iterator();
+
+ while (opIt.hasNext())
+ {
+ op = (Operation) opIt.next();
+ if (operationName.equals(op.getName()))
+ {
+ return op;
+ }
+ }
+ }
+
+ return null; // no matching operation found
+ }
+
+ /**
+ * Process definition assertions.
+ * @param classPrefix class prefix.
+ * @param candidate candidate.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected void processDefinitionAssertions(
+ String classPrefix,
+ CandidateInfo candidate)
+ throws WSIException
+ {
+
+ Entry entry = null;
+
+ Definition[] wsdlDefinitions = candidate.getDefinitions();
+
+ for (int i = 0; i < wsdlDefinitions.length; i++)
+ {
+ Definition definition = wsdlDefinitions[i];
+ if (definition == null)
+ continue;
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_DEFINITIONS));
+ entry.setReferenceID(definition.getDocumentBaseURI());
+ entry.setEntryDetail(definition);
+
+ // Set entry container
+ entry.setEntryContainer(
+ getEntryContainer(definition.getDocumentBaseURI()));
+
+ // Process all of the definition related test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, candidate.getWsdlDocument()));
+ // ADD: need to use here the specific document corresponding to the definition??
+
+ }
+ }
+
+ /**
+ * Process types assertions.
+ * @param classPrefix class prefix.
+ * @param candidate candidate.
+ * @throws WSIException if problem occurs during processing
+ * type assertions.
+ */
+ protected void processTypesAssertions(
+ String classPrefix,
+ CandidateInfo candidate)
+ throws WSIException
+ {
+ Entry entry = null;
+
+ Types[] wsdlTypes = candidate.getTypes();
+ Definition[] wsdlDefinitions = candidate.getDefinitions();
+
+ // If there are no types elements, then set all results to missingInput
+ if (wsdlTypes == null || wsdlTypes.length == 0)
+ {
+ // Set missingInput for all test assertions with this entry type
+ setMissingInput(EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_TYPES));
+ }
+
+ else
+ {
+ for (int i = 0; i < wsdlTypes.length; i++)
+ {
+ Types types = wsdlTypes[i];
+ if (types == null)
+ {
+ // no Types element in i-th document
+ continue;
+ }
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_TYPES));
+ entry.setReferenceID(
+ candidate.getDefinition(types).getDocumentBaseURI() + "-Types");
+ entry.setEntryDetail(types);
+
+ // Set entry container
+ entry.setEntryContainer(
+ getEntryContainer(wsdlDefinitions[i].getDocumentBaseURI()));
+
+ // Process all of the Types related test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, candidate.getWsdlDocument()));
+ }
+ }
+ }
+
+ /**
+ * Process import assertions.
+ * @param classPrefix class prefix.
+ * @param candidate candidate.
+ * @throws WSIException if problem occurs during processing
+ * import assertions.
+ */
+ protected void processImportAssertions(
+ String classPrefix,
+ CandidateInfo candidate)
+ throws WSIException
+ {
+
+ Entry entry = null;
+
+ Import[] wsdlImports = candidate.getImports();
+
+ // If there are no import elements, then set all results to missingInput
+ if (wsdlImports == null || wsdlImports.length == 0)
+ {
+ // Set missingInput for all test assertions with this entry type
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_IMPORT));
+ }
+
+ else
+ {
+ for (int i = 0; i < wsdlImports.length; i++)
+ {
+ Import wsdlImport = wsdlImports[i];
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_IMPORT));
+ entry.setReferenceID(wsdlImport.getNamespaceURI());
+ entry.setEntryDetail(wsdlImport);
+
+ // Set entry container
+ entry.setEntryContainer(getEntryContainer(wsdlImport.getLocationURI()));
+
+ // Process all of the import related test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, candidate.getWsdlDocument()));
+ // ADD: need to use here the specific document corresponding to the import!!
+ }
+ }
+ }
+
+ /**
+ * Process port assertions.
+ * @param port a port.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * port assertions.
+ */
+ protected void processPortAssertions(
+ Port port,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ Entry entry = null;
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORT));
+ entry.setReferenceID(port.getName());
+ entry.setParentElementName(
+ serviceReference.getWSDLElement().getParentElementName());
+ entry.setEntryDetail(port);
+
+ // Process assertions for this artifact against the target context
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process binding assertions.
+ * @param binding binding.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * binding assertions.
+ */
+ protected void processBindingAssertions(
+ Binding binding,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ Entry entry = null;
+ QName bindingQName = binding.getQName();
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ entry.setReferenceID(bindingQName.toString());
+ entry.setEntryDetail(binding);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(binding);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process binding test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process port type assertions.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * port type assertions.
+ */
+ protected void processPortTypeAssertions(
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ Entry entry = null;
+ QName portTypeQName = portType.getQName();
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ entry.setReferenceID(portTypeQName.toString());
+ entry.setEntryDetail(portType);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(portType);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process operation assertions.
+ * @param operation an operation.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * operation assertions.
+ */
+ protected void processOperationAssertions(
+ Operation operation,
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ // qualify operation with service location from config.
+ Entry entry = null;
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ entry.setReferenceID(operation.getName());
+ entry.setParentElementName(portType.getQName().getLocalPart());
+ entry.setEntryDetail(operation);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(portType);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process operation assertions.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * operation assertions.
+ */
+ protected void processOperationAssertions(
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ // For each operation,
+ if (portType.getOperations() == null)
+ {
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ }
+
+ else
+ {
+ Operation operation;
+ Iterator opIt = portType.getOperations().iterator();
+ while (opIt.hasNext())
+ {
+ operation = (Operation) opIt.next();
+ if (operation == null || operation.isUndefined())
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ else
+ processOperationAssertions(
+ operation,
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+
+ /**
+ * Process message assertions.
+ * @param message a message.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ Message message,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ Entry entry = null;
+ QName messageQName = message.getQName();
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ entry.setReferenceID(messageQName.toString());
+ entry.setEntryDetail(message);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(message);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process binding test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process message assertions.
+ * @param binding a binding.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ Binding binding,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ HashSet messageSet;
+
+ if (binding.getBindingOperations() != null)
+ { // can do nothing if have no operations defined
+ messageSet =
+ WSDLUtils.findMessages(wsdlDocument.getDefinitions(), binding);
+
+ // Process any messages that were found
+ if (messageSet.size() > 0)
+ {
+ Iterator messageIt = messageSet.iterator();
+ while (messageIt.hasNext())
+ {
+ Message message = (Message) messageIt.next();
+ if (!message.isUndefined())
+ processMessageAssertions(
+ message,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+ }
+
+ /**
+ * Process message assertions.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ HashSet messageSet = new HashSet();
+
+ if (portType.getOperations() != null)
+ {
+ // can do nothing if have no operations defined
+
+ Iterator opIt = portType.getOperations().iterator();
+
+ while (opIt.hasNext())
+ {
+ Operation op = (Operation) opIt.next();
+
+ // Since there is no guarantee that we have both and input and output message,
+ // check for its existence before adding it
+ if (op.getInput() != null && !op.getInput().getMessage().isUndefined())
+ messageSet.add(op.getInput().getMessage());
+
+ if (op.getOutput() != null
+ && !op.getOutput().getMessage().isUndefined())
+ messageSet.add(op.getOutput().getMessage());
+
+ // also messages from any Faults defined within the operation
+ if (op.getFaults() != null)
+ {
+ Iterator faultIt = op.getFaults().values().iterator();
+ Message message;
+ while (faultIt.hasNext())
+ {
+ message = ((Fault) faultIt.next()).getMessage();
+ if (!message.isUndefined())
+ messageSet.add(message);
+ }
+ }
+ }
+
+ if (messageSet.size() == 0)
+ {
+ // Set all message test assertion results to missingInput
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ // now step through each derived Message
+ Iterator messageIt = messageSet.iterator();
+ while (messageIt.hasNext())
+ {
+ processMessageAssertions(
+ (Message) (messageIt.next()),
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+ }
+
+ /**
+ * Process message assertions.
+ * @param op - operation.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ Operation op,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ HashSet messageSet = new HashSet();
+ if (op.getInput() != null && !op.getInput().getMessage().isUndefined())
+ messageSet.add(op.getInput().getMessage());
+
+ if (op.getOutput() != null && !op.getOutput().getMessage().isUndefined())
+ messageSet.add(op.getOutput().getMessage());
+
+ // also messages from any Faults defined within the operation
+ Iterator faultIt = op.getFaults().values().iterator();
+ Message message;
+ while (faultIt.hasNext())
+ {
+ message = ((Fault) faultIt.next()).getMessage();
+ if (!message.isUndefined())
+ messageSet.add(message);
+ }
+
+ if (messageSet.size() == 0)
+ {
+ // Set all message test assertion results to missingInput
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ // now step through each derived Message
+ Iterator messageIt = messageSet.iterator();
+ while (messageIt.hasNext())
+ {
+ processMessageAssertions(
+ (Message) (messageIt.next()),
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isPrimaryEntryTypeMatch(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ protected boolean isPrimaryEntryTypeMatch(
+ TestAssertion testAssertion,
+ EntryContext targetContext)
+ {
+ boolean match = false;
+
+ // If the test assertion entry type matches the target context entry type, then contine
+ if (testAssertion
+ .getEntryTypeName()
+ .equals(targetContext.getEntry().getEntryType().getTypeName()))
+ {
+ match = true;
+ }
+
+ return match;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isNotApplicable(org.wsi.test.profile.TestAssertion)
+ */
+ protected boolean isNotApplicable(TestAssertion testAssertion)
+ {
+ boolean notApplicable = false;
+
+ // ADD:
+
+ return notApplicable;
+ }
+
+ /**
+ * Method getSoapFaults.
+ *
+ * @param inBinding in binding.
+ * @return soap faults.
+ * @throws WSIException if problems occur while processing binding faults.
+ */
+ protected SOAPFault[] getSoapFaults(Binding inBinding) throws WSIException
+ {
+
+ Vector soapFaults = new Vector();
+
+ // Go through each bindingFault one at a time
+ BindingFault[] bindingFaults = getAllBindingFaults(inBinding);
+ for (int fault = 0; fault < bindingFaults.length; fault++)
+ {
+ SOAPFault soapFault = getSoapFault(bindingFaults[fault]);
+ if (soapFault != null)
+ {
+ soapFaults.add(soapFault);
+ }
+ }
+
+ SOAPFault[] soapFaultArray = new SOAPFault[soapFaults.size()];
+ soapFaults.copyInto(soapFaultArray);
+
+ return soapFaultArray;
+ }
+
+ /**
+ * Method getAllBindingFaults.
+ *
+ * @param inBinding binding.
+ * @return all binding faults.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected BindingFault[] getAllBindingFaults(Binding inBinding)
+ throws WSIException
+ {
+
+ Vector faults = new Vector();
+
+ try
+ {
+
+ Iterator bindingOperations = inBinding.getBindingOperations().iterator();
+
+ while (bindingOperations.hasNext())
+ {
+
+ try
+ {
+ BindingOperation bo = (BindingOperation) bindingOperations.next();
+ Iterator bindingFaults = bo.getBindingFaults().values().iterator();
+ while (bindingFaults.hasNext())
+ {
+
+ faults.add((BindingFault) bindingFaults.next());
+ }
+ }
+ catch (NullPointerException e)
+ {
+
+ }
+ }
+ }
+ catch (NullPointerException e)
+ {
+ // no binding operations in this binding - ignore & continue
+ }
+
+ BindingFault[] faultArray = new BindingFault[faults.size()];
+ faults.copyInto(faultArray);
+
+ return faultArray;
+ }
+
+ /**
+ * Method getWSDLFaults.
+ *
+ * @param bindingFault a binding fault.
+ * @return WSDL faults.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPFault getSoapFault(BindingFault bindingFault)
+ throws WSIException
+ {
+
+ SOAPFault soapFault = null;
+ try
+ {
+ Iterator faultExtensibles =
+ bindingFault.getExtensibilityElements().iterator();
+
+ while (faultExtensibles.hasNext() && soapFault == null)
+ {
+ try
+ {
+ soapFault = (SOAPFault) faultExtensibles.next();
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Fault elements.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ {
+ }
+
+ return soapFault;
+ }
+
+ /**
+ * Method getSoapHeader.
+ *
+ * @param inBinding a binding.
+ * @return SOAP headers.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPHeader[] getSoapHeaders(Binding inBinding) throws WSIException
+ {
+ // Get all bindings
+ Binding[] bindingList = new Binding[1];
+ bindingList[0] = inBinding;
+
+ Vector soapHeaderList = new Vector();
+
+ // Go through each binding one at a time
+ for (int binding = 0; binding < bindingList.length; binding++)
+ {
+ try
+ {
+ // get the list of binding Operations
+ BindingOperation[] bindingOperations =
+ (BindingOperation[]) bindingList[binding]
+ .getBindingOperations()
+ .toArray(
+ new BindingOperation[0]);
+
+ // get references to the extensible elements within the <input> and <output> elements of this binding <operation>.
+ for (int bo = 0; bo < bindingOperations.length; bo++)
+ {
+
+ // Iterate over all input/output extensibles, looking for <SOAP:Body> elements.
+ try
+ {
+ BindingInput bindingInput = bindingOperations[bo].getBindingInput();
+ BindingOutput bindingOutput =
+ bindingOperations[bo].getBindingOutput();
+
+ Iterator extElements =
+ bindingInput.getExtensibilityElements().iterator();
+ while (extElements.hasNext())
+ {
+ try
+ {
+ soapHeaderList.add((SOAPHeader) extElements.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Header.
+ }
+ }
+
+ extElements = bindingOutput.getExtensibilityElements().iterator();
+ while (extElements.hasNext())
+ {
+ try
+ {
+ soapHeaderList.add((SOAPHeader) extElements.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Header.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ { // no extensibility elements for <input> or <output> - ignore : not checking this here.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ {
+ // no binding operations in this binding - ignore & continue
+ }
+ }
+
+ SOAPHeader[] soapHeaderArray = new SOAPHeader[soapHeaderList.size()];
+ soapHeaderList.copyInto(soapHeaderArray);
+
+ return soapHeaderArray;
+ }
+
+ /**
+ * Method getSoapHeaderFaults.
+ *
+ * WSDLDocument getter method - maybe better off in class WSDLDocument...
+ *
+ * @param inBinding a binding.
+ * @return SOAP header faults.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPHeaderFault[] getSoapHeaderFaults(Binding inBinding)
+ throws WSIException
+ {
+ Vector soapHeaderFaultList = new Vector();
+
+ // Get the list of SOAP headers
+ SOAPHeader[] soapHeaderArray = getSoapHeaders(inBinding);
+
+ // Go through the list and get the header faults
+ List list = null;
+ for (int header = 0; header < soapHeaderArray.length; header++)
+ {
+ // Get list for this header
+ if ((list = soapHeaderArray[header].getSOAPHeaderFaults()) != null)
+ {
+ // Add to primary list
+ soapHeaderFaultList.addAll(list);
+ }
+ }
+
+ SOAPHeaderFault[] soapHeaderFaultArray =
+ new SOAPHeaderFault[soapHeaderFaultList.size()];
+ soapHeaderFaultList.copyInto(soapHeaderFaultArray);
+
+ return soapHeaderFaultArray;
+ }
+
+ /**
+ * Method getSoapBodies.
+ *
+ * WSDLDocument getter method - maybe better off in class WSDLDocument...
+ *
+ * @param inBinding a binding.
+ * @return SOAP bodies.
+ * @throws WSIException if if problems occur during processing.
+ */
+ protected SOAPBody[] getSoapBodies(Binding inBinding) throws WSIException
+ {
+ // REMOVE: Get all bindings
+ //Binding[] bindingList = wsdlDocument.getBindings();
+ Binding[] bindingList = new Binding[1];
+ bindingList[0] = inBinding;
+
+ Vector soapBodies = new Vector();
+
+ // Go through each binding one at a time
+ for (int binding = 0; binding < bindingList.length; binding++)
+ {
+ // get the list of binding Operations
+ BindingOperation[] bindingOperations =
+ (BindingOperation[]) bindingList[binding]
+ .getBindingOperations()
+ .toArray(
+ new BindingOperation[0]);
+
+ // get references to the extensible elements within the <input> and <output> elements of this binding <operation>.
+ for (int bo = 0; bo < bindingOperations.length; bo++)
+ {
+
+ // Iterate over all input/output extensibles, looking for <SOAP:Body> elements.
+ try
+ {
+ Iterator inputExtensibles =
+ bindingOperations[bo]
+ .getBindingInput()
+ .getExtensibilityElements()
+ .iterator();
+ while (inputExtensibles.hasNext())
+ {
+ try
+ {
+ soapBodies.add((SOAPBody) inputExtensibles.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Body elements.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ { // no extensibility elements for <input> - ignore : not checking this here.
+ }
+
+ try
+ {
+ Iterator outputExtensibles =
+ bindingOperations[bo]
+ .getBindingOutput()
+ .getExtensibilityElements()
+ .iterator();
+ while (outputExtensibles.hasNext())
+ {
+ try
+ {
+ soapBodies.add((SOAPBody) outputExtensibles.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Body elements.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ { // no extensibility elements for <output>.
+ }
+ }
+ }
+
+ SOAPBody[] soapBodyArray = new SOAPBody[soapBodies.size()];
+ soapBodies.copyInto(soapBodyArray);
+
+ return soapBodyArray;
+ }
+
+ /**
+ * Method getSoapBody.
+ *
+ * @param bindingInput a BindingInput object.
+ * @return body.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPBody getSoapBody(BindingInput bindingInput) throws WSIException
+ {
+
+ SOAPBody soapBody = null;
+
+ Iterator extensibles = bindingInput.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPBody)
+ {
+ soapBody = (SOAPBody) extensible;
+ break;
+ }
+ }
+ return soapBody;
+ }
+
+ /**
+ * Method getSoapBody.
+ *
+ * @param bindingOutput a BindingOutput object.
+ * @return SOAP body.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPBody getSoapBody(BindingOutput bindingOutput)
+ throws WSIException
+ {
+
+ SOAPBody soapBody = null;
+
+ Iterator extensibles = bindingOutput.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPBody)
+ {
+ soapBody = (SOAPBody) extensible;
+ break;
+ }
+ }
+ return soapBody;
+ }
+
+ /**
+ * Get schema used.
+ * @param def definition.
+ * @return Schema used.
+ * @throws AssertionFailException if problem getting WSDL defintions
+ * namespace.
+ */
+ protected String getSchemaUsed(Definition def) throws AssertionFailException
+ {
+ String schemaUsed = "";
+
+ try
+ {
+ // Need to read the file directly, since WSDL4J always puts in the default WSDL namespace
+ Document document = parseXMLDocumentURL(def.getDocumentBaseURI(), null);
+
+ if (document != null)
+ {
+ // Get the root element
+ Element element = document.getDocumentElement();
+
+ // Get the namespace for this element
+ if (element != null)
+ schemaUsed = element.getNamespaceURI();
+ }
+ }
+
+ catch (WSIException we)
+ {
+ throw new AssertionFailException("problem getting WSDL defintions namespace");
+ }
+
+ /*
+ // Get the default namespace
+ String schemaUsed = def.getNamespace("");
+
+ // If the default was set, then process it to get the namespace
+ if (schemaUsed == null) {
+ // do it the hard way (still better than another DOM parse)...
+ //WSDLWriter w = new WSDLWriterImpl();
+ try {
+ WSDLWriter w = WSDLFactory.newInstance().newWSDLWriter();
+ Document doc = w.getDocument(def);
+ Element e = doc.getDocumentElement();
+ schemaUsed = e.getNamespaceURI();
+ }
+ catch (NullPointerException e) {
+ throw new AssertionFailException("problem getting WSDL defintions namespace");
+ }
+ catch (WSDLException e) {
+ throw new AssertionFailException("problem getting document defintion");
+ }
+ }
+ */
+
+ return schemaUsed;
+ }
+
+ /**
+ * Method getSoapBinding.
+ *
+ * Get the SOAP binding for a Binding.
+ *
+ * @param binding a binding.
+ * @return a SOAP binding.
+ * @throws WSIException if problems occur during processing.
+ */
+ public static SOAPBinding getSoapBinding(Binding binding) throws WSIException
+ {
+ SOAPBinding soapBinding = null;
+
+ // Get the list of extensibility elements
+ List exElements = binding.getExtensibilityElements();
+ if (exElements != null)
+ {
+ Iterator iterator = binding.getExtensibilityElements().iterator();
+
+ // Check for <soap:binding> element
+ while ((iterator.hasNext()) && (soapBinding == null))
+ {
+ try
+ {
+ soapBinding = (SOAPBinding) iterator.next();
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Binding element
+ }
+ }
+ }
+
+ return soapBinding;
+ }
+
+ /**
+ * Create XML schema validator. This is done here because some compilers do not allow
+ * the documentList field to be accessed from within an inner class.
+ * @param documentBaseURI the base URL.
+ * @return newly created XML schema validator.
+ */
+ protected XMLSchemaValidator createXMLSchemaValidator(String documentBaseURI)
+ {
+ // Create XML schema validator
+ return new XMLSchemaValidator(documentBaseURI, documentList);
+ }
+
+ /**
+ * Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param definition a Definition object.
+ * @return a list of schema target namespaces.
+ * @throws WSIException if problem during processing method.
+ */
+ protected List getSchemaTargetNamespaceList(Definition definition)
+ throws WSIException
+ {
+ List list = null, nextList = null;
+
+ // Get list of extension elements within the types element
+ Types types = null;
+ if ((types = definition.getTypes()) != null)
+ {
+ Iterator iterator = types.getExtensibilityElements().iterator();
+
+ ExtensibilityElement extElement = null;
+ while (iterator.hasNext())
+ {
+ // Get next ext. element
+ extElement = (ExtensibilityElement) iterator.next();
+ // If this is an unknown ext. element, then see if it is a schema element
+ TargetNamespaceProcessor tnsProcessor = null;
+ if (extElement instanceof UnknownExtensibilityElement)
+ {
+ tnsProcessor =
+ new TargetNamespaceProcessor(
+ definition.getDocumentBaseURI(),
+ documentList);
+
+ if ((nextList =
+ tnsProcessor.processAllSchema(
+ ((UnknownExtensibilityElement) extElement).getElement()))
+ != null)
+ if (list == null)
+ list = new Vector();
+ list.addAll(nextList);
+ }
+ }
+ }
+
+ return list;
+ }
+ /**
+ * Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param definition a Definition object.
+ * @return a list of schema target namespaces.
+ * @throws WSIException if problem during processing method.
+ */
+ protected List getSchemaNamespaceList(Definition definition)
+ throws WSIException
+ {
+ List list = new Vector();
+
+ // Always add current document targetNamespace
+ List targetNamespaceList = getSchemaTargetNamespaceList(definition);
+
+ if ((targetNamespaceList != null) && !targetNamespaceList.isEmpty())
+ list.addAll(targetNamespaceList);
+
+ // Get list of imported WSDL documents
+ Map importMap = definition.getImports();
+
+ Import imp;
+
+ // Add each imports targetNamespace to the list
+ if (importMap != null && !importMap.isEmpty())
+ {
+ Iterator values = importMap.values().iterator();
+ List importList;
+ while (values.hasNext())
+ {
+ importList = (List) values.next();
+ Iterator imports = importList.iterator();
+ while (imports.hasNext())
+ {
+ imp = (Import) imports.next();
+ if (imp != null && imp.getDefinition() != null)
+ list.addAll(getSchemaNamespaceList(imp.getDefinition()));
+ }
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Build list of WSDL targetNamespaces.
+ * @param definition a Definition object.
+ * @return list of WSDL targetNamespaces.
+ */
+ protected List getWSDLTargetNamespaceList(Definition definition)
+ {
+ List list = new Vector();
+
+ // Always add current document targetNamespace
+ if (definition.getTargetNamespace() != null)
+ list.add(definition.getTargetNamespace());
+
+ // Get list of imported WSDL documents
+ Map importMap = definition.getImports();
+
+ Import imp;
+
+ // Add each imports targetNamespace to the list
+ if (importMap != null && !importMap.isEmpty())
+ {
+ Iterator values = importMap.values().iterator();
+ List importList;
+ while (values.hasNext())
+ {
+ importList = (List) values.next();
+ Iterator imports = importList.iterator();
+ while (imports.hasNext())
+ {
+ imp = (Import) imports.next();
+ if (imp != null && imp.getDefinition() != null)
+ list.addAll(getWSDLTargetNamespaceList(imp.getDefinition()));
+ // list.add(imp.getDefinition().getTargetNamespace());
+ }
+ }
+ }
+
+ return list;
+ }
+
+ protected class BindingMatch
+ {
+ private Binding binding;
+ private BindingOperation bindingOperation;
+ private SOAPBinding soapBinding;
+ //private Vector bindingArgs; // set of BindingInputs and BindingOutputs
+ private BindingInput bindingInput;
+ private BindingOutput bindingOutput;
+
+ // ADD: need to include BindingFault support...
+ public BindingMatch(
+ Binding b,
+ BindingOperation bo,
+ SOAPBinding sb,
+ BindingInput bin,
+ BindingOutput bout)
+ {
+ binding = b;
+ bindingOperation = bo;
+ soapBinding = sb;
+ //bindingArgs = new Vector();
+ //if (bin != null) { bindingArgs.add(bin); }
+ //if (bout != null) { bindingArgs.add(bout); }
+ bindingInput = bin;
+ bindingOutput = bout;
+ }
+
+ public BindingMatch(
+ Binding b,
+ BindingOperation bo,
+ SOAPBinding sb,
+ BindingInput bin)
+ {
+ this(b, bo, sb, bin, null);
+ }
+
+ public BindingMatch(
+ Binding b,
+ BindingOperation bo,
+ SOAPBinding sb,
+ BindingOutput bout)
+ {
+ this(b, bo, sb, null, bout);
+ }
+
+ /**
+ * Returns the soapBinding.
+ * @return SOAPBinding
+ */
+ public SOAPBinding getSoapBinding()
+ {
+ return soapBinding;
+ }
+
+ /**
+ * Returns the bindingOperation.
+ * @return BindingOperation
+ */
+ public BindingOperation getBindingOperation()
+ {
+ return bindingOperation;
+ }
+
+ /**
+ * Returns the bindingInput.
+ * @return BindingInput
+ */
+ public BindingInput getBindingInput()
+ {
+ return bindingInput;
+ }
+
+ /**
+ * Returns the bindingOutput.
+ * @return BindingOutput
+ */
+ public BindingOutput getBindingOutput()
+ {
+ return bindingOutput;
+ }
+
+ public boolean hasBindingInput()
+ {
+ return (this.bindingInput != null);
+ }
+
+ public boolean hasBindingOutput()
+ {
+ return (this.bindingOutput != null);
+ }
+
+ /**
+ * Returns the binding.
+ * @return Binding
+ */
+ public Binding getBinding()
+ {
+ return binding;
+ }
+
+ }
+
+ /**
+ * Get binding matches.
+ * @param binding a binding.
+ * @param soapBindingStyle soap binding style.
+ * @param soapBodyUse soap body use.
+ * @return binding matches.
+ * @throws WSIException if problems occur during processing.
+ */
+ public BindingMatch[] getBindingMatches(
+ Binding binding,
+ String soapBindingStyle,
+ String soapBodyUse)
+ throws WSIException
+ {
+
+ Vector bindingMatches = new Vector();
+
+ // Check binding
+ SOAPBinding soapBinding = getSoapBinding(binding);
+
+ // check that the soap:binding for this WSDL binding is the specified style
+ // ADD: check for null pointer
+ if (soapBinding != null)
+ {
+ String defaultStyle = soapBinding.getStyle();
+
+ if (defaultStyle == null)
+ {
+ defaultStyle = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ }
+
+ // Get the set of operations for this WSDL binding
+ List bindingOpsList = binding.getBindingOperations();
+ if (bindingOpsList != null)
+ {
+ Iterator bindingOps = bindingOpsList.iterator();
+ // for each binding operation:
+ while (bindingOps.hasNext())
+ {
+ BindingOperation bindingOp = (BindingOperation) bindingOps.next();
+
+ SOAPOperation soapOp = getSoapOperation(bindingOp);
+
+ if ((soapOp == null && defaultStyle.equals(soapBindingStyle))
+ || (soapOp != null
+ && soapOp.getStyle() == null
+ && defaultStyle.equals(soapBindingStyle))
+ || (soapOp != null
+ && soapOp.getStyle() != null
+ && soapOp.getStyle().equals(soapBindingStyle)))
+ {
+ // check binding input & output
+ BindingInput bInput = bindingOp.getBindingInput();
+ if (bInput != null)
+ {
+ SOAPBody inputSoapBody = getSoapBody(bInput);
+ if (inputSoapBody == null
+ || (inputSoapBody.getUse() != null
+ && !inputSoapBody.getUse().equals(soapBodyUse)))
+ {
+ bInput = null;
+ }
+ }
+
+ BindingOutput bOutput = bindingOp.getBindingOutput();
+ if (bOutput != null)
+ {
+ SOAPBody outputSoapBody = getSoapBody(bOutput);
+
+ if (outputSoapBody == null
+ || (outputSoapBody.getUse() != null
+ && !outputSoapBody.getUse().equals(soapBodyUse)))
+ {
+ bOutput = null;
+ }
+ }
+
+ if ((bOutput != null) || (bInput != null))
+ {
+ // we have a match, add to the vector
+ bindingMatches.add(
+ new BindingMatch(
+ binding,
+ bindingOp,
+ soapBinding,
+ bInput,
+ bOutput));
+ }
+ }
+ }
+ }
+ }
+
+ BindingMatch[] BindingMatchArray = new BindingMatch[bindingMatches.size()];
+ bindingMatches.copyInto(BindingMatchArray);
+ return BindingMatchArray;
+ }
+
+ /**
+ * Method getSoapOperation.
+ *
+ * @param bindingOperation a binding operation.
+ * @return a soap operation.
+ * @throws WSIException if problems while processing.
+ */
+ public static SOAPOperation getSoapOperation(BindingOperation bindingOperation)
+ throws WSIException
+ {
+
+ if (bindingOperation.getExtensibilityElements() == null)
+ {
+ return null;
+ }
+
+ Iterator extensibles =
+ bindingOperation.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPOperation)
+ {
+ return (SOAPOperation) extensible;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Returns an array of SOAPOperations corresponding to the wsdl:binding supplied.
+ */
+ protected HashMap getSoapOperations(Binding binding) throws WSIException
+ {
+ HashMap soapOperationList = new HashMap();
+
+ if (binding.getBindingOperations() == null)
+ {
+ return null;
+ }
+
+ //Vector soapOpVector = new Vector();
+
+ // Get the list of binding operations
+ Iterator operations = binding.getBindingOperations().iterator();
+
+ // Check each binding operation to see if it has a soap operation element
+ BindingOperation bindingOperation = null;
+ while (operations.hasNext())
+ {
+ bindingOperation = (BindingOperation) operations.next();
+ Iterator extensibles =
+ bindingOperation.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPOperation)
+ {
+ soapOperationList.put(extensible, bindingOperation.getName());
+ }
+ }
+ }
+
+ //return (SOAPOperation[])soapOpVector.toArray(new SOAPOperation[] {});
+ return soapOperationList;
+ }
+
+ /**
+ * Check part attributes.
+ * @param bindingMatch an array of BindingMatch objects.
+ * @param inOrOut a String object.
+ * @param attrib attribute.
+ * @return a boolean.
+ * @throws AssertionFailException if the part is not compliant.
+ */
+ // GT - rework this method with a better way of parameterizing the getters required for the invocation.
+ protected boolean checkPartAttributes(
+ BindingMatch[] bindingMatch,
+ String inOrOut,
+ String attrib)
+ throws AssertionFailException
+ {
+
+ if (!(inOrOut.equals("useInput") || inOrOut.equals("useOutput"))
+ || !(attrib.equals("useType") || attrib.equals("useElement")))
+ {
+ // invalid argument value supplied by calling method - "internal error"
+ return false;
+ }
+
+ for (int i = 0; i < bindingMatch.length; i++)
+ {
+ BindingMatch nextMatch = bindingMatch[i];
+
+ // check the associated parts
+ Message msg;
+ Map parts;
+ Iterator partIteration;
+
+ BindingOperation bindingOp = nextMatch.getBindingOperation();
+ if (bindingOp == null)
+ {
+ continue; // no Binding Operation for some reason
+ }
+
+ Operation op = bindingOp.getOperation();
+
+ /* ADD: handle soap:faults in similar way
+ try {
+ // check faults - remarkably similar.... (need to retain operation id for failuredetail msg)
+ if (nextMatch.hasBindingFault()) {
+
+ msg = op.getFault().getMessage();
+ parts = msg.getParts();
+
+ //check that each part has an element attribute
+ partIteration = parts.values().iterator();
+ while (partIteration.hasNext()) {
+ Part part = (Part)partIteration.next();
+ if (part.getElementName() == null) {
+ throw new AssertionFailException("OPERATION: " + op + "MESSAGE: " + msg);
+ }
+ }
+ }
+ }
+ catch (NullPointerException n) {
+ // no parts found - this qualifies an assertion failure
+ throw new AssertionFailException(n.getMessage());
+ }
+ */
+
+ try
+ {
+
+ QName attributeName;
+
+ //GT: Do we need to check BindingInput / Output here ??
+
+ if (inOrOut.equals("useInput"))
+ {
+ if (op.getInput() == null || !nextMatch.hasBindingInput())
+ {
+ // No Input so nothing to check
+ continue;
+ }
+
+ msg = op.getInput().getMessage();
+
+ }
+ else
+ { // Looking for Output
+ if (op.getOutput() == null || !nextMatch.hasBindingOutput())
+ {
+ // No Output so nothing to check
+ continue;
+ }
+
+ msg = op.getOutput().getMessage();
+ }
+
+ if (msg == null)
+ {
+ continue; // nothing to check from this Binding Match (?)
+ }
+
+ // Get the list of parts
+ parts = msg.getParts();
+
+ // If there is a parts attribute, then only process those parts
+ List partsNameList = null;
+ if ((partsNameList = getPartsList(nextMatch, inOrOut)) != null)
+ {
+ Vector partsList = new Vector();
+ Iterator partsNameIterator = partsNameList.iterator();
+ while (partsNameIterator.hasNext())
+ {
+ partsList.add(parts.get((String) partsNameIterator.next()));
+ }
+ partIteration = partsList.iterator();
+ }
+
+ // Otherwise use the complete list of parts
+ else
+ {
+ partIteration = parts.values().iterator();
+ }
+
+ //check that each part has an element or type attribute
+ while (partIteration.hasNext())
+ {
+ Part part = (Part) partIteration.next();
+ if (attrib.equals("useElement"))
+ {
+ attributeName = part.getElementName();
+ }
+ else
+ { // "useType"
+ attributeName = part.getTypeName();
+ }
+
+ if (attributeName == null)
+ {
+ throw new AssertionFailException(
+ "Name of operation that failed: "
+ + op.getName()
+ + "\n"
+ + op.toString()
+ + "\n"
+ + "\nName of message that failed: "
+ + msg.getQName()
+ + "\n"
+ + msg.toString());
+ }
+ }
+ }
+ catch (NullPointerException n)
+ {
+ // no parts found - this qualifies an assertion failure
+ throw new AssertionFailException(n.toString());
+ }
+ }
+ return true; // tests successful
+ }
+
+ /**
+ * Get parts list from a soapbind:body element.
+ */
+ private List getPartsList(BindingMatch bindingMatch, String type)
+ {
+ List partsList = null;
+ Iterator iterator = null;
+
+ BindingOperation bindingOp;
+
+ try
+ {
+ // Get the binding operation
+ bindingOp = bindingMatch.getBindingOperation();
+
+ // Determine if the binding operation contains a soapbind:body with a parts attribute
+ if (type.equals("useInput"))
+ {
+ iterator =
+ bindingOp.getBindingInput().getExtensibilityElements().iterator();
+ }
+ else
+ {
+ iterator =
+ bindingOp.getBindingOutput().getExtensibilityElements().iterator();
+ }
+ }
+ catch (NullPointerException e)
+ {
+ return null;
+ // either no binding operation, binding input/output, or SOAP element
+ }
+
+ // Determine if the binding operation contains a soapbind:body with a parts attribute
+ while ((iterator.hasNext()) && (partsList == null))
+ {
+ try
+ {
+ SOAPBody soapBody = (SOAPBody) iterator.next();
+ partsList = soapBody.getParts();
+ }
+ catch (ClassCastException cce)
+ { // not a SOAPBody extensibility element so ignore
+ }
+ }
+
+ return partsList;
+ }
+
+ /**
+ * Get element location.
+ * @param wsdlDocument WSDL document.
+ * @param wsdlElement WSDL element.
+ * @return element location.
+ */
+ protected ElementLocation getElementLocation(
+ WSDLDocument wsdlDocument,
+ Object wsdlElement)
+ {
+ ElementLocation elementLocation = null;
+ WSDLElementList wsdlElementList;
+
+ if ((wsdlElementList = wsdlDocument.getElementList()) != null)
+ {
+ elementLocation = wsdlElementList.getElementLocation(wsdlElement);
+ }
+
+ return elementLocation;
+ }
+
+ /**
+ * Create failure detail.
+ * @param message a message.
+ * @param entryContext entry context.
+ * @return failure detail.
+ */
+ protected FailureDetail createFailureDetail(
+ String message,
+ EntryContext entryContext)
+ {
+ return createFailureDetail(
+ message,
+ entryContext,
+ entryContext.getEntry().getEntryDetail());
+ }
+
+ /**
+ * Create failure detail.
+ * @param message a message.
+ * @param entryContext entry context.
+ * @param wsdlElement WSDL element.
+ * @return failure detail.
+ */
+ protected FailureDetail createFailureDetail(
+ String message,
+ EntryContext entryContext,
+ Object wsdlElement)
+ {
+ FailureDetail failureDetail = reporter.createFailureDetail();
+ failureDetail.setFailureMessage(message);
+ failureDetail.setElementLocation(
+ getElementLocation(entryContext.getWSDLDocument(), wsdlElement));
+ return failureDetail;
+ }
+
+ /**
+ * SOAPBody, SOAPFault, SOAPHeader and SOAPHeaderFault class
+ * interfaces have compatible getUse() and getNamespaceURI()
+ * methods, but wsdl4j does not declare them at the parent interface.
+ * Therefore use reflection to access these common methods.
+ *
+ * @param extElement extensibility element.
+ * @return true if namespace is found in SOAP literal.
+ * @throws NoSuchMethodException if this method cannot be found.
+ * @throws InvocationTargetException if problems occur in an invoked method or constructor
+ * @throws IllegalAccessException if there is am attempt to load a
+ * class that it does not have access to.
+ */
+ protected boolean namespaceFoundInSoapLiteral(ExtensibilityElement extElement)
+ throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
+ {
+ Class c = extElement.getClass();
+ Method getUseMethod = c.getMethod("getUse", new Class[0]);
+ Method getNamespaceURIMethod = c.getMethod("getNamespaceURI", new Class[0]);
+
+ // (use attribute is mandatory but the null case is checked for since a missing use is not
+ // checked with this TA. If its missing its invalid but we don't know whether we have doc-lit).
+ if (getUseMethod.invoke(extElement, null) == null
+ || !getUseMethod.invoke(extElement, null).equals(
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ return false;
+ }
+
+ // return true if namespace found
+ boolean namespaceFound =
+ (getNamespaceURIMethod.invoke(extElement, null) != null);
+
+ // return true if namespace found
+ return namespaceFound;
+
+ }
+
+ /**
+ * Verify extensibility element uses literal.
+ * @param extensible - extensibility element
+ * @return boolean
+ * @throws NoSuchMethodException if this method cannot be found.
+ * @throws InvocationTargetException if problems occur in an invoked method or constructor
+ * @throws IllegalAccessException if there is am attempt to load a
+ * class that it does not have access to.
+ */
+ protected boolean isLiteral(ExtensibilityElement extensible)
+ throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
+ {
+
+ Class c = extensible.getClass();
+ Method getUseMethod = c.getMethod("getUse", new Class[0]);
+
+ // (use attribute is mandatory but the null case is checked for since a missing use is not
+ // checked with this TA. If its missing its invalid but we don't know whether we have doc-lit).
+ if (getUseMethod.invoke(extensible, null) == null
+ || !getUseMethod.invoke(extensible, null).equals(
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ return false;
+ }
+
+ // return true if shown to have use="literal"
+ return true;
+
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2010.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2010.java
new file mode 100644
index 000000000..d35d8ea8e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2010.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2010
+ */
+public class WSI2010 extends BP2010
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2010(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2011.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2011.java
new file mode 100644
index 000000000..8e0e3a777
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2011.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2011
+ */
+public class WSI2011 extends BP2011
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2011(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2012.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2012.java
new file mode 100644
index 000000000..68c36b304
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2012.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2012
+ */
+public class WSI2012 extends BP2012
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2012(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2013.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2013.java
new file mode 100644
index 000000000..11d354dab
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2013.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2013
+ */
+public class WSI2013 extends BP2013
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2013(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2014.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2014.java
new file mode 100644
index 000000000..c08fba6dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2014.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2014
+ */
+public class WSI2014 extends BP2014
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2014(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2017.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2017.java
new file mode 100644
index 000000000..8cd7492a1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2017.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2017
+ */
+public class WSI2017 extends BP2017
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2017(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2018.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2018.java
new file mode 100644
index 000000000..abc259f6b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2018.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2018
+ */
+public class WSI2018 extends BP2018
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2018(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2019.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2019.java
new file mode 100644
index 000000000..884d62639
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2019.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2019
+ */
+public class WSI2019 extends BP2019
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2019(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2020.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2020.java
new file mode 100644
index 000000000..016d5bda4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2020.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2020
+ */
+public class WSI2020 extends BP2020
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2020(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2021.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2021.java
new file mode 100644
index 000000000..2899f9e77
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2021.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2021
+ */
+public class WSI2021 extends BP2021
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2021(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2022.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2022.java
new file mode 100644
index 000000000..ba2dbb6c2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2022.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2022
+ */
+public class WSI2022 extends BP2022
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2022(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2032.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2032.java
new file mode 100644
index 000000000..ea036951e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2032.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2032
+ */
+public class WSI2032 extends BP2032
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2032(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2098.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2098.java
new file mode 100644
index 000000000..db8fd74f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2098.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2098
+ */
+public class WSI2098 extends BP2098
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2098(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2099.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2099.java
new file mode 100644
index 000000000..34b6b6c1c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2099.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+
+/**
+ * WSI2099.
+ * <context>For a candidate wsdl:definitions, </context>
+ * <assertionDescription>A WS-I conformance annotation does not appear outside a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message element.</assertionDescription>
+ */
+public class WSI2099 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2099(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private boolean containsClaims = false;
+
+ /**
+ * Check a WS-I conformance annotation does not appear outside a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message element if not it creates failure report.
+ * @see org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLVisitor#visit(org.w3c.dom.Element, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Element el, Object parent, WSDLTraversalContext ctx)
+ {
+ // conformance claim should be within : port, binding, porttype, operation, message
+ if (containsConformanceClaim(el))
+ {
+ containsClaims = true;
+
+ if (parent instanceof BindingFault)
+ errors.add(WSDL_FAULT, ((BindingFault) parent).getName());
+ else if (parent instanceof BindingInput)
+ errors.add(WSDL_INPUT, ((BindingInput) parent).getName());
+ else if (parent instanceof BindingOperation)
+ errors.add(WSDL_OPERATION, ((BindingOperation) parent).getName());
+ else if (parent instanceof BindingOutput)
+ errors.add(WSDL_OUTPUT, ((BindingOutput) parent).getName());
+ else if (parent instanceof Definition)
+ errors.add(WSDL_DEFINITIONS, ((Definition) parent).getQName());
+ else if (parent instanceof Service)
+ errors.add(WSDL_SERVICE, ((Service) parent).getQName());
+ else if (parent instanceof Fault)
+ errors.add(WSDL_FAULT, ((Fault) parent).getName());
+ else if (parent instanceof Output)
+ errors.add(WSDL_INPUT, ((Output) parent).getName());
+ else if (parent instanceof Import)
+ errors.add(WSDL_IMPORT, ((Import) parent).getNamespaceURI());
+ else if (parent instanceof Input)
+ errors.add(WSDL_INPUT, ((Input) parent).getName());
+ else if (parent instanceof Part)
+ errors.add(WSDL_PART, ((Part) parent).getName());
+ else if (parent instanceof Types)
+ errors.add(WSDL_TYPES);
+ }
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitElement(true);
+ /*
+ traversal.
+ ignorePort2Element().
+ ignoreMessage2Element().
+ ignoreBinding2Element().
+ ignorePortType2Element().
+ ignoreOperation2Element();
+ */
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ // create detail message with the list of error elements
+ if (!errors.isEmpty())
+ {
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ result = AssertionResult.RESULT_FAILED;
+ }
+
+ else if (!containsClaims)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim.
+ * @param el
+ * @return boolean
+ */
+ private boolean containsConformanceClaim(Element el)
+ {
+ if (el == null)
+ return false;
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+ return (el != null);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2100.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2100.java
new file mode 100644
index 000000000..8aa5bf986
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2100.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+
+import org.eclipse.wst.wsi.internal.WSIException;
+import org.eclipse.wst.wsi.internal.WSITag;
+import org.eclipse.wst.wsi.internal.profile.TestAssertion;
+import org.eclipse.wst.wsi.internal.profile.validator.EntryContext;
+import org.eclipse.wst.wsi.internal.profile.validator.impl.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.util.ErrorList;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.wsdl.traversal.WSDLTraversalContext;
+import org.eclipse.wst.wsi.internal.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+
+/**
+ * WSI2100.
+ * <context>For a candidate wsdl:definitions, if it contains a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message, which in turn contains a conformance annotation</context>
+ * <assertionDescription>The conformance annotation of the wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message, validates to the schema defined in the Basic Profile, and is direct child of the documentation element for the WSDL element. The schema definition uses "http://ws-i.org/schemas/conformanceClaim/" as the targetNamespace. </assertionDescription>
+ */
+public class WSI2100 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2100(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean containsClaims = false;
+ private ErrorList errors = new ErrorList();
+
+ /* Create falure report if port contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port != null && !containsLegalClaim(port.getDocumentationElement()))
+ errors.add(WSDL_PORT, port.getName());
+ }
+
+ /* Create falure report if binding contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Binding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Binding binding, Object parent, WSDLTraversalContext ctx)
+ {
+ if (binding != null
+ && !containsLegalClaim(binding.getDocumentationElement()))
+ errors.add(WSDL_BINDING, binding.getQName());
+ }
+
+ /* Create falure report if port type contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.PortType, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(PortType type, Object parent, WSDLTraversalContext ctx)
+ {
+ if (type != null && !containsLegalClaim(type.getDocumentationElement()))
+ errors.add(WSDL_PORTTYPE, type.getQName());
+ }
+
+ /* Create falure report if operation contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ Operation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (operation != null
+ && !containsLegalClaim(operation.getDocumentationElement()))
+ errors.add(WSDL_OPERATION, operation.getName());
+ }
+
+ /* Create falure report if message contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx)
+ {
+ if (message != null
+ && !containsLegalClaim(message.getDocumentationElement()))
+ errors.add(WSDL_MESSAGE, message.getQName());
+ }
+
+ /* Validates the test assertion.
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.visitBinding(true);
+ traversal.visitMessage(true);
+ traversal.visitPort(true);
+ traversal.visitPortType(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ // create detail message with the list of error elements
+ if (!errors.isEmpty())
+ {
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ result = AssertionResult.RESULT_FAILED;
+ }
+
+ else if (!containsClaims)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim with
+ * illegal schema definition URI.
+ * legal is 'http://ws-i.org/schemas/conformanceClaim/'
+ * @param el
+ * @return boolean
+ */
+ private boolean containsLegalClaim(Element el)
+ {
+ if (el == null)
+ return true;
+ // find claim
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+
+ if (el != null)
+ containsClaims = true;
+
+ while (el != null)
+ {
+ if (XMLUtils.getAttribute(el, ATTR_CLAIM_CONFORMSTO) == null
+ || XMLUtils.getAttribute(el, ATTR_SOAP_MUSTUNDERSTAND) != null)
+ return false;
+ el = XMLUtils.findElement(el, WSI_CLAIM);
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2101.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2101.java
new file mode 100644
index 000000000..e1b828c5b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2101.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2101
+ */
+public class WSI2101 extends BP2101
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2101(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2102.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2102.java
new file mode 100644
index 000000000..78f732c00
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2102.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2102
+ */
+public class WSI2102 extends BP2102
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2102(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2103.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2103.java
new file mode 100644
index 000000000..c920a9312
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2103.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2103
+ */
+public class WSI2103 extends BP2103
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2103(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2104.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2104.java
new file mode 100644
index 000000000..a55819446
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2104.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2104
+ */
+public class WSI2104 extends BP2104
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2104(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2105.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2105.java
new file mode 100644
index 000000000..497a2cbfb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2105.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2105
+ */
+public class WSI2105 extends BP2105
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2105(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2107.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2107.java
new file mode 100644
index 000000000..bc470c18e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2107.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2107
+ */
+public class WSI2107 extends BP2107
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2107(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2108.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2108.java
new file mode 100644
index 000000000..6c206bb6a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2108.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2108
+ */
+public class WSI2108 extends BP2108
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2108(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2110.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2110.java
new file mode 100644
index 000000000..81cf1ca56
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2110.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2110
+ */
+public class WSI2110 extends BP2110
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2110(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2111.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2111.java
new file mode 100644
index 000000000..3359b5f4a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2111.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2111
+ */
+public class WSI2111 extends BP2111
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2111(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2112.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2112.java
new file mode 100644
index 000000000..b76f752b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2112.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2112
+ */
+public class WSI2112 extends BP2112
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2112(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2113.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2113.java
new file mode 100644
index 000000000..3b7687c81
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2113.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2113
+ */
+public class WSI2113 extends BP2113
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2113(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2114.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2114.java
new file mode 100644
index 000000000..1e53f7b1f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2114.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2114
+ */
+public class WSI2114 extends BP2114
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2114(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2115.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2115.java
new file mode 100644
index 000000000..0f8457680
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2115.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2115
+ */
+public class WSI2115 extends BP2115
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2115(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2116.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2116.java
new file mode 100644
index 000000000..f83fecabb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2116.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2116
+ */
+public class WSI2116 extends BP2116
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2116(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2117.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2117.java
new file mode 100644
index 000000000..54485c5b5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2117.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2117
+ */
+public class WSI2117 extends BP2117
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2117(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2118.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2118.java
new file mode 100644
index 000000000..57abd7bca
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2118.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2118
+ */
+public class WSI2118 extends BP2118
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2118(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2119.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2119.java
new file mode 100644
index 000000000..49203e280
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2119.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2119
+ */
+public class WSI2119 extends BP2119
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2119(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2120.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2120.java
new file mode 100644
index 000000000..61b329ca9
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2120.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2120
+ */
+public class WSI2120 extends BP2120
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2120(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2122.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2122.java
new file mode 100644
index 000000000..0e750479c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2122.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2122
+ */
+public class WSI2122 extends BP2122
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2122(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2123.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2123.java
new file mode 100644
index 000000000..f921782b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2123.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2123
+ */
+public class WSI2123 extends BP2123
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2123(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2201.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2201.java
new file mode 100644
index 000000000..d45262990
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2201.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2201
+ */
+public class WSI2201 extends BP2201
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2201(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2202.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2202.java
new file mode 100644
index 000000000..fbcc6f448
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2202.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2202
+ */
+public class WSI2202 extends BP2202
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2208.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2208.java
new file mode 100644
index 000000000..3782d58ec
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2208.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2208
+ */
+public class WSI2208 extends BP2208
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2208(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2402.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2402.java
new file mode 100644
index 000000000..7b3f43512
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2402.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2402
+ */
+public class WSI2402 extends BP2402
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2402(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2403.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2403.java
new file mode 100644
index 000000000..cbdf0e097
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2403.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2403
+ */
+public class WSI2403 extends SSBP2403
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2403(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2404.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2404.java
new file mode 100644
index 000000000..c5852ad95
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2404.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2404
+ */
+public class WSI2404 extends BP2404
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2404(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2406.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2406.java
new file mode 100644
index 000000000..ecbf7808e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2406.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2406
+ */
+public class WSI2406 extends BP2406
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2406(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2416.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2416.java
new file mode 100644
index 000000000..64f08cfcd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2416.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2416
+ */
+public class WSI2416 extends BP2416
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2416(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2417.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2417.java
new file mode 100644
index 000000000..a7efc43e7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2417.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2417
+ */
+public class WSI2417 extends BP2417
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2417(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2700.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2700.java
new file mode 100644
index 000000000..7e203a9f8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2700.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2700
+ */
+public class WSI2700 extends BP2700
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2700(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2701.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2701.java
new file mode 100644
index 000000000..17ae8ab10
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2701.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2701
+ */
+public class WSI2701 extends BP2701
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2701(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2703.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2703.java
new file mode 100644
index 000000000..20dcef1ad
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI2703.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI2703
+ */
+public class WSI2703 extends BP2703
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2703(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4200.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4200.java
new file mode 100644
index 000000000..2d85a691e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4200.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI4200
+ */
+public class WSI4200 extends BP4200
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI4200(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4201.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4201.java
new file mode 100644
index 000000000..9ff484487
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4201.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI4201
+ */
+public class WSI4201 extends BP4201
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI4201(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4202.java b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4202.java
new file mode 100644
index 000000000..9155872c2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/wsitools/org/eclipse/wst/wsi/internal/profile/validator/impl/wsdl/WSI4202.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002-2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.wsi.internal.profile.validator.impl.wsdl;
+
+/**
+ * WSI4202
+ */
+public class WSI4202 extends BP4202
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI4202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file

Back to the top