Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/branches/1_5/sample/soapheader/soapext_basicauth/mms_MizGISDriver.rb

Revision 1843, 9.1 kB (checked in by nahi, 2 years ago)
  • reorganize sampless
Line 
1 require 'mms_MizGIS.rb'
2 require 'mms_MizGISMappingRegistry.rb'
3 require 'soap/rpc/driver'
4
5 class Mms_MizGISPortType < ::SOAP::RPC::Driver
6   DefaultEndpointUrl = "http://www.verona.miz.it/mizgis-api/3.4/server"
7
8   Methods = [
9     [ XSD::QName.new("urn:mms_MizGIS", "getVersion"),
10       "",
11       "getVersion",
12       [ ["retval", "name", ["::SOAP::SOAPString"]],
13         ["out", "version", ["::SOAP::SOAPString"]],
14         ["out", "date", ["::SOAP::SOAPString"]],
15         ["out", "cartographyVersion", ["::SOAP::SOAPString"]],
16         ["out", "poiCartographyVersion", ["::SOAP::SOAPString"]] ],
17       { :request_style =>  :rpc, :request_use =>  :encoded,
18         :response_style => :rpc, :response_use => :encoded,
19         :faults => {} }
20     ],
21     [ XSD::QName.new("urn:mms_MizGIS", "getAvailableCountries"),
22       "",
23       "getAvailableCountries",
24       [ ["retval", "countries", ["C_String[]", "urn:mms_MizGIS", "ArrayOfstring"]] ],
25       { :request_style =>  :rpc, :request_use =>  :encoded,
26         :response_style => :rpc, :response_use => :encoded,
27         :faults => {} }
28     ],
29     [ XSD::QName.new("urn:mms_MizGIS", "findAddress"),
30       "",
31       "findAddress",
32       [ ["in", "addressSearch", ["AddressSearchType", "urn:mms_MizGIS", "AddressSearchType"]],
33         ["in", "maxResults", ["::SOAP::SOAPInt"]],
34         ["in", "onlyMunicipalities", ["::SOAP::SOAPBoolean"]],
35         ["retval", "addresses", ["AddressType[]", "urn:mms_MizGIS", "ArrayOfAddressType"]] ],
36       { :request_style =>  :rpc, :request_use =>  :encoded,
37         :response_style => :rpc, :response_use => :encoded,
38         :faults => {} }
39     ],
40     [ XSD::QName.new("urn:mms_MizGIS", "getAddressFromGeocode"),
41       "",
42       "getAddressFromGeocode",
43       [ ["in", "geocode", ["GeocodeType", "urn:mms_MizGIS", "GeocodeType"]],
44         ["in", "languageCode", ["::SOAP::SOAPString"]],
45         ["retval", "address", ["AddressType", "urn:mms_MizGIS", "AddressType"]] ],
46       { :request_style =>  :rpc, :request_use =>  :encoded,
47         :response_style => :rpc, :response_use => :encoded,
48         :faults => {} }
49     ],
50     [ XSD::QName.new("urn:mms_MizGIS", "findGeocodeFromCoordinates"),
51       "",
52       "findGeocodeFromCoordinates",
53       [ ["in", "coordinates", ["CoordinatesType", "urn:mms_MizGIS", "CoordinatesType"]],
54         ["in", "vehicle", ["::SOAP::SOAPInt"]],
55         ["retval", "found", ["::SOAP::SOAPBoolean"]],
56         ["out", "geocode", ["GeocodeType", "urn:mms_MizGIS", "GeocodeType"]],
57         ["out", "distance", ["::SOAP::SOAPDouble"]] ],
58       { :request_style =>  :rpc, :request_use =>  :encoded,
59         :response_style => :rpc, :response_use => :encoded,
60         :faults => {} }
61     ],
62     [ XSD::QName.new("urn:mms_MizGIS", "findAddressFromCoordinates"),
63       "",
64       "findAddressFromCoordinates",
65       [ ["in", "coordinates", ["CoordinatesType", "urn:mms_MizGIS", "CoordinatesType"]],
66         ["in", "vehicle", ["::SOAP::SOAPInt"]],
67         ["in", "languageCode", ["::SOAP::SOAPString"]],
68         ["retval", "found", ["::SOAP::SOAPBoolean"]],
69         ["out", "address", ["AddressType", "urn:mms_MizGIS", "AddressType"]],
70         ["out", "distance", ["::SOAP::SOAPDouble"]] ],
71       { :request_style =>  :rpc, :request_use =>  :encoded,
72         :response_style => :rpc, :response_use => :encoded,
73         :faults => {} }
74     ],
75     [ XSD::QName.new("urn:mms_MizGIS", "getListOfPoiMacrocategories"),
76       "",
77       "getListOfPoiMacrocategories",
78       [ ["in", "languageCode", ["::SOAP::SOAPString"]],
79         ["retval", "macrocategories", ["PoiMacrocategoryType[]", "urn:mms_MizGIS", "ArrayOfPoiMacrocategoryType"]] ],
80       { :request_style =>  :rpc, :request_use =>  :encoded,
81         :response_style => :rpc, :response_use => :encoded,
82         :faults => {} }
83     ],
84     [ XSD::QName.new("urn:mms_MizGIS", "getListOfPoiCategories"),
85       "",
86       "getListOfPoiCategories",
87       [ ["in", "languageCode", ["::SOAP::SOAPString"]],
88         ["in", "onlyPopulated", ["::SOAP::SOAPBoolean"]],
89         ["retval", "categories", ["PoiCategoryType[]", "urn:mms_MizGIS", "ArrayOfPoiCategoryType"]] ],
90       { :request_style =>  :rpc, :request_use =>  :encoded,
91         :response_style => :rpc, :response_use => :encoded,
92         :faults => {} }
93     ],
94     [ XSD::QName.new("urn:mms_MizGIS", "findPois"),
95       "",
96       "findPois",
97       [ ["in", "area", ["AreaType", "urn:mms_MizGIS", "AreaType"]],
98         ["in", "box", ["BoxType", "urn:mms_MizGIS", "BoxType"]],
99         ["in", "maxResults", ["::SOAP::SOAPInt"]],
100         ["in", "macroCategoryIds", ["C_String[]", "urn:mms_MizGIS", "ArrayOfstring"]],
101         ["in", "categoryIds", ["C_String[]", "urn:mms_MizGIS", "ArrayOfstring"]],
102         ["in", "provideInfo", ["::SOAP::SOAPBoolean"]],
103         ["retval", "pois", ["PoiType[]", "urn:mms_MizGIS", "ArrayOfPoiType"]] ],
104       { :request_style =>  :rpc, :request_use =>  :encoded,
105         :response_style => :rpc, :response_use => :encoded,
106         :faults => {} }
107     ],
108     [ XSD::QName.new("urn:mms_MizGIS", "getPoiInfo"),
109       "",
110       "getPoiInfo",
111       [ ["in", "poiIds", ["Int[]", "urn:mms_MizGIS", "ArrayOfint"]],
112         ["in", "provideInfo", ["::SOAP::SOAPBoolean"]],
113         ["retval", "pois", ["PoiType[]", "urn:mms_MizGIS", "ArrayOfPoiType"]] ],
114       { :request_style =>  :rpc, :request_use =>  :encoded,
115         :response_style => :rpc, :response_use => :encoded,
116         :faults => {} }
117     ],
118     [ XSD::QName.new("urn:mms_MizGIS", "getListOfRoads"),
119       "",
120       "getListOfRoads",
121       [ ["in", "roadQueries", ["TmcRoadQueryType[]", "urn:mms_MizGIS", "ArrayOfTmcRoadQueryType"]],
122         ["in", "roadOptions", ["TmcRoadOptionsType", "urn:mms_MizGIS", "TmcRoadOptionsType"]],
123         ["retval", "roads", ["TmcRoadType[]", "urn:mms_MizGIS", "ArrayOfTmcRoadType"]] ],
124       { :request_style =>  :rpc, :request_use =>  :encoded,
125         :response_style => :rpc, :response_use => :encoded,
126         :faults => {} }
127     ],
128     [ XSD::QName.new("urn:mms_MizGIS", "getTrafficInfo"),
129       "",
130       "getTrafficInfo",
131       [ ["in", "trafficQuery", ["TmcTrafficQueryType", "urn:mms_MizGIS", "TmcTrafficQueryType"]],
132         ["in", "trafficOptions", ["TmcTrafficOptionsType", "urn:mms_MizGIS", "TmcTrafficOptionsType"]],
133         ["retval", "info", ["TrafficInfoType[]", "urn:mms_MizGIS", "ArrayOfTrafficInfoType"]] ],
134       { :request_style =>  :rpc, :request_use =>  :encoded,
135         :response_style => :rpc, :response_use => :encoded,
136         :faults => {} }
137     ],
138     [ XSD::QName.new("urn:mms_MizGIS", "getTrafficStatus"),
139       "",
140       "getTrafficStatus",
141       [ ["in", "areas", ["AreaType[]", "urn:mms_MizGIS", "ArrayOfAreaType"]],
142         ["retval", "status", ["Int[]", "urn:mms_MizGIS", "ArrayOfint"]] ],
143       { :request_style =>  :rpc, :request_use =>  :encoded,
144         :response_style => :rpc, :response_use => :encoded,
145         :faults => {} }
146     ],
147     [ XSD::QName.new("urn:mms_MizGIS", "findRoute"),
148       "",
149       "findRoute",
150       [ ["in", "places", ["GeocodeType[]", "urn:mms_MizGIS", "ArrayOfGeocodeType"]],
151         ["in", "params", ["RouteParametersType", "urn:mms_MizGIS", "RouteParametersType"]],
152         ["retval", "route", ["RouteType", "urn:mms_MizGIS", "RouteType"]] ],
153       { :request_style =>  :rpc, :request_use =>  :encoded,
154         :response_style => :rpc, :response_use => :encoded,
155         :faults => {} }
156     ],
157     [ XSD::QName.new("urn:mms_MizGIS", "getMap"),
158       "",
159       "getMap",
160       [ ["in", "imageSize", ["ImageSizeType", "urn:mms_MizGIS", "ImageSizeType"]],
161         ["in", "box", ["BoxType", "urn:mms_MizGIS", "BoxType"]],
162         ["in", "options", ["MapOptionsType", "urn:mms_MizGIS", "MapOptionsType"]],
163         ["retval", "map", ["MapType", "urn:mms_MizGIS", "MapType"]] ],
164       { :request_style =>  :rpc, :request_use =>  :encoded,
165         :response_style => :rpc, :response_use => :encoded,
166         :faults => {} }
167     ],
168     [ XSD::QName.new("urn:mms_MizGIS", "getMapAround"),
169       "",
170       "getMapAround",
171       [ ["in", "imageSize", ["ImageSizeType", "urn:mms_MizGIS", "ImageSizeType"]],
172         ["in", "center", ["CoordinatesType", "urn:mms_MizGIS", "CoordinatesType"]],
173         ["in", "radius", ["::SOAP::SOAPDouble"]],
174         ["in", "options", ["MapOptionsType", "urn:mms_MizGIS", "MapOptionsType"]],
175         ["retval", "map", ["MapType", "urn:mms_MizGIS", "MapType"]] ],
176       { :request_style =>  :rpc, :request_use =>  :encoded,
177         :response_style => :rpc, :response_use => :encoded,
178         :faults => {} }
179     ]
180   ]
181
182   def initialize(endpoint_url = nil)
183     endpoint_url ||= DefaultEndpointUrl
184     super(endpoint_url, nil)
185     self.mapping_registry = Mms_MizGISMappingRegistry::EncodedRegistry
186     self.literal_mapping_registry = Mms_MizGISMappingRegistry::LiteralRegistry
187     init_methods
188   end
189
190 private
191
192   def init_methods
193     Methods.each do |definitions|
194       opt = definitions.last
195       if opt[:request_style] == :document
196         add_document_operation(*definitions)
197       else
198         add_rpc_operation(*definitions)
199         qname = definitions[0]
200         name = definitions[2]
201         if qname.name != name and qname.name.capitalize == name.capitalize
202           ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
203             __send__(name, *arg)
204           end
205         end
206       end
207     end
208   end
209 end
210
Note: See TracBrowser for help on using the browser.