# Soap and Http-access problem

**URL:** <https://www.ruby-forum.com/t/soap-and-http-access-problem/101386>\
**Category:** Ruby\
**Created:** [August 4, 2006, 5:21pm UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386 "2006-08-04T17:21:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ola\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/858c86/32.png) [@Ola\_B](https://www.ruby-forum.com/u/Ola_B)\
**Post date:** [August 4, 2006, 5:21pm UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386/1 "2006-08-04T17:21:34Z")

</div>

Hi,

I’m working on an application where some of the business logic is  
accessible with SOAP. I’ve used SOAP4R to generate everything and it  
works splendid (I use http-access2 since we require https). Anyway, a  
week ago, this stopped working, for no reason I can figure out. But it  
just stopped working on my dev machine, not on our production\_test  
server or anything. I’m sitting on Windows 2003, and the stack trace  
looks like this:  
Bad file descriptor - connect(2) (, #0)  
d:/programming/ruby/lib/ruby/site\_ruby/1.8/http-access2.rb:1391:in  
`initialize' d:/programming/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:1391:in `create\_socket’  
d:/programming/ruby/lib/ruby/site\_ruby/1.8/http-access2.rb:1352:in  
`connect' d:/programming/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout’  
d:/programming/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout' d:/programming/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:1351:in `connect’  
d:/programming/ruby/lib/ruby/site\_ruby/1.8/http-access2.rb:1209:in  
`query' d:/programming/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:892:in `query’  
d:/programming/ruby/lib/ruby/site\_ruby/1.8/http-access2.rb:434:in  
`do_get_block' d:/programming/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:370:in `conn\_request’  
d:/programming/ruby/lib/ruby/site\_ruby/1.8/http-access2.rb:285:in  
`request' d:/programming/ruby/lib/ruby/site_ruby/1.8/http-access2.rb:264:in `post’  
d:/programming/ruby/lib/ruby/1.8/soap/streamHandler.rb:170:in  
`send_post' d:/programming/ruby/lib/ruby/1.8/soap/streamHandler.rb:109:in `old\_send’  
#{RAILS\_ROOT}/vendor/lpw/lpw.rb:11:in `send' d:/programming/ruby/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route’  
d:/programming/ruby/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call' d:/programming/ruby/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call’  
d:/programming/ruby/lib/ruby/1.8/soap/rpc/driver.rb:232:in `getUserData' #{RAILS_ROOT}/app/models/address_information.rb:25:in `fetch’  
#{RAILS\_ROOT}/app/models/lpw\_object.rb:23:in `fetch' #{RAILS_ROOT}/app/controllers/lpw_controller.rb:110:in `addr’  
d:/Programming/Ruby/bin/mongrel\_rails:18

I would be very thankful for any help coming to terms with this.

## Regards

Ola B. ([http://ola-bini.blogspot.com](http://ola-bini.blogspot.com))  
JvYAML, RbYAML, JRuby and Jatha contributor  
System Developer, Karolinska Institutet ([http://www.ki.se](http://www.ki.se))  
OLogix Consulting ([http://www.ologix.com](http://www.ologix.com))

“Yields falsehood when quined” yields falsehood when quined.

---

<div class="post-metadata">

**Author:** ![Ola\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/858c86/32.png) [@Ola\_B](https://www.ruby-forum.com/u/Ola_B)\
**Post date:** [August 7, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386/2 "2006-08-07T15:39:31Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Ola B. wrote:

> I’m working on an application where some of the business logic is  
> accessible with SOAP. I’ve used SOAP4R to generate everything and it  
> works splendid (I use http-access2 since we require https). Anyway, a  
> week ago, this stopped working, for no reason I can figure out. But it  
> just stopped working on my dev machine, not on our production\_test  
> server or anything. I’m sitting on Windows 2003, and the stack trace  
> looks like this:  
> Bad file descriptor - connect(2) (, #0)

Hmm. Trying to execute TCPSocket.new(nil, 0) here. Endpoint URL is  
broken somewhere.

> d:/programming/ruby/lib/ruby/1.8/soap/streamHandler.rb:109:in `old\_send’

Do you know what’s ‘old\_send’ here? What version of soap4r are you  
using?

Regards,  
// NaHi

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRNdBkx9L2jg5EEGlAQInAAgAgSFBr8QwCzfFcGt3dnw6AMxmR8ZD1rrO  
YeulWIbP9JrefwfilpB7uDsJY9FuVW5bxpcB24ToDp3gkyKJhLnY5lA3Uvcy543i  
LfDVZbkAbhCE7W3tifyOtb0vRuSmE3p3KwEE91aTyRSpMsml2uRKDyIFU1zkmxju  
pHd0sy91gr7pMJDa9R4Ls2zCmnd8HugpsOUWysPVgFwq/Qbak4hMclKBM0TcoQmd  
0QexWaWV3KL79XZHz75FKjtqq5itVqS6ltmtMRzkCCSHfMjU53bEby4MfSKahPjv  
QqU0vG/HO7BaUTKymeeULGkZU/+yaAvKFq42/xW5LkLogV0mWHZc9w==  
=9Zqw  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Ola\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/858c86/32.png) [@Ola\_B](https://www.ruby-forum.com/u/Ola_B)\
**Post date:** [August 7, 2006, 3:54pm UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386/3 "2006-08-07T15:54:33Z")

</div>

NAKAMURA, Hiroshi wrote:

> Regards,  
> // NaHi

Hi,

I’m using Soap4R 1.5.5. Regarding the old\_send, that’s the result of  
monkey\_patching, since I add some big problems with another thing. Hmm.  
old\_send is just send renamed. But this shouldn’t be the problem, it  
works on another machine and has worked on this machine. The monkey  
patching looks like this:

module SOAP  
class HTTPStreamHandler  
alias :old\_send :send  
def send(endpoint\_url, conn\_data, soapaction = nil, charset =  
@charset)  
ret = old\_send(endpoint\_url,conn\_data,soapaction,charset)  
if ret.receive\_string =~ /._?(\<?xml._?\</soapenv:Envelope\>).\*?/m  
ret.receive\_string = $1  
end  
ret  
end  
end  
end

and the reason that is is necessary can you find here:

> **[Rails, SOAP4R and Java.](http://ola-bini.blogspot.com/2006/08/rails-soap4r-and-java.html)**
>
> I've spent the last three weeks working part time on a project called LPW at work. LPW is a set of web services that talk with the Swedish s...

in the next to last paragraph.

## Regards

Ola B. ([http://ola-bini.blogspot.com](http://ola-bini.blogspot.com))  
JvYAML, RbYAML, JRuby and Jatha contributor  
System Developer, Karolinska Institutet ([http://www.ki.se](http://www.ki.se))  
OLogix Consulting ([http://www.ologix.com](http://www.ologix.com))

“Yields falsehood when quined” yields falsehood when quined.

---

<div class="post-metadata">

**Author:** ![Ola\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/858c86/32.png) [@Ola\_B](https://www.ruby-forum.com/u/Ola_B)\
**Post date:** [August 8, 2006, 8:35am UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386/4 "2006-08-08T08:35:00Z")

</div>

NAKAMURA, Hiroshi wrote:

> -----BEGIN PGP SIGNED MESSAGE-----  
> Hash: SHA1
> 
> Hi,
> 
> Ola B. wrote:  
> Do your production and development environment both uses http proxy to  
> access foreign WS?

Hi,

Nope, no proxies anywhere. It’s a straight call through https to the  
other machine.

> Hmm. There must be an attachment interoperability problem. Can I see  
> entire response XML?

I don’t have it available right now, but I’ll dig after it. Suffice to  
say, there was noise before \<?xml (some kind of multipart structure,  
maybe), and what looked like the complete PDF sent attached after (the  
same data contained in a byte-array inside the SOAP-response)

## Regards

Ola B. ([http://ola-bini.blogspot.com](http://ola-bini.blogspot.com))  
JvYAML, RbYAML, JRuby and Jatha contributor  
System Developer, Karolinska Institutet ([http://www.ki.se](http://www.ki.se))  
OLogix Consulting ([http://www.ologix.com](http://www.ologix.com))

“Yields falsehood when quined” yields falsehood when quined.

---

<div class="post-metadata">

**Author:** ![Ola\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/858c86/32.png) [@Ola\_B](https://www.ruby-forum.com/u/Ola_B)\
**Post date:** [August 8, 2006, 3:55am UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386/5 "2006-08-08T03:55:41Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Ola B. wrote:

> I’m using Soap4R 1.5.5. Regarding the old\_send, that’s the result of  
> monkey\_patching, since I add some big problems with another thing. Hmm.  
> old\_send is just send renamed. But this shouldn’t be the problem, it  
> works on another machine and has worked on this machine. The monkey  
> patching looks like this:  
> [snip]

Agreed. No suspicious part in old\_send.

I think “Bad file descriptor - connect(2) (, #0)” is caused by  
TCPSocket.new(“0.0.0.0”, 0). “0.0.0.0” and 0 is a default value of  
accessing Site representation in http-access2. Site is used for  
representing 1) destination http server and 2) http proxy server. And  
for now, with regard to 1), there’s no suspicious part.

Do your production and development environment both uses http proxy to  
access foreign WS?

> end  
> end
> 
> and the reason that is is necessary can you find here:  
> [Ola Bini: Programming Language Synchronicity: Rails, SOAP4R and Java.](http://ola-bini.blogspot.com/2006/08/rails-soap4r-and-java.html)

Hmm. There must be an attachment interoperability problem. Can I see  
entire response XML?

Regards,  
// NaHi  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRNfuqB9L2jg5EEGlAQKjKQf/XA1NOxjVES2ioLSJ+EY2kfskwaldnq5t  
FWd8Deo3l9QkVPCej16egBhULm1q6uJWqgTFDcTK4Z7DpR11QaozWemjP+UvNgpJ  
8NjfncgpJcgSKRZXLDEOsgVY9MIBup5q7VU4qgGJxWmpek0lLgzFLgLP4ewEI9C+  
C4TUYmH70CCmDkkVGgSX1mtVYxSMJJvJiW8tEWsyALJx5MI0BosDtaj5677bRbRB  
Nyyo0r9G88yJF9NM4bmGnRZh8yiX+hMa5nFq+2aai8/LN0lQdfIcI/e4dK+JaW7w  
nus7O7tNgQGG9795QCu6uhge7qFUWPi+GI1bKagEJsduSPC5oX5UfA==  
=8enK  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Ola\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/858c86/32.png) [@Ola\_B](https://www.ruby-forum.com/u/Ola_B)\
**Post date:** [August 8, 2006, 9:44am UTC](https://www.ruby-forum.com/t/soap-and-http-access-problem/101386/6 "2006-08-08T09:44:05Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Ola B. wrote:

> > Do your production and development environment both uses http proxy to  
> > access foreign WS?

> Nope, no proxies anywhere. It’s a straight call through https to the  
> other machine.

Hmmm. Then the destination site is suspicious but I cannot imagine what  
is going on.

Can you add  
$log = Logger.new(“http-access2.log”)  
at the beginning of http-access2.rb and  
$log.debug(site)  
around Site object? I’ll send monkey-patched-http-access2.rb if you  
want.

> > Hmm. There must be an attachment interoperability problem. Can I see  
> > entire response XML?
> 
> I don’t have it available right now, but I’ll dig after it. Suffice to  
> say, there was noise before \<?xml (some kind of multipart structure,  
> maybe), and what looked like the complete PDF sent attached after (the  
> same data contained in a byte-array inside the SOAP-response)

Sure. “noise before XML” and “noise between XML and PDF” are the point.  
It may be a standard format which soap4r have not yet supported.

Regards,  
// NaHi  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRNhAph9L2jg5EEGlAQKnmwf7BjUVwKvPQScEt4X+ldwj7Kf2CQ2YVPgR  
tQffkdzo60plzWlbgo4wfnWAE6pdPA/z/hd+5qel0oIpj+vobaVaRQAhxckyIk84  
7iCzAc7MufklTVsGsyra2aKnuxCYTDpT89B6Ory7h0qXorw9lbVl7beeFr/OuvLL  
eSHt5tn40XZV+2lQvSLLt0nKicmmszSM5ek3kFR80CIrTquKPUuam/uGUOEdcK7X  
wySvVS9wmrEdVEGLimWU2F93oPAm6MpKr5HHWiCQpU3a+unSxtjMrvYfdSvbIdx5  
NXkwD53z9fUyAzKgI9wDeTpfiEEcVBDaPBIObd+H3FJtvWBorrvTBw==  
=RFEZ  
-----END PGP SIGNATURE-----
