# Ruby SOAP client questions

**URL:** <https://www.ruby-forum.com/t/ruby-soap-client-questions/78600>\
**Category:** Ruby\
**Created:** [December 7, 2006, 4:45am UTC](https://www.ruby-forum.com/t/ruby-soap-client-questions/78600 "2006-12-07T04:45:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [December 7, 2006, 4:45am UTC](https://www.ruby-forum.com/t/ruby-soap-client-questions/78600/1 "2006-12-07T04:45:21Z")

</div>

I’m trying to write a Ruby SOAP client to talk to, what appears to be  
a very strange SOAP server (something written in Java).

The server requires me to submit an “AuthRequest” with a username and  
password, and it returns an authToken and a sessionId. I can  
authenticate properly, but the server requires that the authToken and  
sessionId parameters be put in the Header, not the Body of successive  
requests. II don’t know how to get the SOAP library to do this (or if  
it is possible). AuthRequest returns this:

\<soap:Envelope xmlns:soap=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”\>  
soap:Header  
  
\<sessionId type="admin"id=“151”\>151  
\</soap:Header\>  
soap:Body  
0\_e5a61cd7bf0d7b41e53ccf9e111140f0d1a33f97\_79643d33363a39646335623033662d336465632d346661632d383339302d3366366539323436653835343b  
6578703d31333a313136353530343334393231373b61646d696f3d313a313b  
43200000  
false  
151  
\</soap:Body\>\</soap:Envelope\>

If you notice above, the server always supplies a Header back too. So  
how can I put parameters into the Header? Can I build a custom header  
if needed?

Also, how do you add a custom attribute to a SOAP method parameter?  
One of the SOAP methods that I have to call is called  
“GetAccountRequest”, and it requires a parameter called “account”, but  
it requires an attribute, like this:

removed\_email\_address@domain.invalid

How can I specify that “by” attribute?
