-
Notifications
You must be signed in to change notification settings - Fork 0
/
bday-alert-api.xml
345 lines (279 loc) · 26.3 KB
/
bday-alert-api.xml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project id="f27dc460-59e1-4676-8acf-b1661c88b54f" activeEnvironment="Default" name="bday-alert-api" resourceRoot="" soapui-version="5.4.0" abortOnError="false" runType="SEQUENTIAL" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:interface xsi:type="con:RestService" id="c32744b6-76b4-4459-9986-2230d7eb0c06" wadlVersion="http://wadl.dev.java.net/2009/02" name="http://localhost:9080" type="rest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:settings/><con:definitionCache type="TEXT" rootPart=""/><con:endpoints><con:endpoint>http://localhost:8080</con:endpoint><con:endpoint>http://localhost:9080</con:endpoint></con:endpoints><con:resource name="" path="/birthday/1" id="a3a5e2b7-c6eb-4839-ba73-3049987af3e4"><con:settings/><con:parameters/><con:method name="get" id="0d2f74e8-e389-4aef-ab59-87011870b9b7" method="GET"><con:settings/><con:parameters/><con:representation type="RESPONSE"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Response</con:element></con:representation><con:representation type="FAULT"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>405 500</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Fault</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/xml</con:mediaType><con:status>200</con:status><con:params/></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType xsi:nil="true"/><con:status>404</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>text/html; charset=iso-8859-1</con:mediaType><con:status>200</con:status><con:params/><con:element>html</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Response</con:element></con:representation><con:request name="Request 1" id="0e572f9b-ccf0-4f2a-9674-d69dd0e14628" mediaType="application/json"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://localhost:8081</con:endpoint><con:request/><con:originalUri>http://localhost/bday/birthday/1</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/><con:parameterOrder/></con:request></con:method><con:method name="update" id="f4b39f68-064f-47f1-96a5-652bcbe55365" method="PUT"><con:settings/><con:parameters/><con:representation type="REQUEST"><con:mediaType>application/json</con:mediaType><con:params/></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Response</con:element></con:representation><con:representation type="FAULT"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>405 500</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Fault</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>text/html; charset=iso-8859-1</con:mediaType><con:status>200</con:status><con:params/><con:element>html</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/xml</con:mediaType><con:status>200</con:status><con:params/></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Response</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:request name="Request 1" id="d989bc20-03be-45fb-93d8-64b943d7e221" mediaType="application/json" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://localhost:8081</con:endpoint><con:request>{"id":"1","name":"Elis Reginas","day":"1945-03-17"}</con:request><con:originalUri>http://localhost/bday/birthday/1</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/><con:parameterOrder/></con:request></con:method><con:method name="delete" id="ae4a97f7-1f78-46ba-8b1a-0c4fac164c8c" method="DELETE"><con:settings/><con:parameters/><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>200</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="REQUEST"><con:mediaType>application/json</con:mediaType><con:params/></con:representation><con:representation type="FAULT"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>405 500</con:status><con:params/><con:element xmlns:ns="http://localhost/bday/birthday/1">ns:Fault</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json</con:mediaType><con:status>200</con:status><con:params/></con:representation><con:request name="Request 1" id="23b1bed1-8c2f-41cd-98b7-a007699a496e" mediaType="application/json" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://localhost:8081</con:endpoint><con:request/><con:originalUri>http://localhost/bday/birthday/1</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/><con:parameterOrder/></con:request></con:method></con:resource><con:resource name="" path="/birthday" id="a3a5e2b7-c6eb-4839-ba73-3049987af3e4"><con:settings/><con:parameters/><con:method name="create" id="b6b1303d-685d-47c4-acaf-c2de7063cbd6" method="POST"><con:settings/><con:parameters/><con:representation type="REQUEST"><con:mediaType>application/json</con:mediaType><con:params/></con:representation><con:representation type="FAULT"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>400 405 500</con:status><con:params/><con:element xmlns:bir="http://localhost/bday/birthday">bir:Fault</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:bir="http://localhost/bday/birthday">bir:Response</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>text/html; charset=iso-8859-1</con:mediaType><con:status>200</con:status><con:params/><con:element>html</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/xml</con:mediaType><con:status>200</con:status><con:params/></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json</con:mediaType><con:status>200</con:status><con:params/><con:element xmlns:bir="http://localhost/bday/birthday">bir:Response</con:element></con:representation><con:request name="Request 1" id="213367ac-fd10-44b4-91a3-33133e0807de" mediaType="application/json" postQueryString="false"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://localhost:8080</con:endpoint><con:request>{
"name": "Joao Santos",
"day": "2018-06-11T15:27:23.621+0000"
}</con:request><con:originalUri>http://localhost/bday/birthday</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request></con:method><con:method name="list" id="f5c42719-1da4-41cb-8959-ab9f04d5f548" method="GET"><con:settings/><con:parameters/><con:representation type="RESPONSE"><con:mediaType>application/xml</con:mediaType><con:status>200</con:status><con:params/></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json</con:mediaType><con:status>200</con:status><con:params/><con:element>Response</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>application/json;charset=UTF-8</con:mediaType><con:status>200</con:status><con:params/><con:element>Response</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>text/html; charset=iso-8859-1</con:mediaType><con:status>200</con:status><con:params/><con:element>html</con:element></con:representation><con:request name="Request 1" id="2d21727d-18f0-4c8d-b940-9c1a87061077" mediaType="application/json"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://localhost:8080</con:endpoint><con:request/><con:originalUri>http://localhost/bday/birthday</con:originalUri><con:credentials><con:authType>No Authorization</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request></con:method></con:resource></con:interface><con:restMockService id="bfa5490e-411f-42fe-abe3-5255fc244014" port="8080" path="/" host="dmoutinho" name="Mock"><con:settings/><con:properties/><con:restMockAction name="/birthday (list)" method="GET" resourcePath="/birthday" id="bbd68c04-0212-437d-a388-699f6e2f3c77"><con:settings/><con:defaultResponse xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/*
// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on path
def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath
if( requestPath.contains("json") )
{
// return the name of the response you want to dispatch
return "JSON Response"
}
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("stockholm") )
{
// return the name of the response you want to dispatch
return "Response Stockholm"
}
else if( queryString.contains("london") )
{
// return the name of the response you want to dispatch
return "Response London"
}
// Match based on header
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
if( acceptEncodingHeaderList.contains("gzip,deflate") )
{
// return the name of the response you want to dispatch
return "GZiped Response"
}
// Match based on body
def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody
if( requestBody.contains("some data") )
{
// return the name of the response you want to dispatch
return "Response N"
}
*/
</con:dispatchPath><con:response name="Response 1" id="780fc658-65e2-4f3b-a5ed-df8ed765c3e7" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent>[
{
"id": 1,
"name": "Diogo Moutinho",
"day": "2018-06-14T01:37:01.642+0000"
},
{
"id": 2,
"name": "Maria Clara",
"day": "2018-06-14T01:37:01.805+0000"
},
{
"id": 3,
"name": "Dayse Santos",
"day": "2018-06-14T01:37:01.808+0000"
}
]</con:responseContent><con:header><con:name>Access-Control-Allow-Origin</con:name><con:value>*</con:value></con:header></con:response></con:restMockAction><con:restMockAction name="/birthday (create)" method="POST" resourcePath="/birthday" id="259c59b7-4b97-4810-b943-1f3b6aaafa4c"><con:settings/><con:defaultResponse>Response 1</con:defaultResponse><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/*
// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on path
def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath
if( requestPath.contains("json") )
{
// return the name of the response you want to dispatch
return "JSON Response"
}
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("stockholm") )
{
// return the name of the response you want to dispatch
return "Response Stockholm"
}
else if( queryString.contains("london") )
{
// return the name of the response you want to dispatch
return "Response London"
}
// Match based on header
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
if( acceptEncodingHeaderList.contains("gzip,deflate") )
{
// return the name of the response you want to dispatch
return "GZiped Response"
}
// Match based on body
def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody
if( requestBody.contains("some data") )
{
// return the name of the response you want to dispatch
return "Response N"
}
*/
</con:dispatchPath><con:response name="Response 1" id="c81cde54-9331-4b3b-9748-3eaa6d62247f" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent>{
"id": 99,
"name": "Jorge Santos",
"day": "2018-06-15T01:55:40.789+0000"
}</con:responseContent><con:header><con:name>Access-Control-Allow-Origin</con:name><con:value>*</con:value></con:header></con:response></con:restMockAction></con:restMockService><con:restMockService id="9003c121-4167-411f-9f10-e19ddb77ce41" port="8081" path="/" host="dmoutinho" name="Mock ID" docroot=""><con:settings/><con:properties/><con:restMockAction name="/birthday/1 (get)" method="GET" resourcePath="/birthday/1" id="a0b32cba-6a88-4f23-a0c4-41c9133f8d63"><con:settings/><con:defaultResponse xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/*
// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on path
def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath
if( requestPath.contains("json") )
{
// return the name of the response you want to dispatch
return "JSON Response"
}
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("stockholm") )
{
// return the name of the response you want to dispatch
return "Response Stockholm"
}
else if( queryString.contains("london") )
{
// return the name of the response you want to dispatch
return "Response London"
}
// Match based on header
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
if( acceptEncodingHeaderList.contains("gzip,deflate") )
{
// return the name of the response you want to dispatch
return "GZiped Response"
}
// Match based on body
def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody
if( requestBody.contains("some data") )
{
// return the name of the response you want to dispatch
return "Response N"
}
*/
</con:dispatchPath><con:response name="Response 1" id="dc3bff12-268b-45e5-adae-29c705976c21" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent>{
"id": 1,
"name": "Diogo Moutinho",
"day": "2018-06-14T01:55:40.789+0000"
}</con:responseContent><con:header><con:name>Access-Control-Allow-Origin</con:name><con:value/></con:header></con:response></con:restMockAction><con:restMockAction name="/birthday/1 (delete)" method="DELETE" resourcePath="/birthday/1" id="0a260b8d-bd9e-4dd6-89f8-3189bb8dbfdc"><con:settings/><con:defaultResponse xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/*
// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on path
def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath
if( requestPath.contains("json") )
{
// return the name of the response you want to dispatch
return "JSON Response"
}
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("stockholm") )
{
// return the name of the response you want to dispatch
return "Response Stockholm"
}
else if( queryString.contains("london") )
{
// return the name of the response you want to dispatch
return "Response London"
}
// Match based on header
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
if( acceptEncodingHeaderList.contains("gzip,deflate") )
{
// return the name of the response you want to dispatch
return "GZiped Response"
}
// Match based on body
def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody
if( requestBody.contains("some data") )
{
// return the name of the response you want to dispatch
return "Response N"
}
*/
</con:dispatchPath><con:response name="Response 1" id="bdc9256c-be26-411d-9359-8db23ebf9c43" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent/><con:header><con:name>Access-Control-Allow-Origin</con:name><con:value>*</con:value></con:header></con:response></con:restMockAction><con:restMockAction name="/birthday/1 (update)" method="PUT" resourcePath="/birthday/1" id="4848fa53-ea16-48cd-99f4-30362d1ab6a8"><con:settings/><con:defaultResponse>Response 1</con:defaultResponse><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/*
// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on path
def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath
if( requestPath.contains("json") )
{
// return the name of the response you want to dispatch
return "JSON Response"
}
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("stockholm") )
{
// return the name of the response you want to dispatch
return "Response Stockholm"
}
else if( queryString.contains("london") )
{
// return the name of the response you want to dispatch
return "Response London"
}
// Match based on header
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
if( acceptEncodingHeaderList.contains("gzip,deflate") )
{
// return the name of the response you want to dispatch
return "GZiped Response"
}
// Match based on body
def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody
if( requestBody.contains("some data") )
{
// return the name of the response you want to dispatch
return "Response N"
}
*/
</con:dispatchPath><con:response name="Response 1" id="51b7946c-b6e6-4c89-aceb-6aa5f00e9f09" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent>{
"id": 1,
"name": "Diogo Moutinho",
"day": "2018-06-14T01:55:40.789+0000"
}</con:responseContent><con:header><con:name>Access-Control-Allow-Origin</con:name><con:value>*</con:value></con:header></con:response></con:restMockAction><con:restMockAction name="/birthday/1 (options)" method="OPTIONS" resourcePath="/birthday/1" id="07d0ad47-272a-43af-b70a-38f7fd2eab18"><con:settings/><con:defaultResponse>Response 1</con:defaultResponse><con:dispatchStyle>SEQUENCE</con:dispatchStyle><con:dispatchPath>/*
// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on path
def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath
if( requestPath.contains("json") )
{
// return the name of the response you want to dispatch
return "JSON Response"
}
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("stockholm") )
{
// return the name of the response you want to dispatch
return "Response Stockholm"
}
else if( queryString.contains("london") )
{
// return the name of the response you want to dispatch
return "Response London"
}
// Match based on header
def acceptEncodingHeaderList = mockRequest.getRequestHeaders().get("Accept-Encoding")
log.info "AcceptEncoding Header List: " + acceptEncodingHeaderList
if( acceptEncodingHeaderList.contains("gzip,deflate") )
{
// return the name of the response you want to dispatch
return "GZiped Response"
}
// Match based on body
def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody
if( requestBody.contains("some data") )
{
// return the name of the response you want to dispatch
return "Response N"
}
*/
</con:dispatchPath><con:response name="Response 1" id="559da9d4-f418-43bb-a069-bc4286dfa616" httpResponseStatus="200" mediaType="application/json"><con:settings/><con:responseContent/><con:header><con:name>Access-Control-Allow-Headers</con:name><con:value>application/json</con:value></con:header><con:header><con:name>Access-Control-Allow-Origin</con:name><con:value>*</con:value></con:header><con:header><con:name>Access-Control-Allow-Methods</con:name><con:value>POST, GET, OPTIONS, DELETE, PUT</con:value></con:header></con:response></con:restMockAction></con:restMockService><con:properties/><con:wssContainer/><con:oAuth2ProfileContainer/><con:oAuth1ProfileContainer/></con:soapui-project>