File: client.rb

package info (click to toggle)
ruby-soap4r 2.0.5-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,032 kB
  • sloc: ruby: 52,729; xml: 266; sh: 42; javascript: 20; makefile: 13; perl: 10
file content (57 lines) | stat: -rw-r--r-- 1,619 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'soap/rpc/driver'
require 'soap/attachment'
require 'EdmService'

# test script for the EDD service in ruby, to see if we can send and
# receive attachments.

# set up the server parameters
server = 'http://localhost:7000/'
driver = SOAP::RPC::Driver.new(server, 'urn:EDD:Edm')

# debugging?
driver.wiredump_dev = STDERR

# add methods
driver.add_method('MapInfo', 'mapArea', 'mapTime', 'mapOptions', 'driftPrediction')
driver.add_method('LocationInfo', 'bottomLeft', 'topRight', 'startTime', 'endTime')

# LocationInfo
bottomLeft = Coordinates.new
bottomLeft.wgs84Latitude = 0.12
bottomLeft.wgs84Longitude = 3.45

topRight = Coordinates.new
topRight.wgs84Latitude = 1.23
topRight.wgs84Longitude = 4.56

startTime = '2006-07-13T14:39:25.459Z'
endTime   = '2006-07-13T14:55:25.459Z'

result = driver.LocationInfo(bottomLeft, topRight, startTime, endTime)
puts("LocationInfo result: #{result}")

# MapInfo
mapArea = MapArea.new
mapArea.bottomLeft = Coordinates.new
mapArea.topRight = Coordinates.new
mapArea.bottomLeft.wgs84Latitude = 2.34
mapArea.bottomLeft.wgs84Longitude = 5.67
mapArea.topRight.wgs84Latitude = 3.45
mapArea.topRight.wgs84Longitude = 6.78
mapArea.width = 4.56
mapArea.height = 7.89

mapTime = SOAP::SOAPDateTime.new('2006-07-13T14:39:25.459Z')

mapOptions = MapOptions.new
mapOptions.showCurrentData = true
mapOptions.showWaveData = false
mapOptions.showWindData = true

driftPrediction = SOAP::Attachment.new(File.open('drift.cdf'))
driftPrediction.contenttype = "application/x-netcdf"

result = driver.MapInfo(mapArea, mapTime, mapOptions, driftPrediction)
puts("MapInfo result: #{result}")