.Net web services and integers

my integers have suddenly become negative numbers when returned from a
.Net web service. Thing is I have this running locally on my Mac OS X
box and everything is working fine. I then copied the exact same
function to my (production) LIVE ubuntu web server and…

Here’s the problem:

I get a list of clients from a .Net web service to populate a HTML
select box.
I use the clients ID value as the value of the select box.
On test this is working without any problems. The integers are the exact
same IDs coming from the web service. They look something like this:
4108
I copied the same function to LIVE server which is running ubuntu Gutsy
so perhaps the latest versions of RAILS/MONGREL etc and now the ID
values look like this: -613465893

WEIRD!!

Especially weird as it’s calling the same web service
The ruby code hasn’t changed
The RAW output from the webservice reveals that the values are indeed
correct (4108)

So something’s happening in Ruby/Rails thats having trouble with these
ID values (but they’re just integers)

And I’m pissed because I have few days to make this LIVE and it looks as
if it might be a bug in RAILS/RUBY. Which means there’s probably not
alot I can about it…

Any help would be greatly appreciated…!

Compare the versions of Ruby. Your server may have a different version
(
1.8.4) instead of 1.8.6.

How are you consuming the web service? What library are you using?

On Nov 26, 2007 11:19 AM, Damian Mitchell
[email protected]

Also, wasn’t there some weird bug in 1.8.5 with numbers?

(I like how specific that was, don’t you? :))

–Jeremy

On Nov 26, 2007 1:16 PM, Brian H. [email protected] wrote:

On test this is working without any problems. The integers are the exact
The RAW output from the webservice reveals that the values are indeed

Posted via http://www.ruby-forum.com/.


http://www.jeremymcanally.com/

My books:
Ruby in Practice

My free Ruby e-book

My blogs:

http://www.rubyinpractice.com/

RAILS 1.2.5
RUBY 1.8.6

Same on both. The only difference appears to be the OS. My development
machine is running Mac OS X
and the web server is running a new install of Ubuntu Server 7.10
(Gutsy Gibbon)

Here’s how i’m consuming the web service (bear in mind this is working
perfect on development):

require ‘soap/wsdlDriver’

factory = SOAP::WSDLDriverFactory.new(“mywebservice”)
soap = factory.create_rpc_driver
clientslist = soap.GetClientsList(1)
client = clientslist[‘GetClientsListResult’]

@clients = []

client.client.each do |clientobj|

cl = [“#{clientobj.name}”, “#{clientobj.id}”]

@clients << cl

end

soap.reset_stream

And so I pass @clients to the view and render a select box:

<%= select(“mediaitem”, “mediaclient_id”, @clients, {:selected =>
@mediaitem.mediaclient_id.to_s} ) %>

Any help is much appreciated.

thanks

Damo

Brian H. wrote:

Compare the versions of Ruby. Your server may have a different version
(
1.8.4) instead of 1.8.6.

How are you consuming the web service? What library are you using?

On Nov 26, 2007 11:19 AM, Damian Mitchell
[email protected]

What about the version of gems? Same versions?

On Nov 27, 2007 3:38 AM, Damian Mitchell
[email protected]

gem -v = 0.9.4

Brian H. wrote:

What about the version of gems? Same versions?

On Nov 27, 2007 3:38 AM, Damian Mitchell
[email protected]

No, I meant the versions of the gems you are are using, like the SOAP
one.
Are those the same?

gem list

On Nov 27, 2007 9:45 AM, Damian Mitchell
[email protected]

Ah. Here you go:

The SOAP is not a gem it appears to be built in. I simply require
‘soap/wsdlDriver’
and it works (in development)

rails 1.2.5 (same)

I’ve kept my gem installs to a minimum. daemons, rmagick, mysql and
that’s about it really. Everything
else is out the box.
I’ve also tried this with different ruby servers like mongrel and
lighttpd. Both give the same results so
I don’t think it’s a server issue.

it’s really very odd and quite fustrating. i’m also new to ruby and
rails and this is my first LIVE big production project. I had such high
hopes for ruby and rails and really thought that deploying would be a
trivial matter…

To be fair it has been relatively painless until now.

Brian H. wrote:

No, I meant the versions of the gems you are are using, like the SOAP
one.
Are those the same?

gem list

On Nov 27, 2007 9:45 AM, Damian Mitchell
[email protected]

Jason, care to go further into depth with this warning? maybe why…

WARNING: Use soap4r 1.5.7 or lower, don’t use 1.5.8.

Jason

/Shawn

That’s fine but still doesn’t explain why moving from development to
production, using
the exact same code base and ruby/rails versions, converts the ID to a
completely different value…!

Same web service
Same SOAP implementation

=

completely different results for the ID field…!

Shawn A. wrote:

Jason, care to go further into depth with this warning? maybe why…

WARNING: Use soap4r 1.5.7 or lower, don’t use 1.5.8.

Jason

/Shawn

Prove it’s not the server. Run your app in production mode on your Mac.
If
it acts the same, then it’s something on your server and not in Rails.
:slight_smile:

On Nov 27, 2007 11:00 AM, Damian Mitchell
[email protected]

On Nov 27, 2007 11:15 AM, Damian Mitchell
[email protected]
wrote:

that’s about it really. Everything
To be fair it has been relatively painless until now.

On Nov 27, 2007 9:45 AM, Damian Mitchell
[email protected]


Posted via http://www.ruby-forum.com/.

Soap is built into the Ruby std lib, yes, but there is a soap4r gem
that’s a
bit more complete of an implementation.

WARNING: Use soap4r 1.5.7 or lower, don’t use 1.5.8.

Jason

Have just finished doing this:

A new install running in development mode on the LIVE server.

So I am now running everything in dev mode on both my MAC and LINUX
boxes.

Alas still returns a negative number on LINUX box instead of the actual
ID value which
is present and correct when you output using debug the results from the
web service.

So something must be happening in ruby or rails when I try to access the
value…

Brian H. wrote:

Prove it’s not the server. Run your app in production mode on your Mac.
If
it acts the same, then it’s something on your server and not in Rails.
:slight_smile:

On Nov 27, 2007 11:00 AM, Damian Mitchell
[email protected]