# Soap add\_method

**URL:** <https://www.ruby-forum.com/t/soap-add-method/86509>\
**Category:** Ruby\
**Created:** [February 22, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/soap-add-method/86509 "2007-02-22T21:25:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsmecham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f475e1/32.png) [@jsmecham](https://www.ruby-forum.com/u/jsmecham)\
**Post date:** [February 22, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/soap-add-method/86509/1 "2007-02-22T21:25:23Z")

</div>

Is there a way to set default arguments for soap methods?

i.e.

proxy.add\_method(‘value1’,‘value2’=‘something’)

I need to pass a long a username and password with each soap call.  
please let me know, thanks!

---

<div class="post-metadata">

**Author:** ![jsmecham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f475e1/32.png) [@jsmecham](https://www.ruby-forum.com/u/jsmecham)\
**Post date:** [February 22, 2007, 9:28pm UTC](https://www.ruby-forum.com/t/soap-add-method/86509/2 "2007-02-22T21:28:06Z")

</div>

Justin M. wrote:

> Is there a way to set default arguments for soap methods?
> 
> i.e.
> 
> proxy.add\_method(‘value1’,‘value2’=‘something’)
> 
> I need to pass a long a username and password with each soap call.  
> please let me know, thanks!

I would also like to add, this is not Basic auth(http auth). This is  
simple passing a variable called username and password with each call.

---

<div class="post-metadata">

**Author:** ![jsmecham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f475e1/32.png) [@jsmecham](https://www.ruby-forum.com/u/jsmecham)\
**Post date:** [February 22, 2007, 11:19pm UTC](https://www.ruby-forum.com/t/soap-add-method/86509/3 "2007-02-22T23:19:04Z")

</div>

On 2/22/07, Justin M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Hi Justin, I don’t know exactly how SOAP4R handles this, but you could  
add the method normally, and writte a wrapper to call the method with  
the attributes:  
class \<\< soap\_object  
def really\_cool\_method(\*args)  
self.cool\_method(:value1 =\> "blah, args)  
end  
end
