@@ -239,6 +239,7 @@ def output_for(operation)
239
239
input_output_for ( operation , 'output' )
240
240
end
241
241
242
+ # @return [namespace_id, message_type]
242
243
def input_output_for ( operation , input_output )
243
244
operation_name = operation [ 'name' ]
244
245
@@ -251,9 +252,13 @@ def input_output_for(operation, input_output)
251
252
252
253
port_type_input_output = port_type_operation &.element_children &.find { |node | node . name == input_output }
253
254
255
+ # find the message for the portType operation
256
+ # if there is no message, we will use the operation name as the message name
257
+
254
258
# TODO: Stupid fix for missing support for imports.
255
259
# Sometimes portTypes are actually included in a separate WSDL.
256
260
if port_type_input_output
261
+ # If the message attribute contains a colon, it means the message is namespaced.
257
262
if port_type_input_output . attribute ( 'message' ) . to_s . include? ':'
258
263
port_message_ns_id , port_message_type = port_type_input_output . attribute ( 'message' ) . to_s . split ( ':' )
259
264
else
@@ -262,13 +267,6 @@ def input_output_for(operation, input_output)
262
267
263
268
message_ns_id , message_type = nil
264
269
265
- soap_operation = operation . element_children . find { |node | node . name == 'operation' }
266
-
267
- if soap_operation . nil? || soap_operation [ 'style' ] != 'rpc'
268
- message_ns_id = port_message_ns_id
269
- message_type = port_message_type
270
- end
271
-
272
270
# When there is a parts attribute in soap:body element, we should use that value
273
271
# to look up the message part from messages array.
274
272
input_output_element = operation . element_children . find { |node | node . name == input_output }
@@ -277,6 +275,7 @@ def input_output_for(operation, input_output)
277
275
soap_body_parts = soap_body_element [ 'parts' ] if soap_body_element
278
276
end
279
277
278
+ # look for any message part that matches the soap body parts
280
279
message = @messages [ port_message_type ]
281
280
port_message_part = message &.element_children &.find do |node |
282
281
soap_body_parts . nil? ? ( node . name == "part" ) : ( node . name == "part" && node [ "name" ] == soap_body_parts )
@@ -291,6 +290,22 @@ def input_output_for(operation, input_output)
291
290
end
292
291
end
293
292
293
+ # If the message is not found, we should use the operation name as the message name for document style operations
294
+ # applies only to output
295
+ if input_output == 'output'
296
+ # if the operation is document style and theres no port_message_part, we should use the operation_name
297
+ soap_operation = operation . element_children . find { |node | node . name == 'operation' }
298
+ if message_type . nil? && ( soap_operation . nil? || soap_operation [ 'style' ] != 'rpc' )
299
+ if port_message_part . nil?
300
+ message_ns_id = port_message_ns_id
301
+ message_type = operation_name
302
+ else
303
+ message_ns_id = port_message_ns_id
304
+ message_type = port_message_type
305
+ end
306
+ end
307
+ end
308
+
294
309
# Fall back to the name of the binding operation
295
310
if message_type
296
311
[ message_ns_id , message_type ]
0 commit comments