>
> > I'm not positive, but I think you could implement James's idea in
> > SOAP::RPC::Proxy#marshal (in /usr/lib/ruby/1.8/soap/rpc/proxy.rb
> > here).
>
> Sorry. That should be SOAP::RPC::Proxy::Operation#marshal.

Thanks for the feedback. I managed to get it working by extending the
SOAP::RPC::Proxy class like this:


require 'soap/rpc/proxy'

class CustomProxy < SOAP::RPC::Proxy

# Here, I override the route method so that I can generate a self
closed body tag.
  def route(req_header, req_body, reqopt, resopt)
     req_env = ::SOAP::SOAPEnvelope.new(req_header, req_body)
     unless reqopt[:envelopenamespace].nil?
        set_envelopenamespace(req_env, reqopt[:envelopenamespace])
     end
     reqopt[:external_content] = nil
     conn_data = marshal(req_env, reqopt)

     #hack to generate self-closed soap:Body tag
     conn_data.send_string = conn_data.send_string.sub!('<soap:Body></
soap:Body>', '<soap:Body/>') if !
conn_data.send_string.rindex("<soap:Body></soap:Body>").nil?

     if ext = reqopt[:external_content]
        mime = MIMEMessage.new
        ext.each do |k, v|
           mime.add_attachment(v.data)
        end
        mime.add_part(conn_data.send_string + "\r\n")
        mime.close
        conn_data.send_string = mime.content_str
        conn_data.send_contenttype = mime.headers['content-type'].str
     end
     conn_data = @streamhandler.send(@endpoint_url, conn_data,
        reqopt[:soapaction])
        if conn_data.receive_string.empty?
           return nil
        end
        unmarshal(conn_data, resopt)
     end
  end
end

And then, to make the soap4r generated driver use it, I modified the
generated initializer so that it no longer calls "super". I then
implemented the code from the original proxy.rb initialize which
includes instantiating the proxy. Bu instead of using the default
proxy, I use my custom one. here's an example:

Driver.rb

def initialize...
...

   # we do not call the base initialize here because we
   # need to use a custom proxy. So all of the super
   # initialize components are performed here

   # super(endpoint_url, nil)

   @namespace = nil
   @soapaction = nil
   @options = setup_options
   @wiredump_file_base = nil
   @proxy = CusromProxy.new(endpoint_url, @soapaction, @options)

...

Thanks again for pointing me in the right direction.

I hope this will help someone else in the future :)

Joe