troelskn-handsoap 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -78,13 +78,14 @@ Recommendations
78
78
 
79
79
  ###Workflow
80
80
 
81
- 1. Find the wsdl for the service you want to consume.
81
+ 1. You need a WSDL for the service you want to consume.
82
82
 
83
83
  2. Figure out the url for the endpoint, as well as the protocol version. Put this in a config file.
84
84
  * To find the endpoint, look inside the wsdl, for `<soap:address location="..">`
85
85
 
86
86
  3. Create a service class. Add endpoints and protocol. Alias needed namespace(s).
87
87
  * To find the namespace(s), look in the samples from soapUI. It will be imported as `v1`
88
+ * Note that you can now use the provided generator to skip this step.
88
89
 
89
90
  4. Open the wsdl in [soapUI](http://www.soapui.org/).
90
91
 
@@ -119,6 +120,12 @@ If you use Rails, you will need to load the gem from the `config/environment.rb`
119
120
 
120
121
  config.gem 'troelskn-handsoap', :lib => 'handsoap', :source => "http://gems.github.com"
121
122
 
123
+ ###Generator
124
+
125
+ From version 0.2.0 Handsoap sports a generator, that creates the service class + an integration test case. This is just a rough starting point for your service - You still have to fill out the actual mappings to/from xml, but at least it saves your some copy-pasting from this guide.
126
+
127
+ To use the generator, create a Rails project and run the script `script/generate handsoap`, giving the url of the WSDL.
128
+
122
129
  ###Service class
123
130
 
124
131
  Put your service in a file under `app/models`. You should extend `Handsoap::Service`.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 6
2
+ :patch: 7
3
3
  :major: 0
4
4
  :minor: 2
@@ -39,8 +39,15 @@ class HandsoapGenerator < Rails::Generator::Base
39
39
  end
40
40
  # TODO
41
41
  # Ask user about which endpoints to use ?
42
- # puts "Detected endpoints:"
43
- # puts Handsoap::Compiler.compile_endpoints(wsdl, protocol)
42
+ m.message do |out|
43
+ out.puts "----"
44
+ out.puts "Endpoints in WSDL"
45
+ out.puts " You should copy these to the appropriate environment files."
46
+ out.puts " (Eg. `config/environments/*.rb`)"
47
+ out.puts "----"
48
+ out.puts Handsoap::Compiler.compile_endpoints(wsdl, protocol)
49
+ out.puts "----"
50
+ end
44
51
  end
45
52
  end
46
53
 
@@ -68,6 +75,10 @@ module Handsoap #:nodoc:
68
75
  end
69
76
  end
70
77
 
78
+ def message(&block)
79
+ yield $stdout
80
+ end
81
+
71
82
  private
72
83
 
73
84
  # Convert the given absolute path into a path
@@ -78,6 +78,12 @@ module Handsoap
78
78
  end
79
79
  end
80
80
 
81
+ class RawContent < TextNode
82
+ def to_s(indentation = '')
83
+ @text
84
+ end
85
+ end
86
+
81
87
  class Element < Node
82
88
  def initialize(parent, prefix, node_name, value = nil)
83
89
  super()
@@ -109,11 +115,15 @@ module Handsoap
109
115
  @children << node
110
116
  return node
111
117
  end
112
- def set_value(value)
118
+ def set_value(value, *flags)
113
119
  if @children.length > 0
114
120
  raise "Element already has children. Can't set value"
115
121
  end
116
- @children = [TextNode.new(value)]
122
+ if flags && flags.include?(:raw)
123
+ @children = [RawContent.new(value)]
124
+ else
125
+ @children = [TextNode.new(value)]
126
+ end
117
127
  end
118
128
  def set_attr(name, value)
119
129
  full_name = parse_ns(name).join(":")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: troelskn-handsoap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Troels Knak-Nielsen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-10 00:00:00 -07:00
12
+ date: 2009-06-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency