savon 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,115 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <definitions name="Api" xmlns:typens="urn:ActionWebService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="urn:ActionWebService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/">
3
- <types>
4
- <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ActionWebService">
5
- <xsd:complexType name="MpUser">
6
- <xsd:all>
7
- <xsd:element name="avatar_thumb_url" type="xsd:string"/>
8
- <xsd:element name="speciality" type="xsd:string"/>
9
- <xsd:element name="avatar_icon_url" type="xsd:string"/>
10
- <xsd:element name="firstname" type="xsd:string"/>
11
- <xsd:element name="city" type="xsd:string"/>
12
- <xsd:element name="mp_id" type="xsd:int"/>
13
- <xsd:element name="lastname" type="xsd:string"/>
14
- <xsd:element name="login" type="xsd:string"/>
15
- </xsd:all>
16
- </xsd:complexType>
17
- <xsd:complexType name="MpUserArray">
18
- <xsd:complexContent>
19
- <xsd:restriction base="soapenc:Array">
20
- <xsd:attribute wsdl:arrayType="typens:MpUser[]" ref="soapenc:arrayType"/>
21
- </xsd:restriction>
22
- </xsd:complexContent>
23
- </xsd:complexType>
24
- <xsd:complexType name="McContact">
25
- <xsd:all>
26
- <xsd:element name="last_name" type="xsd:string"/>
27
- <xsd:element name="email" type="xsd:string"/>
28
- <xsd:element name="mp_id" type="xsd:int"/>
29
- <xsd:element name="role" type="xsd:int"/>
30
- <xsd:element name="login" type="xsd:string"/>
31
- <xsd:element name="first_name" type="xsd:string"/>
32
- </xsd:all>
33
- </xsd:complexType>
34
- <xsd:complexType name="McContactArray">
35
- <xsd:complexContent>
36
- <xsd:restriction base="soapenc:Array">
37
- <xsd:attribute wsdl:arrayType="typens:McContact[]" ref="soapenc:arrayType"/>
38
- </xsd:restriction>
39
- </xsd:complexContent>
40
- </xsd:complexType>
41
- </xsd:schema>
42
- </types>
43
- <message name="GetUserLoginById">
44
- <part name="api_key" type="xsd:string"/>
45
- <part name="id" type="xsd:int"/>
46
- </message>
47
- <message name="GetUserLoginByIdResponse">
48
- <part name="return" type="xsd:string"/>
49
- </message>
50
- <message name="GetAllContacts">
51
- <part name="api_key" type="xsd:string"/>
52
- <part name="login" type="xsd:string"/>
53
- </message>
54
- <message name="GetAllContactsResponse">
55
- <part name="return" type="typens:McContactArray"/>
56
- </message>
57
- <message name="SearchUser">
58
- <part name="api_key" type="xsd:string"/>
59
- <part name="phrase" type="xsd:string"/>
60
- <part name="page" type="xsd:string"/>
61
- <part name="per_page" type="xsd:string"/>
62
- </message>
63
- <message name="SearchUserResponse">
64
- <part name="return" type="typens:MpUserArray"/>
65
- </message>
66
- <portType name="ApiApiPort">
67
- <operation name="GetUserLoginById">
68
- <input message="typens:GetUserLoginById"/>
69
- <output message="typens:GetUserLoginByIdResponse"/>
70
- </operation>
71
- <operation name="GetAllContacts">
72
- <input message="typens:GetAllContacts"/>
73
- <output message="typens:GetAllContactsResponse"/>
74
- </operation>
75
- <operation name="SearchUser">
76
- <input message="typens:SearchUser"/>
77
- <output message="typens:SearchUserResponse"/>
78
- </operation>
79
- </portType>
80
- <binding name="ApiApiBinding" type="typens:ApiApiPort">
81
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
82
- <operation name="GetUserLoginById">
83
- <soap:operation soapAction="/api/api/GetUserLoginById"/>
84
- <input>
85
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ActionWebService" use="encoded"/>
86
- </input>
87
- <output>
88
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ActionWebService" use="encoded"/>
89
- </output>
90
- </operation>
91
- <operation name="GetAllContacts">
92
- <soap:operation soapAction="/api/api/GetAllContacts"/>
93
- <input>
94
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ActionWebService" use="encoded"/>
95
- </input>
96
- <output>
97
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ActionWebService" use="encoded"/>
98
- </output>
99
- </operation>
100
- <operation name="SearchUser">
101
- <soap:operation soapAction="/api/api/SearchUser"/>
102
- <input>
103
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ActionWebService" use="encoded"/>
104
- </input>
105
- <output>
106
- <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ActionWebService" use="encoded"/>
107
- </output>
108
- </operation>
109
- </binding>
110
- <service name="ApiService">
111
- <port name="ApiApiPort" binding="typens:ApiApiBinding">
112
- <soap:address location="http://example.com/api/api"/>
113
- </port>
114
- </service>
115
- </definitions>
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Example of a WSDL with SOAP 1.2 and no SOAP 1.1 endpoint.
3
- Don't know whether this is widespread, but we should allow it. -->
4
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5
- <service name="Blog">
6
- <port name="BlogSoap12">
7
- <soap12:address location="http://blogsite.example.com/endpoint12"/>
8
- </port>
9
- </service>
10
- </definitions>
11
-
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Example of a WSDL with two <binding> tags ("sections" in Savon
3
- parlance).
4
-
5
- This is stripped down from a real example found in the wild, although
6
- having different operations for the SOAP 1.1 and SOAP 1.2 bindings
7
- is hypothetical (the real-world example I saw had the same operations
8
- in each binding section). -->
9
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
10
- <types>
11
- </types>
12
- <portType name="BlogSoap">
13
- </portType>
14
- <binding name="BlogSoap">
15
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
16
- <operation name="Post" />
17
- <operation name="Post11only" />
18
- </binding>
19
- <binding name="BlogSoap12">
20
- <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
21
- <operation name="Post" />
22
- <operation name="Post12only" />
23
- </binding>
24
- </definitions>
25
-
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Time do
4
-
5
- describe "#xs_datetime" do
6
- let(:time) { Time.utc(2011, 01, 04, 13, 45, 55) }
7
-
8
- it "should return an xs:dateTime formatted String" do
9
- time.xs_datetime.should == "2011-01-04T13:45:55Z"
10
- end
11
- end
12
-
13
- end
@@ -1,233 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Savon::WSSE do
4
- let(:wsse) { Savon::WSSE.new }
5
-
6
- it "should contain the namespace for WS Security Secext" do
7
- Savon::WSSE::WSENamespace.should ==
8
- "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
9
- end
10
-
11
- it "should contain the namespace for WS Security Utility" do
12
- Savon::WSSE::WSUNamespace.should ==
13
- "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
14
- end
15
-
16
- it "should contain the namespace for the PasswordText type" do
17
- Savon::WSSE::PasswordTextURI.should ==
18
- "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"
19
- end
20
-
21
- it "should contain the namespace for the PasswordDigest type" do
22
- Savon::WSSE::PasswordDigestURI.should ==
23
- "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"
24
- end
25
-
26
- describe "#credentials" do
27
- it "should set the username" do
28
- wsse.credentials "username", "password"
29
- wsse.username.should == "username"
30
- end
31
-
32
- it "should set the password" do
33
- wsse.credentials "username", "password"
34
- wsse.password.should == "password"
35
- end
36
-
37
- it "should default to set digest to false" do
38
- wsse.credentials "username", "password"
39
- wsse.should_not be_digest
40
- end
41
-
42
- it "should set digest to true if specified" do
43
- wsse.credentials "username", "password", :digest
44
- wsse.should be_digest
45
- end
46
- end
47
-
48
- describe "#username" do
49
- it "should set the username" do
50
- wsse.username = "username"
51
- wsse.username.should == "username"
52
- end
53
- end
54
-
55
- describe "#password" do
56
- it "should set the password" do
57
- wsse.password = "password"
58
- wsse.password.should == "password"
59
- end
60
- end
61
-
62
- describe "#digest" do
63
- it "should default to false" do
64
- wsse.should_not be_digest
65
- end
66
-
67
- it "should specify whether to use digest auth" do
68
- wsse.digest = true
69
- wsse.should be_digest
70
- end
71
- end
72
-
73
- describe "#to_xml" do
74
- context "with no credentials" do
75
- it "should return an empty String" do
76
- wsse.to_xml.should == ""
77
- end
78
- end
79
-
80
- context "with only a username" do
81
- before { wsse.username = "username" }
82
-
83
- it "should return an empty String" do
84
- wsse.to_xml.should == ""
85
- end
86
- end
87
-
88
- context "with only a password" do
89
- before { wsse.password = "password" }
90
-
91
- it "should return an empty String" do
92
- wsse.to_xml.should == ""
93
- end
94
- end
95
-
96
- context "with credentials" do
97
- before { wsse.credentials "username", "password" }
98
-
99
- it "should contain a wsse:Security tag" do
100
- namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
101
- wsse.to_xml.should include("<wsse:Security xmlns:wsse=\"#{namespace}\">")
102
- end
103
-
104
- it "should contain a wsu:Id attribute" do
105
- wsse.to_xml.should include('<wsse:UsernameToken wsu:Id="UsernameToken-1"')
106
- end
107
-
108
- it "should increment the wsu:Id attribute count" do
109
- wsse.to_xml.should include('<wsse:UsernameToken wsu:Id="UsernameToken-1"')
110
- wsse.to_xml.should include('<wsse:UsernameToken wsu:Id="UsernameToken-2"')
111
- end
112
-
113
- it "should contain the WSE and WSU namespaces" do
114
- wsse.to_xml.should include(Savon::WSSE::WSENamespace, Savon::WSSE::WSUNamespace)
115
- end
116
-
117
- it "should contain the username and password" do
118
- wsse.to_xml.should include("username", "password")
119
- end
120
-
121
- it "should not contain a wsse:Nonce tag" do
122
- wsse.to_xml.should_not match(/<wsse:Nonce>.*<\/wsse:Nonce>/)
123
- end
124
-
125
- it "should not contain a wsu:Created tag" do
126
- wsse.to_xml.should_not match(/<wsu:Created>.*<\/wsu:Created>/)
127
- end
128
-
129
- it "should contain the PasswordText type attribute" do
130
- wsse.to_xml.should include(Savon::WSSE::PasswordTextURI)
131
- end
132
- end
133
-
134
- context "with credentials and digest auth" do
135
- before { wsse.credentials "username", "password", :digest }
136
-
137
- it "should contain the WSE and WSU namespaces" do
138
- wsse.to_xml.should include(Savon::WSSE::WSENamespace, Savon::WSSE::WSUNamespace)
139
- end
140
-
141
- it "should contain the username" do
142
- wsse.to_xml.should include("username")
143
- end
144
-
145
- it "should not contain the (original) password" do
146
- wsse.to_xml.should_not include("password")
147
- end
148
-
149
- it "should contain a wsse:Nonce tag" do
150
- wsse.to_xml.should match(/<wsse:Nonce>\w+<\/wsse:Nonce>/)
151
- end
152
-
153
- it "should contain a wsu:Created tag" do
154
- datetime_regexp = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/
155
- wsse.to_xml.should match(/<wsu:Created>#{datetime_regexp}.+<\/wsu:Created>/)
156
- end
157
-
158
- it "should contain the PasswordDigest type attribute" do
159
- wsse.to_xml.should include(Savon::WSSE::PasswordDigestURI)
160
- end
161
- end
162
-
163
- context "with #timestamp set to true" do
164
- before { wsse.timestamp = true }
165
-
166
- it "should contain a wsse:Timestamp node" do
167
- wsse.to_xml.should include('<wsu:Timestamp wsu:Id="Timestamp-1" ' +
168
- 'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">')
169
- end
170
-
171
- it "should contain a wsu:Created node defaulting to Time.now" do
172
- created_at = Time.now
173
- Timecop.freeze created_at do
174
- wsse.to_xml.should include("<wsu:Created>#{created_at.xs_datetime}</wsu:Created>")
175
- end
176
- end
177
-
178
- it "should contain a wsu:Expires node defaulting to Time.now + 60 seconds" do
179
- created_at = Time.now
180
- Timecop.freeze created_at do
181
- wsse.to_xml.should include("<wsu:Expires>#{(created_at + 60).xs_datetime}</wsu:Expires>")
182
- end
183
- end
184
- end
185
-
186
- context "with #created_at" do
187
- before { wsse.created_at = Time.now + 86400 }
188
-
189
- it "should contain a wsu:Created node with the given time" do
190
- wsse.to_xml.should include("<wsu:Created>#{wsse.created_at.xs_datetime}</wsu:Created>")
191
- end
192
-
193
- it "should contain a wsu:Expires node set to #created_at + 60 seconds" do
194
- wsse.to_xml.should include("<wsu:Expires>#{(wsse.created_at + 60).xs_datetime}</wsu:Expires>")
195
- end
196
- end
197
-
198
- context "with #expires_at" do
199
- before { wsse.expires_at = Time.now + 86400 }
200
-
201
- it "should contain a wsu:Created node defaulting to Time.now" do
202
- created_at = Time.now
203
- Timecop.freeze created_at do
204
- wsse.to_xml.should include("<wsu:Created>#{created_at.xs_datetime}</wsu:Created>")
205
- end
206
- end
207
-
208
- it "should contain a wsu:Expires node set to the given time" do
209
- wsse.to_xml.should include("<wsu:Expires>#{wsse.expires_at.xs_datetime}</wsu:Expires>")
210
- end
211
- end
212
-
213
- context "whith credentials and timestamp" do
214
- before do
215
- wsse.credentials "username", "password"
216
- wsse.timestamp = true
217
- end
218
-
219
- it "should contain a wsu:Created node" do
220
- wsse.to_xml.should include("<wsu:Created>")
221
- end
222
-
223
- it "should contain a wsu:Expires node" do
224
- wsse.to_xml.should include("<wsu:Expires>")
225
- end
226
-
227
- it "should contain the username and password" do
228
- wsse.to_xml.should include("username", "password")
229
- end
230
- end
231
- end
232
-
233
- end