Xmlrpc problems

Hi!

I have some trouble getting xmlrpc to work. When I try to run
introspection sample I get:
c:/program/ruby/lib/ruby/site_ruby/1.6/xmlrpc/client.rb:496:in
do_rpc': HTTP-Error: 500 Internal Server Error (RuntimeError) from c:/program/ruby/lib/ruby/site_ruby/1.6/xmlrpc/client.rb:382:incall2’
from c:/program/ruby/lib/ruby/site_ruby/1.6/xmlrpc/client.rb:372:in
`call’
from G:\Ruby\BlogClient.rb:5

On the server I get:
[Sat Jun 29 01:35:39 2002] HttpServer 127.0.0.1:8070 start
[Sat Jun 29 01:36:22 2002] HttpServer 127.0.0.1:8070 client:4631
caelum<127.0.0.1> connect
[Sat Jun 29 01:36:22 2002] HttpServer 127.0.0.1:8070 client:4631
disconnect

What is the problem?

I use:
Windows 2000
Ruby 1.66
xmlrpc4r 1.7.11

Thanks in advance,
Jonas

Your xmlrpc server must support introspection.

If it is a Ruby xmlrpc server, you have to explicitly
make introspection available. Do this by calling

server.add_introspection

Alternatively you can make introspection the default by
setting the flag ENABLE_INTROSPECTION in config.rb.

Regards,

Michael

···

On Sat, Jun 29, 2002 at 08:47:16AM +0900, Jonas Bengtsson wrote:

Hi!

I have some trouble getting xmlrpc to work. When I try to run
introspection sample I get:
c:/program/ruby/lib/ruby/site_ruby/1.6/xmlrpc/client.rb:496:in
do_rpc': HTTP-Error: 500 Internal Server Error (RuntimeError) from c:/program/ruby/lib/ruby/site_ruby/1.6/xmlrpc/client.rb:382:in call2’
from c:/program/ruby/lib/ruby/site_ruby/1.6/xmlrpc/client.rb:372:in
`call’
from G:\Ruby\BlogClient.rb:5

On the server I get:
[Sat Jun 29 01:35:39 2002] HttpServer 127.0.0.1:8070 start
[Sat Jun 29 01:36:22 2002] HttpServer 127.0.0.1:8070 client:4631
caelum<127.0.0.1> connect
[Sat Jun 29 01:36:22 2002] HttpServer 127.0.0.1:8070 client:4631
disconnect

What is the problem?

Hello Michael,

Thanks for your answer! Now I got it to work. But I have another
problem – I want my method to reply something like this:

<?xml version="1.0" encoding="ISO-8859-1"?> nickname aa userid 11 url http://www.aaa.com email aaa@aaa.com lastname aaa firstname aaa

I tried to return a hash, but that didn’t produce the right reply.

Does anybody have any suggestions?

···

Best regards,
Jonas

I always thought that record would stand until it was broken.

  • Yogi Berra

Saturday, June 29, 2002, 12:43:37 PM, you wrote:

Your xmlrpc server must support introspection.

If it is a Ruby xmlrpc server, you have to explicitly
make introspection available. Do this by calling

server.add_introspection

Alternatively you can make introspection the default by
setting the flag ENABLE_INTROSPECTION in config.rb.

Regards,

Michael

Hmm, how does the result using a hash look like?
It should look similar except perhaps the order in which the member’s
occure, because you cannot specify the order using hashs!

If you want to preserve the ordering of members, use a Struct instead,
as shown below:

MyRecord = Struct.new(“MyRecord”, :nickname, :userid, :url, :email,
:lastname, :firstname)

aRecord = MyRecord.new(“aa”, …)

return aRecord

Regards,

Michael

···

On Sat, Jun 29, 2002 at 09:16:14PM +0900, Jonas Bengtsson wrote:

Hello Michael,

Thanks for your answer! Now I got it to work. But I have another
problem – I want my method to reply something like this:

<?xml version="1.0" encoding="ISO-8859-1"?> nickname aa userid 11 url http://www.aaa.com email aaa@aaa.com lastname aaa firstname aaa

I tried to return a hash, but that didn’t produce the right reply.

Hello Michael,

When I printed the returned variable in the client I got something
like:
userid1emailaaa@aaa.comurlwww.aaa.comlastnameaaafirstnameaaanicknameaaa

It was basically the same as I got when using a hash.

Is there any way to see the ‘raw’ reply from the xmlrpc server (i.e.
the actual xml)?

···


Best regards,
Jonas

Take everything you like seriously, except yourselves.

  • Rudyard Kipling

Saturday, June 29, 2002, 4:08:42 PM, you wrote:

Hmm, how does the result using a hash look like?
It should look similar except perhaps the order in which the member’s
occure, because you cannot specify the order using hashs!

If you want to preserve the ordering of members, use a Struct instead,
as shown below:

MyRecord = Struct.new(“MyRecord”, :nickname, :userid, :url, :email,
:lastname, :firstname)

aRecord = MyRecord.new(“aa”, …)

return aRecord

Regards,

Michael

Hello Michael,

When I printed the returned variable in the client I got something
like:
userid1emailaaa@aaa.comurlwww.aaa.comlastnameaaafirstnameaaanicknameaaa

If you’re using “print variable”, try “p variable” or “print variable.inspect”
instead.

It was basically the same as I got when using a hash.

Is there any way to see the ‘raw’ reply from the xmlrpc server (i.e.
the actual xml)?

Not directly or with modifications.

Either change method call2 in file lib/client.rb, and output variable
data before passing it to “parser().parseMethodResponse”, or alternatively
use samples/monitor/monitor.rb to show all data sent to and received from
the server.

Regards,

Michael

···

On Sun, Jun 30, 2002 at 12:37:51AM +0900, Jonas Bengtsson wrote:

Hello Michael,

Saturday, June 29, 2002, 6:51:25 PM, you wrote:

If you’re using “print variable”, try “p variable” or “print variable.inspect”
instead.

Ahh, thanks!

Is there any way to see the ‘raw’ reply from the xmlrpc server (i.e.
the actual xml)?

Not directly or with modifications.

Either change method call2 in file lib/client.rb, and output variable
data before passing it to “parser().parseMethodResponse”, or alternatively
use samples/monitor/monitor.rb to show all data sent to and received from
the server.

I found another proxy that did the same thing as monitor and that did
the trick.

···


Best regards,
Jonas

Man is the Only Animal that Blushes. Or needs to.
Mark Twain