tomdz-soap4r 1.5.8.20111103171510

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. data/bin/wsdl2ruby.rb +139 -0
  2. data/bin/xsd2ruby.rb +91 -0
  3. data/lib/soap/attachment.rb +109 -0
  4. data/lib/soap/attrproxy.rb +35 -0
  5. data/lib/soap/baseData.rb +1095 -0
  6. data/lib/soap/element.rb +278 -0
  7. data/lib/soap/encodingstyle/aspDotNetHandler.rb +208 -0
  8. data/lib/soap/encodingstyle/handler.rb +121 -0
  9. data/lib/soap/encodingstyle/literalHandler.rb +196 -0
  10. data/lib/soap/encodingstyle/soapHandler.rb +560 -0
  11. data/lib/soap/filter.rb +14 -0
  12. data/lib/soap/filter/filterchain.rb +52 -0
  13. data/lib/soap/filter/handler.rb +32 -0
  14. data/lib/soap/filter/streamhandler.rb +30 -0
  15. data/lib/soap/generator.rb +299 -0
  16. data/lib/soap/header/handler.rb +62 -0
  17. data/lib/soap/header/handlerset.rb +71 -0
  18. data/lib/soap/header/mappinghandler.rb +48 -0
  19. data/lib/soap/header/simplehandler.rb +45 -0
  20. data/lib/soap/httpconfigloader.rb +140 -0
  21. data/lib/soap/mapping.rb +13 -0
  22. data/lib/soap/mapping/encodedregistry.rb +539 -0
  23. data/lib/soap/mapping/factory.rb +389 -0
  24. data/lib/soap/mapping/literalregistry.rb +392 -0
  25. data/lib/soap/mapping/mapping.rb +577 -0
  26. data/lib/soap/mapping/registry.rb +296 -0
  27. data/lib/soap/mapping/rubytypeFactory.rb +446 -0
  28. data/lib/soap/mapping/schemadefinition.rb +171 -0
  29. data/lib/soap/mapping/typeMap.rb +107 -0
  30. data/lib/soap/mapping/wsdlencodedregistry.rb +212 -0
  31. data/lib/soap/mapping/wsdlliteralregistry.rb +249 -0
  32. data/lib/soap/marshal.rb +60 -0
  33. data/lib/soap/mimemessage.rb +243 -0
  34. data/lib/soap/nestedexception.rb +43 -0
  35. data/lib/soap/netHttpClient.rb +242 -0
  36. data/lib/soap/ns.rb +39 -0
  37. data/lib/soap/parser.rb +253 -0
  38. data/lib/soap/processor.rb +67 -0
  39. data/lib/soap/property.rb +340 -0
  40. data/lib/soap/proxy.rb +15 -0
  41. data/lib/soap/rpc/cgistub.rb +248 -0
  42. data/lib/soap/rpc/driver.rb +222 -0
  43. data/lib/soap/rpc/element.rb +375 -0
  44. data/lib/soap/rpc/httpserver.rb +143 -0
  45. data/lib/soap/rpc/methodDef.rb +69 -0
  46. data/lib/soap/rpc/proxy.rb +573 -0
  47. data/lib/soap/rpc/router.rb +663 -0
  48. data/lib/soap/rpc/rpc.rb +26 -0
  49. data/lib/soap/rpc/soaplet.rb +201 -0
  50. data/lib/soap/rpc/standaloneServer.rb +44 -0
  51. data/lib/soap/soap.rb +154 -0
  52. data/lib/soap/streamHandler.rb +302 -0
  53. data/lib/soap/version.rb +9 -0
  54. data/lib/soap/wsdlDriver.rb +165 -0
  55. data/lib/wsdl/binding.rb +66 -0
  56. data/lib/wsdl/data.rb +65 -0
  57. data/lib/wsdl/definitions.rb +237 -0
  58. data/lib/wsdl/documentation.rb +33 -0
  59. data/lib/wsdl/import.rb +81 -0
  60. data/lib/wsdl/importer.rb +39 -0
  61. data/lib/wsdl/info.rb +51 -0
  62. data/lib/wsdl/message.rb +55 -0
  63. data/lib/wsdl/operation.rb +152 -0
  64. data/lib/wsdl/operationBinding.rb +241 -0
  65. data/lib/wsdl/param.rb +94 -0
  66. data/lib/wsdl/parser.rb +165 -0
  67. data/lib/wsdl/part.rb +53 -0
  68. data/lib/wsdl/port.rb +67 -0
  69. data/lib/wsdl/portType.rb +76 -0
  70. data/lib/wsdl/service.rb +62 -0
  71. data/lib/wsdl/soap/address.rb +41 -0
  72. data/lib/wsdl/soap/binding.rb +50 -0
  73. data/lib/wsdl/soap/body.rb +59 -0
  74. data/lib/wsdl/soap/cgiStubCreator.rb +93 -0
  75. data/lib/wsdl/soap/classDefCreator.rb +434 -0
  76. data/lib/wsdl/soap/classDefCreatorSupport.rb +241 -0
  77. data/lib/wsdl/soap/classNameCreator.rb +55 -0
  78. data/lib/wsdl/soap/clientSkeltonCreator.rb +107 -0
  79. data/lib/wsdl/soap/complexType.rb +174 -0
  80. data/lib/wsdl/soap/data.rb +43 -0
  81. data/lib/wsdl/soap/definitions.rb +201 -0
  82. data/lib/wsdl/soap/driverCreator.rb +121 -0
  83. data/lib/wsdl/soap/element.rb +34 -0
  84. data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +74 -0
  85. data/lib/wsdl/soap/fault.rb +57 -0
  86. data/lib/wsdl/soap/header.rb +87 -0
  87. data/lib/wsdl/soap/headerfault.rb +57 -0
  88. data/lib/wsdl/soap/literalMappingRegistryCreator.rb +116 -0
  89. data/lib/wsdl/soap/mappingRegistryCreator.rb +59 -0
  90. data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +377 -0
  91. data/lib/wsdl/soap/methodDefCreator.rb +200 -0
  92. data/lib/wsdl/soap/operation.rb +113 -0
  93. data/lib/wsdl/soap/servantSkeltonCreator.rb +92 -0
  94. data/lib/wsdl/soap/servletStubCreator.rb +105 -0
  95. data/lib/wsdl/soap/standaloneServerStubCreator.rb +101 -0
  96. data/lib/wsdl/soap/wsdl2ruby.rb +226 -0
  97. data/lib/wsdl/types.rb +45 -0
  98. data/lib/wsdl/wsdl.rb +25 -0
  99. data/lib/wsdl/xmlSchema/all.rb +25 -0
  100. data/lib/wsdl/xmlSchema/annotation.rb +35 -0
  101. data/lib/wsdl/xmlSchema/any.rb +62 -0
  102. data/lib/wsdl/xmlSchema/anyAttribute.rb +49 -0
  103. data/lib/wsdl/xmlSchema/attribute.rb +105 -0
  104. data/lib/wsdl/xmlSchema/attributeGroup.rb +69 -0
  105. data/lib/wsdl/xmlSchema/choice.rb +59 -0
  106. data/lib/wsdl/xmlSchema/complexContent.rb +98 -0
  107. data/lib/wsdl/xmlSchema/complexExtension.rb +120 -0
  108. data/lib/wsdl/xmlSchema/complexRestriction.rb +105 -0
  109. data/lib/wsdl/xmlSchema/complexType.rb +194 -0
  110. data/lib/wsdl/xmlSchema/content.rb +96 -0
  111. data/lib/wsdl/xmlSchema/data.rb +117 -0
  112. data/lib/wsdl/xmlSchema/element.rb +154 -0
  113. data/lib/wsdl/xmlSchema/enumeration.rb +37 -0
  114. data/lib/wsdl/xmlSchema/fractiondigits.rb +38 -0
  115. data/lib/wsdl/xmlSchema/group.rb +101 -0
  116. data/lib/wsdl/xmlSchema/import.rb +54 -0
  117. data/lib/wsdl/xmlSchema/importHandler.rb +46 -0
  118. data/lib/wsdl/xmlSchema/importer.rb +103 -0
  119. data/lib/wsdl/xmlSchema/include.rb +49 -0
  120. data/lib/wsdl/xmlSchema/length.rb +38 -0
  121. data/lib/wsdl/xmlSchema/list.rb +49 -0
  122. data/lib/wsdl/xmlSchema/maxexclusive.rb +38 -0
  123. data/lib/wsdl/xmlSchema/maxinclusive.rb +38 -0
  124. data/lib/wsdl/xmlSchema/maxlength.rb +38 -0
  125. data/lib/wsdl/xmlSchema/minexclusive.rb +38 -0
  126. data/lib/wsdl/xmlSchema/mininclusive.rb +38 -0
  127. data/lib/wsdl/xmlSchema/minlength.rb +38 -0
  128. data/lib/wsdl/xmlSchema/parser.rb +168 -0
  129. data/lib/wsdl/xmlSchema/pattern.rb +37 -0
  130. data/lib/wsdl/xmlSchema/ref.rb +34 -0
  131. data/lib/wsdl/xmlSchema/schema.rb +179 -0
  132. data/lib/wsdl/xmlSchema/sequence.rb +55 -0
  133. data/lib/wsdl/xmlSchema/simpleContent.rb +70 -0
  134. data/lib/wsdl/xmlSchema/simpleExtension.rb +63 -0
  135. data/lib/wsdl/xmlSchema/simpleRestriction.rb +133 -0
  136. data/lib/wsdl/xmlSchema/simpleType.rb +88 -0
  137. data/lib/wsdl/xmlSchema/totaldigits.rb +38 -0
  138. data/lib/wsdl/xmlSchema/union.rb +36 -0
  139. data/lib/wsdl/xmlSchema/unique.rb +35 -0
  140. data/lib/wsdl/xmlSchema/whitespace.rb +38 -0
  141. data/lib/wsdl/xmlSchema/xsd2ruby.rb +176 -0
  142. data/lib/xsd/charset.rb +190 -0
  143. data/lib/xsd/codegen.rb +13 -0
  144. data/lib/xsd/codegen/classdef.rb +209 -0
  145. data/lib/xsd/codegen/commentdef.rb +35 -0
  146. data/lib/xsd/codegen/gensupport.rb +277 -0
  147. data/lib/xsd/codegen/methoddef.rb +71 -0
  148. data/lib/xsd/codegen/moduledef.rb +209 -0
  149. data/lib/xsd/datatypes.rb +1466 -0
  150. data/lib/xsd/datatypes1999.rb +21 -0
  151. data/lib/xsd/iconvcharset.rb +34 -0
  152. data/lib/xsd/mapping.rb +69 -0
  153. data/lib/xsd/namedelements.rb +133 -0
  154. data/lib/xsd/ns.rb +183 -0
  155. data/lib/xsd/qname.rb +80 -0
  156. data/lib/xsd/xmlparser.rb +77 -0
  157. data/lib/xsd/xmlparser/libxmlparser.rb +116 -0
  158. data/lib/xsd/xmlparser/parser.rb +101 -0
  159. data/lib/xsd/xmlparser/rexmlparser.rb +59 -0
  160. data/lib/xsd/xmlparser/xmlparser.rb +51 -0
  161. data/lib/xsd/xmlparser/xmlscanner.rb +150 -0
  162. data/test/16runner.rb +69 -0
  163. data/test/helper.rb +7 -0
  164. data/test/interopR2/README.txt +2 -0
  165. data/test/interopR2/SOAPBuildersInterop_R2.wsdl +461 -0
  166. data/test/interopR2/SOAPBuildersInterop_R2GrB.wsdl +19 -0
  167. data/test/interopR2/base.rb +289 -0
  168. data/test/interopR2/client.NetRemoting.rb +18 -0
  169. data/test/interopR2/client.rb +1235 -0
  170. data/test/interopR2/client4S4C.rb +16 -0
  171. data/test/interopR2/client4S4C2.rb +15 -0
  172. data/test/interopR2/clientASP.NET.rb +18 -0
  173. data/test/interopR2/clientApacheAxis.rb +17 -0
  174. data/test/interopR2/clientApacheSOAP.rb +18 -0
  175. data/test/interopR2/clientBEAWebLogic.rb +18 -0
  176. data/test/interopR2/clientBase.rb +1968 -0
  177. data/test/interopR2/clientCapeConnect.rb +19 -0
  178. data/test/interopR2/clientDelphi.rb +20 -0
  179. data/test/interopR2/clientEasySoap.rb +15 -0
  180. data/test/interopR2/clientFrontier.rb +26 -0
  181. data/test/interopR2/clientGLUE.rb +33 -0
  182. data/test/interopR2/clientHP.rb +14 -0
  183. data/test/interopR2/clientJAX-RPC.rb +20 -0
  184. data/test/interopR2/clientJSOAP.rb +15 -0
  185. data/test/interopR2/clientKafkaXSLT.rb +16 -0
  186. data/test/interopR2/clientMSSOAPToolkit2.0.rb +18 -0
  187. data/test/interopR2/clientMSSOAPToolkit3.0.rb +18 -0
  188. data/test/interopR2/clientNuSOAP.rb +20 -0
  189. data/test/interopR2/clientNuWave.rb +16 -0
  190. data/test/interopR2/clientOpenLink.rb +16 -0
  191. data/test/interopR2/clientOracle.rb +16 -0
  192. data/test/interopR2/clientPEAR.rb +19 -0
  193. data/test/interopR2/clientPhalanx.rb +19 -0
  194. data/test/interopR2/clientSIMACE.rb +19 -0
  195. data/test/interopR2/clientSOAP4R.rb +19 -0
  196. data/test/interopR2/clientSOAP__Lite.rb +15 -0
  197. data/test/interopR2/clientSQLData.rb +19 -0
  198. data/test/interopR2/clientSilverStream.rb +18 -0
  199. data/test/interopR2/clientSpray2001.rb +18 -0
  200. data/test/interopR2/clientSun.rb +20 -0
  201. data/test/interopR2/clientVWOpentalkSoap.rb +20 -0
  202. data/test/interopR2/clientWASP.rb +20 -0
  203. data/test/interopR2/clientWASPC.rb +19 -0
  204. data/test/interopR2/clientWebMethods.rb +16 -0
  205. data/test/interopR2/clientWhiteMesa.rb +29 -0
  206. data/test/interopR2/clientWingfoot.rb +16 -0
  207. data/test/interopR2/clientXMLBus.rb +20 -0
  208. data/test/interopR2/clientXMLRPC-EPI.rb +18 -0
  209. data/test/interopR2/clientXSOAP.rb +15 -0
  210. data/test/interopR2/clientZSI.rb +20 -0
  211. data/test/interopR2/clienteSOAP.rb +19 -0
  212. data/test/interopR2/clientgSOAP.rb +19 -0
  213. data/test/interopR2/clientkSOAP.rb +18 -0
  214. data/test/interopR2/iSimonReg.rb +113 -0
  215. data/test/interopR2/interopResultBase.rb +115 -0
  216. data/test/interopR2/interopService.rb +248 -0
  217. data/test/interopR2/rwikiInteropService.rb +106 -0
  218. data/test/interopR2/server.cgi +271 -0
  219. data/test/interopR2/server.rb +276 -0
  220. data/test/interopR2/simonReg.rb +124 -0
  221. data/test/interopR2/test.sh +49 -0
  222. data/test/interopR4/client.rb +113 -0
  223. data/test/runner.rb +8 -0
  224. data/test/sm11/classDef.rb +157 -0
  225. data/test/sm11/client.rb +543 -0
  226. data/test/sm11/driver.rb +184 -0
  227. data/test/sm11/servant.rb +1068 -0
  228. data/test/sm11/server.rb +26 -0
  229. data/test/soap/asp.net/hello.wsdl +96 -0
  230. data/test/soap/asp.net/test_aspdotnet.rb +124 -0
  231. data/test/soap/auth/htdigest +2 -0
  232. data/test/soap/auth/htpasswd +2 -0
  233. data/test/soap/auth/test_basic.rb +118 -0
  234. data/test/soap/auth/test_digest.rb +119 -0
  235. data/test/soap/calc/calc.rb +18 -0
  236. data/test/soap/calc/calc2.rb +30 -0
  237. data/test/soap/calc/server.cgi +16 -0
  238. data/test/soap/calc/server.rb +18 -0
  239. data/test/soap/calc/server2.rb +21 -0
  240. data/test/soap/calc/test_calc.rb +53 -0
  241. data/test/soap/calc/test_calc2.rb +57 -0
  242. data/test/soap/calc/test_calc_cgi.rb +72 -0
  243. data/test/soap/case/test_mapping.rb +58 -0
  244. data/test/soap/fault/test_customfault.rb +61 -0
  245. data/test/soap/fault/test_fault.rb +47 -0
  246. data/test/soap/fault/test_soaparray.rb +36 -0
  247. data/test/soap/filter/test_filter.rb +147 -0
  248. data/test/soap/header/server.cgi +121 -0
  249. data/test/soap/header/test_authheader.rb +241 -0
  250. data/test/soap/header/test_authheader_cgi.rb +122 -0
  251. data/test/soap/header/test_simplehandler.rb +117 -0
  252. data/test/soap/helloworld/hw_s.rb +17 -0
  253. data/test/soap/helloworld/test_helloworld.rb +45 -0
  254. data/test/soap/htpasswd +2 -0
  255. data/test/soap/literalArrayMapping/amazonEc.rb +4779 -0
  256. data/test/soap/literalArrayMapping/amazonEcDriver.rb +173 -0
  257. data/test/soap/literalArrayMapping/amazonresponse.xml +100 -0
  258. data/test/soap/literalArrayMapping/test_definedarray.rb +35 -0
  259. data/test/soap/marshal/marshaltestlib.rb +498 -0
  260. data/test/soap/marshal/test_digraph.rb +57 -0
  261. data/test/soap/marshal/test_marshal.rb +28 -0
  262. data/test/soap/marshal/test_struct.rb +48 -0
  263. data/test/soap/ssl/README +1 -0
  264. data/test/soap/ssl/ca.cert +23 -0
  265. data/test/soap/ssl/client.cert +19 -0
  266. data/test/soap/ssl/client.key +15 -0
  267. data/test/soap/ssl/server.cert +19 -0
  268. data/test/soap/ssl/server.key +15 -0
  269. data/test/soap/ssl/sslsvr.rb +59 -0
  270. data/test/soap/ssl/subca.cert +21 -0
  271. data/test/soap/ssl/test_ssl.rb +236 -0
  272. data/test/soap/struct/test_struct.rb +71 -0
  273. data/test/soap/styleuse/client.rb +21 -0
  274. data/test/soap/styleuse/server.rb +87 -0
  275. data/test/soap/swa/test_file.rb +76 -0
  276. data/test/soap/test_basetype.rb +1091 -0
  277. data/test/soap/test_cookie.rb +113 -0
  278. data/test/soap/test_custom_ns.rb +106 -0
  279. data/test/soap/test_custommap.rb +111 -0
  280. data/test/soap/test_empty.rb +106 -0
  281. data/test/soap/test_envelopenamespace.rb +86 -0
  282. data/test/soap/test_extraattr.rb +55 -0
  283. data/test/soap/test_generator.rb +32 -0
  284. data/test/soap/test_httpconfigloader.rb +72 -0
  285. data/test/soap/test_mapping.rb +132 -0
  286. data/test/soap/test_nestedexception.rb +71 -0
  287. data/test/soap/test_nil.rb +71 -0
  288. data/test/soap/test_no_indent.rb +89 -0
  289. data/test/soap/test_property.rb +429 -0
  290. data/test/soap/test_response_as_xml.rb +118 -0
  291. data/test/soap/test_soapelement.rb +139 -0
  292. data/test/soap/test_streamhandler.rb +271 -0
  293. data/test/soap/test_styleuse.rb +327 -0
  294. data/test/soap/wsdlDriver/README.txt +2 -0
  295. data/test/soap/wsdlDriver/calc.wsdl +126 -0
  296. data/test/soap/wsdlDriver/document.wsdl +54 -0
  297. data/test/soap/wsdlDriver/echo_version.rb +30 -0
  298. data/test/soap/wsdlDriver/simpletype.wsdl +63 -0
  299. data/test/soap/wsdlDriver/test_calc.rb +72 -0
  300. data/test/soap/wsdlDriver/test_document.rb +72 -0
  301. data/test/soap/wsdlDriver/test_simpletype.rb +82 -0
  302. data/test/testutil.rb +55 -0
  303. data/test/wsdl/abstract/abstract.wsdl +176 -0
  304. data/test/wsdl/abstract/test_abstract.rb +160 -0
  305. data/test/wsdl/anonymous/expectedClassDef.rb +129 -0
  306. data/test/wsdl/anonymous/expectedDriver.rb +60 -0
  307. data/test/wsdl/anonymous/expectedMappingRegistry.rb +177 -0
  308. data/test/wsdl/anonymous/lp.wsdl +147 -0
  309. data/test/wsdl/anonymous/test_anonymous.rb +131 -0
  310. data/test/wsdl/any/any.wsdl +114 -0
  311. data/test/wsdl/any/expectedDriver.rb +69 -0
  312. data/test/wsdl/any/expectedEcho.rb +58 -0
  313. data/test/wsdl/any/expectedMappingRegistry.rb +64 -0
  314. data/test/wsdl/any/expectedService.rb +70 -0
  315. data/test/wsdl/any/test_any.rb +194 -0
  316. data/test/wsdl/axisArray/axisArray.wsdl +87 -0
  317. data/test/wsdl/axisArray/test_axisarray.rb +125 -0
  318. data/test/wsdl/choice/choice.wsdl +167 -0
  319. data/test/wsdl/choice/test_choice.rb +311 -0
  320. data/test/wsdl/complexcontent/complexContent.wsdl +83 -0
  321. data/test/wsdl/complexcontent/test_echo.rb +91 -0
  322. data/test/wsdl/datetime/DatetimeService.rb +45 -0
  323. data/test/wsdl/datetime/datetime.rb +0 -0
  324. data/test/wsdl/datetime/datetime.wsdl +45 -0
  325. data/test/wsdl/datetime/datetimeServant.rb +23 -0
  326. data/test/wsdl/datetime/test_datetime.rb +88 -0
  327. data/test/wsdl/document/array/double.wsdl +161 -0
  328. data/test/wsdl/document/array/test_array.rb +202 -0
  329. data/test/wsdl/document/document.wsdl +76 -0
  330. data/test/wsdl/document/number.wsdl +54 -0
  331. data/test/wsdl/document/ping_nosoapaction.wsdl +66 -0
  332. data/test/wsdl/document/test_nosoapaction.rb +103 -0
  333. data/test/wsdl/document/test_number.rb +93 -0
  334. data/test/wsdl/document/test_rpc.rb +356 -0
  335. data/test/wsdl/emptycomplextype.wsdl +31 -0
  336. data/test/wsdl/fault/fault.wsdl +79 -0
  337. data/test/wsdl/fault/multifault.wsdl +96 -0
  338. data/test/wsdl/fault/test_fault.rb +120 -0
  339. data/test/wsdl/fault/test_multifault.rb +135 -0
  340. data/test/wsdl/group/expectedClassdef.rb +59 -0
  341. data/test/wsdl/group/expectedDriver.rb +52 -0
  342. data/test/wsdl/group/expectedMappingRegistry.rb +68 -0
  343. data/test/wsdl/group/group.wsdl +88 -0
  344. data/test/wsdl/group/test_rpc.rb +146 -0
  345. data/test/wsdl/list/list.wsdl +93 -0
  346. data/test/wsdl/list/test_list.rb +125 -0
  347. data/test/wsdl/map/map.wsdl +92 -0
  348. data/test/wsdl/map/map.xml +43 -0
  349. data/test/wsdl/map/test_map.rb +100 -0
  350. data/test/wsdl/marshal/person.wsdl +21 -0
  351. data/test/wsdl/marshal/person_org.rb +24 -0
  352. data/test/wsdl/marshal/test_wsdlmarshal.rb +76 -0
  353. data/test/wsdl/multiplefault.wsdl +75 -0
  354. data/test/wsdl/oneway/oneway.wsdl +36 -0
  355. data/test/wsdl/oneway/test_oneway.rb +109 -0
  356. data/test/wsdl/overload/expectedClient.rb +38 -0
  357. data/test/wsdl/overload/expectedDriver.rb +62 -0
  358. data/test/wsdl/overload/expectedServant.rb +36 -0
  359. data/test/wsdl/overload/overload.wsdl +70 -0
  360. data/test/wsdl/overload/test_overload.rb +132 -0
  361. data/test/wsdl/qualified/lp.wsdl +47 -0
  362. data/test/wsdl/qualified/lp.xsd +26 -0
  363. data/test/wsdl/qualified/np.wsdl +51 -0
  364. data/test/wsdl/qualified/test_qualified.rb +138 -0
  365. data/test/wsdl/qualified/test_unqualified.rb +139 -0
  366. data/test/wsdl/raa/RAAService.rb +126 -0
  367. data/test/wsdl/raa/README.txt +8 -0
  368. data/test/wsdl/raa/expectedClassDef.rb +101 -0
  369. data/test/wsdl/raa/expectedDriver.rb +97 -0
  370. data/test/wsdl/raa/expectedMappingRegistry.rb +122 -0
  371. data/test/wsdl/raa/raa.wsdl +264 -0
  372. data/test/wsdl/raa/test_raa.rb +127 -0
  373. data/test/wsdl/ref/expectedDriver.rb +52 -0
  374. data/test/wsdl/ref/expectedProduct.rb +244 -0
  375. data/test/wsdl/ref/product.wsdl +147 -0
  376. data/test/wsdl/ref/test_ref.rb +269 -0
  377. data/test/wsdl/rpc/rpc.wsdl +109 -0
  378. data/test/wsdl/rpc/test-rpc-lit.wsdl +371 -0
  379. data/test/wsdl/rpc/test_rpc.rb +177 -0
  380. data/test/wsdl/rpc/test_rpc_lit.rb +471 -0
  381. data/test/wsdl/simplecontent/simplecontent.wsdl +84 -0
  382. data/test/wsdl/simplecontent/test_simplecontent.rb +103 -0
  383. data/test/wsdl/simpletype/rpc/expectedClient.rb +35 -0
  384. data/test/wsdl/simpletype/rpc/expectedDriver.rb +59 -0
  385. data/test/wsdl/simpletype/rpc/expectedEchoVersion.rb +37 -0
  386. data/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +58 -0
  387. data/test/wsdl/simpletype/rpc/expectedServant.rb +33 -0
  388. data/test/wsdl/simpletype/rpc/expectedService.rb +56 -0
  389. data/test/wsdl/simpletype/rpc/rpc.wsdl +98 -0
  390. data/test/wsdl/simpletype/rpc/test_rpc.rb +53 -0
  391. data/test/wsdl/simpletype/simpletype.wsdl +114 -0
  392. data/test/wsdl/simpletype/test_simpletype.rb +93 -0
  393. data/test/wsdl/soap/soapbodyparts.wsdl +103 -0
  394. data/test/wsdl/soap/test_soapbodyparts.rb +80 -0
  395. data/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb +22 -0
  396. data/test/wsdl/soap/wsdl2ruby/expectedClient.rb +35 -0
  397. data/test/wsdl/soap/wsdl2ruby/expectedDriver.rb +59 -0
  398. data/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +37 -0
  399. data/test/wsdl/soap/wsdl2ruby/expectedServant.rb +33 -0
  400. data/test/wsdl/soap/wsdl2ruby/expectedService.cgi +49 -0
  401. data/test/wsdl/soap/wsdl2ruby/expectedService.rb +56 -0
  402. data/test/wsdl/soap/wsdl2ruby/rpc.wsdl +80 -0
  403. data/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb +38 -0
  404. data/test/wsdl/soap/wsdl2ruby/section/section.xsd +31 -0
  405. data/test/wsdl/soap/wsdl2ruby/section/test_section.rb +54 -0
  406. data/test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl +64 -0
  407. data/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +84 -0
  408. data/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb +103 -0
  409. data/test/wsdl/soaptype/soaptype.wsdl +61 -0
  410. data/test/wsdl/soaptype/test_soaptype.rb +179 -0
  411. data/test/wsdl/test_emptycomplextype.rb +22 -0
  412. data/test/wsdl/test_fault.rb +51 -0
  413. data/test/wsdl/test_multiplefault.rb +42 -0
  414. data/test/xsd/codegen/test_classdef.rb +245 -0
  415. data/test/xsd/noencoding.xml +4 -0
  416. data/test/xsd/test_noencoding.rb +33 -0
  417. data/test/xsd/test_ns.rb +42 -0
  418. data/test/xsd/test_xmlschemaparser.rb +23 -0
  419. data/test/xsd/test_xsd.rb +1639 -0
  420. data/test/xsd/xmllang.xml +43 -0
  421. data/test/xsd/xmlschema.xml +12 -0
  422. data/test/xsd/xsd2ruby/expected_mysample.rb +66 -0
  423. data/test/xsd/xsd2ruby/expected_mysample_mapper.rb +12 -0
  424. data/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +52 -0
  425. data/test/xsd/xsd2ruby/section.xsd +49 -0
  426. data/test/xsd/xsd2ruby/test_xsd2ruby.rb +91 -0
  427. metadata +490 -0
@@ -0,0 +1,143 @@
1
+ # encoding: ASCII-8BIT
2
+ # SOAP4R - WEBrick HTTP Server
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'logger'
11
+ require 'soap/attrproxy'
12
+ require 'soap/rpc/soaplet'
13
+ require 'soap/streamHandler'
14
+ require 'webrick'
15
+
16
+
17
+ module SOAP
18
+ module RPC
19
+
20
+
21
+ class HTTPServer < Logger::Application
22
+ include AttrProxy
23
+
24
+ attr_reader :server
25
+ attr_accessor :default_namespace
26
+
27
+ attr_proxy :mapping_registry, true
28
+ attr_proxy :literal_mapping_registry, true
29
+ attr_proxy :generate_explicit_type, true
30
+ attr_proxy :use_default_namespace, true
31
+
32
+ def initialize(config)
33
+ actor = config[:SOAPHTTPServerApplicationName] || self.class.name
34
+ super(actor)
35
+ @default_namespace = config[:SOAPDefaultNamespace]
36
+ @webrick_config = config.dup
37
+ self.level = Logger::Severity::ERROR # keep silent by default
38
+ @webrick_config[:Logger] ||= @log
39
+ @log = @webrick_config[:Logger] # sync logger of App and HTTPServer
40
+ @router = ::SOAP::RPC::Router.new(actor)
41
+ @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
42
+ on_init
43
+ @server = WEBrick::HTTPServer.new(@webrick_config)
44
+ @server.mount('/soaprouter', @soaplet)
45
+ if wsdldir = config[:WSDLDocumentDirectory]
46
+ @server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir)
47
+ end
48
+ @server.mount('/', @soaplet)
49
+ end
50
+
51
+ def on_init
52
+ # do extra initialization in a derived class if needed.
53
+ end
54
+
55
+ def status
56
+ @server.status if @server
57
+ end
58
+
59
+ def shutdown
60
+ @server.shutdown if @server
61
+ end
62
+
63
+ def authenticator
64
+ @soaplet.authenticator
65
+ end
66
+
67
+ def authenticator=(authenticator)
68
+ @soaplet.authenticator = authenticator
69
+ end
70
+
71
+ # servant entry interface
72
+
73
+ def add_rpc_request_servant(factory, namespace = @default_namespace)
74
+ @router.add_rpc_request_servant(factory, namespace)
75
+ end
76
+
77
+ def add_rpc_servant(obj, namespace = @default_namespace)
78
+ @router.add_rpc_servant(obj, namespace)
79
+ end
80
+
81
+ def add_request_headerhandler(factory)
82
+ @router.add_request_headerhandler(factory)
83
+ end
84
+
85
+ def add_headerhandler(obj)
86
+ @router.add_headerhandler(obj)
87
+ end
88
+ alias add_rpc_headerhandler add_headerhandler
89
+
90
+ def filterchain
91
+ @router.filterchain
92
+ end
93
+
94
+ # method entry interface
95
+
96
+ def add_rpc_method(obj, name, *param)
97
+ add_rpc_method_as(obj, name, name, *param)
98
+ end
99
+ alias add_method add_rpc_method
100
+
101
+ def add_rpc_method_as(obj, name, name_as, *param)
102
+ qname = XSD::QName.new(@default_namespace, name_as)
103
+ soapaction = nil
104
+ param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
105
+ @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
106
+ end
107
+ alias add_method_as add_rpc_method_as
108
+
109
+ def add_document_method(obj, soapaction, name, req_qnames, res_qnames)
110
+ param_def = SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
111
+ @router.add_document_operation(obj, soapaction, name, param_def)
112
+ end
113
+
114
+ def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
115
+ @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
116
+ end
117
+
118
+ def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
119
+ @router.add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt)
120
+ end
121
+
122
+ def add_document_operation(receiver, soapaction, name, param_def, opt = {})
123
+ @router.add_document_operation(receiver, soapaction, name, param_def, opt)
124
+ end
125
+
126
+ def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
127
+ @router.add_document_request_operation(factory, soapaction, name, param_def, opt)
128
+ end
129
+
130
+ private
131
+
132
+ def attrproxy
133
+ @router
134
+ end
135
+
136
+ def run
137
+ @server.start
138
+ end
139
+ end
140
+
141
+
142
+ end
143
+ end
@@ -0,0 +1,69 @@
1
+ # encoding: ASCII-8BIT
2
+ # SOAP4R - A method definition
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ module SOAP
11
+ module RPC
12
+
13
+
14
+ class MethodDef
15
+ attr_reader :name
16
+ attr_reader :soapaction
17
+ attr_reader :qname
18
+ attr_accessor :style
19
+ attr_accessor :inputuse
20
+ attr_accessor :outputuse
21
+ attr_reader :parameters
22
+ attr_reader :faults
23
+
24
+ def initialize(name, soapaction, qname)
25
+ @name = name
26
+ @soapaction = soapaction
27
+ @qname = qname
28
+ @style = @inputuse = @outputuse = nil
29
+ @parameters = []
30
+ @faults = {}
31
+ end
32
+
33
+ def add_parameter(io_type, name, qname, mapped_class)
34
+ @parameters << Parameter.new(io_type, name, qname, mapped_class)
35
+ end
36
+
37
+ def self.to_param(param)
38
+ if param.respond_to?(:io_type)
39
+ param
40
+ else
41
+ io_type, name, param_type = param
42
+ mapped_class_str, nsdef, namedef = param_type
43
+ if nsdef && namedef
44
+ qname = XSD::QName.new(nsdef, namedef)
45
+ else
46
+ qname = nil
47
+ end
48
+ MethodDef::Parameter.new(io_type.to_sym, name, qname, mapped_class_str)
49
+ end
50
+ end
51
+
52
+ class Parameter
53
+ attr_reader :io_type
54
+ attr_reader :name
55
+ attr_reader :qname
56
+ attr_reader :mapped_class
57
+
58
+ def initialize(io_type, name, qname, mapped_class)
59
+ @io_type = io_type
60
+ @name = name
61
+ @qname = qname
62
+ @mapped_class = mapped_class
63
+ end
64
+ end
65
+ end
66
+
67
+
68
+ end
69
+ end
@@ -0,0 +1,573 @@
1
+ # encoding: ASCII-8BIT
2
+ # SOAP4R - RPC Proxy library.
3
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
+
5
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
6
+ # redistribute it and/or modify it under the same terms of Ruby's license;
7
+ # either the dual license version in 2003, or any later version.
8
+
9
+
10
+ require 'soap/soap'
11
+ require 'soap/processor'
12
+ require 'soap/mapping'
13
+ require 'soap/mapping/literalregistry'
14
+ require 'soap/rpc/rpc'
15
+ require 'soap/rpc/element'
16
+ require 'soap/header/handlerset'
17
+ require 'soap/filter'
18
+ require 'soap/streamHandler'
19
+ require 'soap/mimemessage'
20
+
21
+
22
+ module SOAP
23
+ module RPC
24
+
25
+
26
+ class Proxy
27
+ include SOAP
28
+
29
+ public
30
+
31
+ attr_accessor :soapaction
32
+ attr_accessor :mandatorycharset
33
+ attr_accessor :allow_unqualified_element
34
+ attr_accessor :default_encodingstyle
35
+ attr_accessor :generate_explicit_type
36
+ attr_accessor :use_default_namespace
37
+ attr_accessor :return_response_as_xml
38
+ attr_reader :headerhandler
39
+ attr_reader :filterchain
40
+ attr_reader :streamhandler
41
+
42
+ attr_accessor :mapping_registry
43
+ attr_accessor :literal_mapping_registry
44
+
45
+ attr_reader :operation
46
+
47
+ def initialize(endpoint_url, soapaction, options)
48
+ @endpoint_url = endpoint_url
49
+ @soapaction = soapaction
50
+ @options = options
51
+ @protocol_option = options["protocol"] ||= ::SOAP::Property.new
52
+ initialize_streamhandler(@protocol_option)
53
+ @operation = {}
54
+ @operation_by_qname = {}
55
+ @operation_by_soapaction = {}
56
+ @mandatorycharset = nil
57
+ # TODO: set to false by default or drop thie option in 1.6.0
58
+ @allow_unqualified_element = true
59
+ @default_encodingstyle = nil
60
+ @generate_explicit_type = nil
61
+ @use_default_namespace = false
62
+ @return_response_as_xml = false
63
+ @headerhandler = Header::HandlerSet.new
64
+ @filterchain = Filter::FilterChain.new
65
+ @mapping_registry = nil
66
+ @literal_mapping_registry = ::SOAP::Mapping::LiteralRegistry.new
67
+ end
68
+
69
+ def inspect
70
+ "#<#{self.class}:#{@endpoint_url}>"
71
+ end
72
+
73
+ def endpoint_url
74
+ @endpoint_url
75
+ end
76
+
77
+ def endpoint_url=(endpoint_url)
78
+ @endpoint_url = endpoint_url
79
+ reset_stream
80
+ end
81
+
82
+ def reset_stream
83
+ @streamhandler.reset(@endpoint_url)
84
+ end
85
+
86
+ def set_wiredump_file_base(wiredump_file_base)
87
+ @streamhandler.wiredump_file_base = wiredump_file_base
88
+ end
89
+
90
+ def test_loopback_response
91
+ @streamhandler.test_loopback_response
92
+ end
93
+
94
+ def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
95
+ ensure_styleuse_option(opt, :rpc, :encoded)
96
+ opt[:request_qname] = qname
97
+ op = Operation.new(soapaction, param_def, opt)
98
+ assign_operation(name, qname, soapaction, op)
99
+ end
100
+
101
+ def add_document_operation(soapaction, name, param_def, opt = {})
102
+ ensure_styleuse_option(opt, :document, :literal)
103
+ op = Operation.new(soapaction, param_def, opt)
104
+ assign_operation(name, nil, soapaction, op)
105
+ end
106
+
107
+ # add_method is for shortcut of typical rpc/encoded method definition.
108
+ alias add_method add_rpc_operation
109
+ alias add_rpc_method add_rpc_operation
110
+ alias add_document_method add_document_operation
111
+
112
+ def invoke(req_header, req_body, opt = nil)
113
+ opt ||= create_encoding_opt
114
+ env = route(req_header, req_body, opt, opt)
115
+ if @return_response_as_xml
116
+ opt[:response_as_xml]
117
+ else
118
+ env
119
+ end
120
+ end
121
+
122
+ def call(name, *params)
123
+ # name must be used only for lookup
124
+ op_info = lookup_operation(name)
125
+ mapping_opt = create_mapping_opt
126
+ req_header = create_request_header
127
+ req_body = SOAPBody.new(
128
+ op_info.request_body(params, @mapping_registry,
129
+ @literal_mapping_registry, mapping_opt)
130
+ )
131
+ reqopt = create_encoding_opt(
132
+ :soapaction => op_info.soapaction || @soapaction,
133
+ :envelopenamespace => @options["soap.envelope.requestnamespace"],
134
+ :default_encodingstyle =>
135
+ @default_encodingstyle || op_info.request_default_encodingstyle,
136
+ :use_default_namespace =>
137
+ op_info.use_default_namespace || @use_default_namespace
138
+ )
139
+ resopt = create_encoding_opt(
140
+ :envelopenamespace => @options["soap.envelope.responsenamespace"],
141
+ :default_encodingstyle =>
142
+ @default_encodingstyle || op_info.response_default_encodingstyle
143
+ )
144
+ if reqopt[:generate_explicit_type].nil?
145
+ reqopt[:generate_explicit_type] = (op_info.request_use == :encoded)
146
+ end
147
+ if resopt[:generate_explicit_type].nil?
148
+ resopt[:generate_explicit_type] = (op_info.response_use == :encoded)
149
+ end
150
+ env = route(req_header, req_body, reqopt, resopt)
151
+ if op_info.response_use.nil?
152
+ return nil
153
+ end
154
+ raise EmptyResponseError unless env
155
+ receive_headers(env.header)
156
+ begin
157
+ check_fault(env.body)
158
+ rescue ::SOAP::FaultError => e
159
+ op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry)
160
+ end
161
+ if @return_response_as_xml
162
+ resopt[:response_as_xml]
163
+ else
164
+ op_info.response_obj(env.body, @mapping_registry,
165
+ @literal_mapping_registry, mapping_opt)
166
+ end
167
+ end
168
+
169
+ def route(req_header, req_body, reqopt, resopt)
170
+ req_env = ::SOAP::SOAPEnvelope.new(req_header, req_body)
171
+ unless reqopt[:envelopenamespace].nil?
172
+ set_envelopenamespace(req_env, reqopt[:envelopenamespace])
173
+ end
174
+ reqopt[:external_content] = nil
175
+ conn_data = marshal(req_env, reqopt)
176
+ if ext = reqopt[:external_content]
177
+ mime = MIMEMessage.new
178
+ ext.each do |k, v|
179
+ mime.add_attachment(v.data)
180
+ end
181
+ mime.add_part(conn_data.send_string + "\r\n")
182
+ mime.close
183
+ conn_data.send_string = mime.content_str
184
+ conn_data.send_contenttype = mime.headers['content-type'].str
185
+ end
186
+ conn_data.soapaction = reqopt[:soapaction]
187
+ conn_data = @streamhandler.send(@endpoint_url, conn_data)
188
+ if conn_data.receive_string.empty?
189
+ return nil
190
+ end
191
+ unmarshal(conn_data, resopt)
192
+ end
193
+
194
+ def check_fault(body)
195
+ if body.fault
196
+ raise SOAP::FaultError.new(body.fault)
197
+ end
198
+ end
199
+
200
+ private
201
+
202
+ def ensure_styleuse_option(opt, style, use)
203
+ if opt[:request_style] || opt[:response_style] || opt[:request_use] || opt[:response_use]
204
+ # do not edit
205
+ else
206
+ opt[:request_style] ||= style
207
+ opt[:response_style] ||= style
208
+ opt[:request_use] ||= use
209
+ opt[:response_use] ||= use
210
+ end
211
+ end
212
+
213
+ def initialize_streamhandler(options)
214
+ value = options["streamhandler"]
215
+ if value and !value.empty?
216
+ factory = Property::Util.const_from_name(value)
217
+ else
218
+ factory = HTTPStreamHandler
219
+ end
220
+ @streamhandler = factory.create(options)
221
+ options.add_hook("streamhandler") do |key, value|
222
+ @streamhandler.reset
223
+ if value.respond_to?(:create)
224
+ factory = value
225
+ elsif value and !value.to_str.empty?
226
+ factory = Property::Util.const_from_name(value.to_str)
227
+ else
228
+ factory = HTTPStreamHandler
229
+ end
230
+ options.unlock(true)
231
+ @streamhandler = factory.create(options)
232
+ end
233
+ end
234
+
235
+ def set_envelopenamespace(env, namespace)
236
+ env.elename = XSD::QName.new(namespace, env.elename.name)
237
+ if env.header
238
+ env.header.elename = XSD::QName.new(namespace, env.header.elename.name)
239
+ end
240
+ if env.body
241
+ env.body.elename = XSD::QName.new(namespace, env.body.elename.name)
242
+ end
243
+ end
244
+
245
+ def create_request_header
246
+ header = ::SOAP::SOAPHeader.new
247
+ items = @headerhandler.on_outbound(header)
248
+ items.each do |item|
249
+ header.add(item.elename.name, item)
250
+ end
251
+ header
252
+ end
253
+
254
+ def receive_headers(header)
255
+ @headerhandler.on_inbound(header) if header
256
+ end
257
+
258
+ def marshal(env, opt)
259
+ @filterchain.each do |filter|
260
+ env = filter.on_outbound(env, opt)
261
+ break unless env
262
+ end
263
+ send_string = Processor.marshal(env, opt)
264
+ StreamHandler::ConnectionData.new(send_string)
265
+ end
266
+
267
+ def unmarshal(conn_data, opt)
268
+ contenttype = conn_data.receive_contenttype
269
+ xml = nil
270
+ if /#{MIMEMessage::MultipartContentType}/i =~ contenttype
271
+ opt[:external_content] = {}
272
+ mime = MIMEMessage.parse("Content-Type: " + contenttype,
273
+ conn_data.receive_string)
274
+ mime.parts.each do |part|
275
+ value = Attachment.new(part.content)
276
+ value.contentid = part.contentid
277
+ obj = SOAPAttachment.new(value)
278
+ opt[:external_content][value.contentid] = obj if value.contentid
279
+ end
280
+ opt[:charset] = @mandatorycharset ||
281
+ StreamHandler.parse_media_type(mime.root.headers['content-type'].str)
282
+ xml = mime.root.content
283
+ else
284
+ opt[:charset] = @mandatorycharset ||
285
+ ::SOAP::StreamHandler.parse_media_type(contenttype)
286
+ xml = conn_data.receive_string
287
+ end
288
+ @filterchain.reverse_each do |filter|
289
+ xml = filter.on_inbound(xml, opt)
290
+ break unless xml
291
+ end
292
+ env = Processor.unmarshal(xml, opt)
293
+ if @return_response_as_xml
294
+ opt[:response_as_xml] = xml
295
+ end
296
+ unless env.is_a?(::SOAP::SOAPEnvelope)
297
+ raise ResponseFormatError.new("response is not a SOAP envelope: #{env}")
298
+ end
299
+ env
300
+ end
301
+
302
+ def create_encoding_opt(hash = nil)
303
+ opt = {}
304
+ opt[:default_encodingstyle] = @default_encodingstyle
305
+ opt[:allow_unqualified_element] = @allow_unqualified_element
306
+ opt[:generate_explicit_type] = @generate_explicit_type
307
+ opt[:no_indent] = @options["soap.envelope.no_indent"]
308
+ opt[:use_numeric_character_reference] =
309
+ @options["soap.envelope.use_numeric_character_reference"]
310
+ opt.update(hash) if hash
311
+ opt
312
+ end
313
+
314
+ def create_mapping_opt(hash = nil)
315
+ opt = {
316
+ :external_ces => @options["soap.mapping.external_ces"]
317
+ }
318
+ opt.update(hash) if hash
319
+ opt
320
+ end
321
+
322
+ def assign_operation(name, qname, soapaction, op)
323
+ assigned = false
324
+ if name and !name.empty?
325
+ @operation[name] = op
326
+ assigned = true
327
+ end
328
+ if qname
329
+ @operation_by_qname[qname] = op
330
+ assigned = true
331
+ end
332
+ if soapaction and !soapaction.empty?
333
+ @operation_by_soapaction[soapaction] = op
334
+ assigned = true
335
+ end
336
+ unless assigned
337
+ raise MethodDefinitionError.new("cannot assign operation")
338
+ end
339
+ end
340
+
341
+ def lookup_operation(name_or_qname_or_soapaction)
342
+ if op = @operation[name_or_qname_or_soapaction]
343
+ return op
344
+ end
345
+ if op = @operation_by_qname[name_or_qname_or_soapaction]
346
+ return op
347
+ end
348
+ if op = @operation_by_soapaction[name_or_qname_or_soapaction]
349
+ return op
350
+ end
351
+ raise MethodDefinitionError.new(
352
+ "operation: #{name_or_qname_or_soapaction} not supported")
353
+ end
354
+
355
+ class Operation
356
+ attr_reader :soapaction
357
+ attr_reader :request_style
358
+ attr_reader :response_style
359
+ attr_reader :request_use
360
+ attr_reader :response_use
361
+ attr_reader :use_default_namespace
362
+
363
+ def initialize(soapaction, param_def, opt)
364
+ @soapaction = soapaction
365
+ @request_style = opt[:request_style]
366
+ @response_style = opt[:response_style]
367
+ @request_use = opt[:request_use]
368
+ @response_use = opt[:response_use]
369
+ @use_default_namespace =
370
+ opt[:use_default_namespace] || opt[:elementformdefault]
371
+ if opt.key?(:elementformdefault)
372
+ warn("option :elementformdefault is deprecated. use :use_default_namespace instead")
373
+ end
374
+ check_style(@request_style)
375
+ check_style(@response_style)
376
+ check_use(@request_use)
377
+ check_use(@response_use)
378
+ if @request_style == :rpc
379
+ @rpc_request_qname = opt[:request_qname]
380
+ if @rpc_request_qname.nil?
381
+ raise MethodDefinitionError.new("rpc_request_qname must be given")
382
+ end
383
+ @rpc_method_factory =
384
+ RPC::SOAPMethodRequest.new(@rpc_request_qname, param_def, @soapaction)
385
+ else
386
+ @doc_request_qnames = []
387
+ @doc_response_qnames = []
388
+ param_def.each do |param|
389
+ param = MethodDef.to_param(param)
390
+ case param.io_type
391
+ when SOAPMethod::IN
392
+ @doc_request_qnames << param.qname
393
+ when SOAPMethod::OUT
394
+ @doc_response_qnames << param.qname
395
+ else
396
+ raise MethodDefinitionError.new(
397
+ "illegal inout definition for document style: #{param.io_type}")
398
+ end
399
+ end
400
+ end
401
+ end
402
+
403
+ def request_default_encodingstyle
404
+ (@request_use == :encoded) ? EncodingNamespace : LiteralNamespace
405
+ end
406
+
407
+ def response_default_encodingstyle
408
+ (@response_use == :encoded) ? EncodingNamespace : LiteralNamespace
409
+ end
410
+
411
+ def request_body(values, mapping_registry, literal_mapping_registry, opt)
412
+ if @request_style == :rpc
413
+ request_rpc(values, mapping_registry, literal_mapping_registry, opt)
414
+ else
415
+ request_doc(values, mapping_registry, literal_mapping_registry, opt)
416
+ end
417
+ end
418
+
419
+ def response_obj(body, mapping_registry, literal_mapping_registry, opt)
420
+ if @response_style == :rpc
421
+ response_rpc(body, mapping_registry, literal_mapping_registry, opt)
422
+ else
423
+ unique_result_for_one_element_array(
424
+ response_doc(body, mapping_registry, literal_mapping_registry, opt))
425
+ end
426
+ end
427
+
428
+ def raise_fault(e, mapping_registry, literal_mapping_registry)
429
+ if @response_style == :rpc
430
+ Mapping.fault2exception(e, mapping_registry)
431
+ else
432
+ Mapping.fault2exception(e, literal_mapping_registry)
433
+ end
434
+ end
435
+
436
+ private
437
+
438
+ # nil for [] / 1 for [1] / [1, 2] for [1, 2]
439
+ def unique_result_for_one_element_array(ary)
440
+ ary.size <= 1 ? ary[0] : ary
441
+ end
442
+
443
+ def check_style(style)
444
+ unless [:rpc, :document].include?(style)
445
+ raise MethodDefinitionError.new("unknown style: #{style}")
446
+ end
447
+ end
448
+
449
+ # nil means oneway
450
+ def check_use(use)
451
+ unless [:encoded, :literal, nil].include?(use)
452
+ raise MethodDefinitionError.new("unknown use: #{use}")
453
+ end
454
+ end
455
+
456
+ def request_rpc(values, mapping_registry, literal_mapping_registry, opt)
457
+ if @request_use == :encoded
458
+ request_rpc_enc(values, mapping_registry, opt)
459
+ else
460
+ request_rpc_lit(values, literal_mapping_registry, opt)
461
+ end
462
+ end
463
+
464
+ def request_doc(values, mapping_registry, literal_mapping_registry, opt)
465
+ if @request_use == :encoded
466
+ request_doc_enc(values, mapping_registry, opt)
467
+ else
468
+ request_doc_lit(values, literal_mapping_registry, opt)
469
+ end
470
+ end
471
+
472
+ def request_rpc_enc(values, mapping_registry, opt)
473
+ method = @rpc_method_factory.dup
474
+ names = method.input_params
475
+ types = method.input_param_types
476
+ ary = Mapping.objs2soap(values, mapping_registry, types, opt)
477
+ soap = {}
478
+ 0.upto(ary.length - 1) do |idx|
479
+ soap[names[idx]] = ary[idx]
480
+ end
481
+ method.set_param(soap)
482
+ method
483
+ end
484
+
485
+ def request_rpc_lit(values, mapping_registry, opt)
486
+ method = @rpc_method_factory.dup
487
+ names = method.input_params
488
+ types = method.get_paramtypes(names)
489
+ params = {}
490
+ idx = 0
491
+ names.each do |name|
492
+ params[name] = Mapping.obj2soap(values[idx], mapping_registry,
493
+ types[idx], opt)
494
+ params[name].elename = XSD::QName.new(nil, name)
495
+ idx += 1
496
+ end
497
+ method.set_param(params)
498
+ method
499
+ end
500
+
501
+ def request_doc_enc(values, mapping_registry, opt)
502
+ (0...values.size).collect { |idx|
503
+ ele = Mapping.obj2soap(values[idx], mapping_registry, nil, opt)
504
+ ele.elename = @doc_request_qnames[idx]
505
+ ele
506
+ }
507
+ end
508
+
509
+ def request_doc_lit(values, mapping_registry, opt)
510
+ (0...values.size).collect { |idx|
511
+ ele = Mapping.obj2soap(values[idx], mapping_registry,
512
+ @doc_request_qnames[idx], opt)
513
+ ele.encodingstyle = LiteralNamespace
514
+ ele
515
+ }
516
+ end
517
+
518
+ def response_rpc(body, mapping_registry, literal_mapping_registry, opt)
519
+ if @response_use == :encoded
520
+ response_rpc_enc(body, mapping_registry, opt)
521
+ else
522
+ response_rpc_lit(body, literal_mapping_registry, opt)
523
+ end
524
+ end
525
+
526
+ def response_doc(body, mapping_registry, literal_mapping_registry, opt)
527
+ if @response_use == :encoded
528
+ response_doc_enc(body, mapping_registry, opt)
529
+ else
530
+ response_doc_lit(body, literal_mapping_registry, opt)
531
+ end
532
+ end
533
+
534
+ def response_rpc_enc(body, mapping_registry, opt)
535
+ ret = nil
536
+ if body.response
537
+ ret = Mapping.soap2obj(body.response, mapping_registry,
538
+ @rpc_method_factory.retval_class_name, opt)
539
+ end
540
+ if body.outparams
541
+ outparams = body.outparams.collect { |outparam|
542
+ Mapping.soap2obj(outparam, mapping_registry, nil, opt)
543
+ }
544
+ [ret].concat(outparams)
545
+ else
546
+ ret
547
+ end
548
+ end
549
+
550
+ def response_rpc_lit(body, mapping_registry, opt)
551
+ body.root_node.collect { |key, value|
552
+ Mapping.soap2obj(value, mapping_registry,
553
+ @rpc_method_factory.retval_class_name, opt)
554
+ }
555
+ end
556
+
557
+ def response_doc_enc(body, mapping_registry, opt)
558
+ body.collect { |key, value|
559
+ Mapping.soap2obj(value, mapping_registry, nil, opt)
560
+ }
561
+ end
562
+
563
+ def response_doc_lit(body, mapping_registry, opt)
564
+ body.collect { |key, value|
565
+ Mapping.soap2obj(value, mapping_registry)
566
+ }
567
+ end
568
+ end
569
+ end
570
+
571
+
572
+ end
573
+ end