Implementing ruby webservice after having used wsdl2ruby

V

Vipin Vm

Hi All,

One of our client had created a WSDL in ASP and sent it over asking us
to implement the same structure in ruby. I created server and client
files (4 files each) using these commands

wsdl2ruby.rb –wsdl /home/Test.wsdl –type server –force
wsdl2ruby.rb –wsdl /home/Test.wsdl –type client –force

My questions are :-

1. how can i create WSDLs automatically like in AWS -
http://localhost:3000/test/wsdl/
?
(saw this post but not able to make it
http://www.ruby-forum.com/topic/145717#704459)

2. Am able to run the server app. But when am sending the request from
client its shows error like
" ERROR -- Test: GET request not allowed " (am getting this same error
when i try http://localhost:3000test/wsdl/)

3. Am calling my client like this
driver = SOAP::WSDLDriverFactory.new(url).create_rpc_driver
result = driver.method(arg)

but am getting an error like this :-
RuntimeError (Unexpected response: #<HTTP::Message::Headers:0x23d2f28
@request_via_proxy=nil, @is_request=false, @response_status_code=405,
@body_charset=nil, @request_query=nil, @request_method=nil,
@header_item=[["Connection", "close"], ["Date", "Sat, 19 Jul 2008
09:26:32 GMT"], ["Content-Type", "text/html"], ["Server", "WEBrick/
1.3.1 (Ruby/1.8.6/2008-03-03)"], ["Content-Length", "297"], ["Allow",
"POST"]], @body_type=nil, @request_uri=nil, @body_date=nil,
@http_version="1.1", @reason_phrase="Method Not Allowed ",
@chunked=false, @body_size=0>):
/Library/Ruby/Gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:
2058:in `follow_redirect'
/Library/Ruby/Gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:
1890:in `get_content'
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/
importer.rb:73:in `fetch'
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/
importer.rb:36:in `import'
................
................
................

i have already added these lines in my env.rb

require 'rubygems'
gem 'soap4r'

then what could be wrong?

am using
ruby - 1.8.6
soap4r - 1.5.8
mac-os leopard

Thanks in advance :)

Vipin
 
V

Vassilis Rizopoulos

Vipin said:
Hi All,

One of our client had created a WSDL in ASP and sent it over asking
us to implement the same structure in ruby. I created server and
client files (4 files each) using these commands

wsdl2ruby.rb –wsdl /home/Test.wsdl –type server –force wsdl2ruby.rb
–wsdl /home/Test.wsdl –type client –force

My questions are :-

1. how can i create WSDLs automatically like in AWS -
http://localhost:3000/test/wsdl/ ? (saw this post but not able to
make it http://www.ruby-forum.com/topic/145717#704459)

2. Am able to run the server app. But when am sending the request
from client its shows error like " ERROR -- Test: GET request not
allowed " (am getting this same error when i try
http://localhost:3000test/wsdl/)

3. Am calling my client like this driver =
SOAP::WSDLDriverFactory.new(url).create_rpc_driver result =
driver.method(arg)

but am getting an error like this :- RuntimeError (Unexpected
response: #<HTTP::Message::Headers:0x23d2f28 @request_via_proxy=nil,
@is_request=false, @response_status_code=405, @body_charset=nil,
@request_query=nil, @request_method=nil, @header_item=[["Connection",
"close"], ["Date", "Sat, 19 Jul 2008 09:26:32 GMT"], ["Content-Type",
"text/html"], ["Server", "WEBrick/ 1.3.1 (Ruby/1.8.6/2008-03-03)"],
["Content-Length", "297"], ["Allow", "POST"]], @body_type=nil,
@request_uri=nil, @body_date=nil, @http_version="1.1",
@reason_phrase="Method Not Allowed ",
The headers show you that only POST methods are allowed (the

["Allow","POST"]).
From your tests and what you write I guess the RPC driver is making GET
requests.

You'll have to check the generated code and/or twiddle the properties
when you generate your driver.
Without code and without looking into the soap4r stuff I can't say much more
Cheers,
V.-
 
V

Vipin Vm

Hi Vassilis Rizopoulos,

As i mentioned earlier... i have created 4 sever & client files from a
WSDL. Am able to start my StandaloneServer app. But the client is not
working. am getting this error

/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/streamHandler.rb:268:in
`send_post': 404: Not Found (SOAP::HTTPStreamError)
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/streamHandler.rb:172:in
`send'
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb:179:in
`route'
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb:143:in
`call'
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb:181:in
`call'

is there any way to see the WSDLs when we use wsdl2ruby?

thanx :)

Vipin


Vassilis said:
Vipin said:
SOAP::WSDLDriverFactory.new(url).create_rpc_driver result =
@reason_phrase="Method Not Allowed ",
The headers show you that only POST methods are allowed (the

["Allow","POST"]).
From your tests and what you write I guess the RPC driver is making GET
requests.

You'll have to check the generated code and/or twiddle the properties
when you generate your driver.
Without code and without looking into the soap4r stuff I can't say much
more
Cheers,
V.-
 
V

Vassilis Rizopoulos

Vipin said:
Hi Vassilis Rizopoulos,

As i mentioned earlier... i have created 4 sever & client files from a
WSDL. Am able to start my StandaloneServer app. But the client is not
working. am getting this error

/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/streamHandler.rb:268:in
`send_post': 404: Not Found (SOAP::HTTPStreamError)
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/streamHandler.rb:172:in
`send'
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb:179:in
`route'
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/proxy.rb:143:in
`call'
from
/Library/Ruby/Gems/1.8/gems/soap4r-1.5.8/lib/soap/rpc/driver.rb:181:in
`call'

is there any way to see the WSDLs when we use wsdl2ruby?
I can't really help you with the wsdl's since I avoid them like the
plague - too much work for too little benefit.
From the error above it seems like the client is looking for the wrong
URL (that 404 HTTP return code there)
If I was you I'd go in there with the debugger or with a few log
messages and figure out which URL is called and how.
Cheers,
V.-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top