Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #174 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Minor change in SOAP::RPC::Driver.add_document_method

Reported by: nahi Assigned to: nahi
Priority: normal Milestone: 1.5.6
Component: soap4r Version: 1.5
Keywords: Cc:

Description

Hi NaHi,

Sometimes the soap message contains the empty soap:body,
and the request (or response) argument may be empty.

Initially I added the document method in the following way:

server.
  add_document_method('listProducts',
                      'http://warehouse.acme.com/ws/listProducts',
                      nil, # emtpy request
                      XSD::QName.new('http://warehouse.acme.com/ws',
'listProductsResult'))

This then resulted in following :

/usr/lib/ruby/1.8/soap/rpc/element.rb:166:in `create_doc_param_def': undefined m
ethod `each' for nil:NilClass (NoMethodError)
        from /usr/lib/ruby/1.8/soap/rpc/driver.rb:148:in `add_document_method'
        from WarehouseNoWsdlClient.rb:9

The quick fix is to do :

server.
  add_document_method('listProducts',
                      'http://warehouse.acme.com/ws/listProducts',
                      [], # emtpy request
                      XSD::QName.new('http://warehouse.acme.com/ws',
'listProductsResult'))

But perhaps a slightly more defensive code could be used in soap/rpc/driver.rb:

--- /usr/lib/ruby/1.8/soap/rpc/driver.rb        2005-10-26
21:53:24.358155600 -0700
+++ driver.rb   2005-10-26 21:53:24.373780600 -0700
@@ -145,6 +145,8 @@
   alias add_method_with_soapaction_as add_rpc_method_with_soapaction_as

   def add_document_method(name, soapaction, req_qname, res_qname)
+    req_qname ||= []
+    res_qname ||= []
     param_def = SOAPMethod.create_doc_param_def(req_qname, res_qname)
     @proxy.add_document_method(soapaction, name, param_def)
     add_document_method_interface(name, param_def)

Regards,
emil

Change History

11/03/05 09:54:16 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1658]) allow document method definition with nil instead of [] when its request/response is emtpy. closes #174.