Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Implementing ruby webservice after having used wsdl2ruby (http://www.velocityreviews.com/forums/t851701-implementing-ruby-webservice-after-having-used-wsdl2ruby.html)

Vipin Vm 07-21-2008 06:10 AM

Implementing ruby webservice after having used wsdl2ruby
 
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
--
Posted via http://www.ruby-forum.com/.


Vassilis Rizopoulos 07-21-2008 09:39 AM

Re: Implementing ruby webservice after having used wsdl2ruby
 
Vipin Vm wrote:
> 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.-

--
http://www.braveworld.net/riva



Vipin Vm 07-21-2008 10:49 AM

Re: Implementing ruby webservice after having used wsdl2ruby
 
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 Rizopoulos wrote:
> Vipin Vm wrote:
>>
>> 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.-


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


Vassilis Rizopoulos 07-22-2008 08:27 AM

Re: Implementing ruby webservice after having used wsdl2ruby
 
Vipin Vm wrote:
> 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.-

--
http://www.braveworld.net/riva




All times are GMT. The time now is 08:05 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.