Forum: Ruby on Rails Newbie automation testing web services with ruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
winstan (Guest)
on 2009-01-06 10:55
(Received via mailing list)
Hi all,

First post on this group and I hope you guys are as helpful as the
other guys have been for me on the watir group. Fingers crossed.

I have been successfully making HTTP POST protocol requests via an in
house GUI using watir REXML to parse and validate the data, however
now I wish to make SOAP calls with ruby. I have been doing research
for days on this and am in need of a little help.

Due to the sensitivity of the work I am carrying out I will be as
detailed as possible with the actual code I am using but at times I
may be a little vague so please don’t just pass by not knowing what
I’m talking about but please take the time to ask me for some more

Ok so back to my research. I came across a good example for sending a
request to the web service and just outputting the response. However
the response kept returning the line: “Server did not recognize the
value of HTTP Header SOAPAction:”… so further I went with my

Here is the code I have been trying to use (without my edits to the
LOCALHOST_ENDPOINT & request_xml_string):

require 'soap/element'
require 'soap/rpc/driver'
require 'soap/processor'
require 'soap/streamHandler'
require 'soap/property'

LOCALHOST_ENDPOINT = "http://localhost:8080/services/Service"
request_xml_string = 'xml...'

stream =
header =
body_item ='getResponse', request_xml_string)
body =
envelope =, body)

request_string = SOAP::Processor.marshal(envelope)
request =
resp_data = stream.send(LOCALHOST_ENDPOINT, request, 'getResponse')

It would appear that the xml response that I am seeking doesn’t have a
header and that it is not an essential element of an xml (I later
learnt). EASY I thought, I will just comment out the header line and
remove it from the envelope line, resulting in this:

stream =
#header =
body_item ='getResponse', request_xml_string)
body =
envelope =

Again to no prevail, this is the output I get from SciTE:

c:/ruby/lib/ruby/1.8/soap/element.rb:246:in `encode': undefined method
`length' for #<SOAP::SOAPBody:0x2d1dc04> (NoMethodError)
  from c:/ruby/lib/ruby/1.8/soap/generator.rb:129:in `encode_element'
  from c:/ruby/lib/ruby/1.8/soap/generator.rb:70:in `encode_data'
  from c:/ruby/lib/ruby/1.8/soap/generator.rb:58:in `generate'
  from c:/ruby/lib/ruby/1.8/soap/processor.rb:30:in `marshal'
  from WsRequestClientByShortName_test.rb:29

Now I'm really lost and don’t know what to do now.

Many thanks with anticipation, and I look forward to speaking with you
all at some stage.

Frederick C. (Guest)
on 2009-01-06 12:25
(Received via mailing list)
On 6 Jan 2009, at 05:17, winstan wrote:

> Hi all,
> First post on this group and I hope you guys are as helpful as the
> other guys have been for me on the watir group. Fingers crossed.
You might want to try the ruby talk list as this isn't actually a
rails question.

winstan (Guest)
on 2009-01-07 00:14
(Received via mailing list)
Hi Fred,

Ah my mistake, started new discussion on the wrong window.

Thanks for pointing it out to me.


On Jan 6, 9:22 pm, Frederick C. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.