simplews 1.0.0 → 1.0.1

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.
data/History.txt CHANGED
@@ -1,4 +1,10 @@
1
- == 0.0.1 2008-10-10
1
+ == 1.0.1 2008-10-27
2
+
3
+ * 1 major enhancement:
4
+ * Easy creation of client driver. Connects to a url and retrieves the WSDL
5
+ and uses it to generate driver
6
+
7
+ == 1.0.0 2008-10-10
2
8
 
3
9
  * 1 major enhancement:
4
10
  * Initial release
@@ -2,7 +2,7 @@ module Simplews
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  self
data/lib/simplews.rb CHANGED
@@ -4,6 +4,25 @@ require 'builder'
4
4
 
5
5
  class SimpleWS < SOAP::RPC::StandaloneServer
6
6
 
7
+ def self.get_wsdl(url, name)
8
+ require 'soap/rpc/driver'
9
+ driver = SOAP::RPC::Driver.new(url, "urn:#{ name }")
10
+ driver.add_method('wsdl')
11
+ driver.wsdl
12
+ end
13
+
14
+ def self.get_driver(url, name)
15
+ require 'soap/wsdlDriver'
16
+ require 'fileutils'
17
+
18
+ tmp = File.open("/tmp/simpleWS.wsdl",'w')
19
+ tmp.write SimpleWS::get_wsdl(url, name)
20
+ tmp.close
21
+ driver = SOAP::WSDLDriverFactory.new( "TestWS.wsdl" ).create_rpc_driver
22
+ FileUtils.rm "/tmp/simpleWS.wsdl"
23
+
24
+ driver
25
+ end
7
26
 
8
27
  def initialize(name="WS", description="", host="localhost", port="1984", *args)
9
28
  super(description, "urn:#{ name }", host, port, *args)
@@ -14,6 +33,8 @@ class SimpleWS < SOAP::RPC::StandaloneServer
14
33
  @messages = []
15
34
  @operations = []
16
35
  @bindings = []
36
+
37
+ serve :wsdl, %w(), :return => :string
17
38
  end
18
39
 
19
40
  def serve(name, args=[], types={}, &block)
@@ -35,6 +35,11 @@ class TestSimpleWS < Test::Unit::TestCase
35
35
  assert(driver.hi('Gladis') == "Hi Gladis, how are you?")
36
36
  assert(driver.bye('Gladis') == "Bye bye Gladis. See you soon.")
37
37
 
38
+
39
+ driver = SimpleWS::get_driver('http://localhost:1984', "TestWS")
40
+ assert(driver.hi('Gladis') == "Hi Gladis, how are you?")
41
+ assert(driver.bye('Gladis') == "Bye bye Gladis. See you soon.")
42
+
38
43
 
39
44
 
40
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplews
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-10 00:00:00 +02:00
12
+ date: 2008-10-27 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency