smacks-savon 0.0.5 → 0.0.7
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/README.rdoc +5 -2
- data/lib/savon/wsdl.rb +27 -12
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -13,7 +13,10 @@ service method to receive.
|
|
13
13
|
|
14
14
|
== Dependencies
|
15
15
|
|
16
|
-
|
16
|
+
hpricot 0.6.164 (also available for JRuby)
|
17
|
+
smacks-apricoteatsgorilla >= 0.3.31
|
18
|
+
|
19
|
+
== How to use
|
17
20
|
|
18
21
|
=== Usage example
|
19
22
|
|
@@ -23,7 +26,7 @@ service method to receive.
|
|
23
26
|
=== Check for available SOAP service methods
|
24
27
|
|
25
28
|
proxy.wsdl.service_methods
|
26
|
-
=> [ "findExampleById", "findExampleByName" ]
|
29
|
+
# => [ "findExampleById", "findExampleByName" ]
|
27
30
|
|
28
31
|
=== Checking for HTTP and SOAP faults
|
29
32
|
|
data/lib/savon/wsdl.rb
CHANGED
@@ -27,7 +27,10 @@ module Savon
|
|
27
27
|
@uri = uri
|
28
28
|
@http = http
|
29
29
|
get_wsdl
|
30
|
-
|
30
|
+
|
31
|
+
parse_namespace_uri
|
32
|
+
parse_service_methods
|
33
|
+
parse_choice_elements
|
31
34
|
end
|
32
35
|
|
33
36
|
# Returns the response body from the WSDL request.
|
@@ -43,20 +46,32 @@ module Savon
|
|
43
46
|
@doc = Hpricot.XML(@response.body)
|
44
47
|
end
|
45
48
|
|
46
|
-
# Parses the WSDL
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
# Parses the WSDL to find and store the namespace URI.
|
50
|
+
def parse_namespace_uri
|
51
|
+
node = @doc.at("//wsdl:definitions")
|
52
|
+
if node
|
53
|
+
@namespace_uri = node.get_attribute("targetNamespace")
|
54
|
+
end
|
55
|
+
end
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
|
57
|
+
# Parses the WSDL to find and store the available SOAP service methods.
|
58
|
+
def parse_service_methods
|
59
|
+
@service_methods, node = [], @doc.search("//soap:operation")
|
60
|
+
if node
|
61
|
+
node.each do |operation|
|
62
|
+
service_methods << operation.parent.get_attribute("name")
|
63
|
+
end
|
54
64
|
end
|
65
|
+
end
|
55
66
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
67
|
+
# Parses the WSDL to find and store any choice elements.
|
68
|
+
def parse_choice_elements
|
69
|
+
@choice_elements, node = [], @doc.search("//xs:choice//xs:element")
|
70
|
+
if node
|
71
|
+
node.each do |choice|
|
72
|
+
name = choice.get_attribute("ref").sub(/(.+):/, "")
|
73
|
+
choice_elements << name unless @choice_elements.include? name
|
74
|
+
end
|
60
75
|
end
|
61
76
|
end
|
62
77
|
|