Implementing ruby webservice after having used wsdl2ruby

Discussion in 'Ruby' started by Vipin Vm, Jul 21, 2008.

  1. Vipin Vm

    Vipin Vm Guest

    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/.
    Vipin Vm, Jul 21, 2008
    #1
    1. Advertising

  2. 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
    Vassilis Rizopoulos, Jul 21, 2008
    #2
    1. Advertising

  3. Vipin Vm

    Vipin Vm Guest

    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/.
    Vipin Vm, Jul 21, 2008
    #3
  4. 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
    Vassilis Rizopoulos, Jul 22, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Friso Wiskerke

    Having trouble with implementing a SOAP header

    Friso Wiskerke, Jan 24, 2006, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    174
  2. Ben Giddings

    Problems with soap4r's wsdl2ruby.rb

    Ben Giddings, Jul 14, 2004, in forum: Ruby
    Replies:
    6
    Views:
    281
    NAKAMURA, Hiroshi
    Jul 20, 2004
  3. Jean-Hugues ROBERT
    Replies:
    0
    Views:
    188
    Jean-Hugues ROBERT
    Oct 25, 2004
  4. John Lam
    Replies:
    1
    Views:
    166
    NAKAMURA, Hiroshi
    May 29, 2005
  5. Catherine S.
    Replies:
    5
    Views:
    202
    Catherine S.
    Oct 25, 2010
Loading...

Share This Page