[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Implementing ruby webservice after having used wsdl2ruby

Vipin Vm

7/21/2008 6:10:00 AM

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-...topic/145...)

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-....

3 Answers

Vassilis Rizopoulos

7/21/2008 9:40:00 AM

0

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/145...)
>
> 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.braveworl...


Vipin Vm

7/21/2008 10:49:00 AM

0

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-....

Vassilis Rizopoulos

7/22/2008 8:27:00 AM

0

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.braveworl...