Can not generate WSDL

Hi,

I am new to Rails and just play around with the Action Web Service.

when I run “script/generator web_service test method1”, I got a
test_controller and test_api, in which there is a empty method1
definition and I can get wsdl through
http://localhost:3000/test/service.wsdl

But after I add another method call “test2” as below

in test_api.rb I added

api_method(:test2, :returns => [[:int]])

in test_controller.rb I added

def test2
    [1, 2, 3, 4, 5]
end

I can no longer get wsdl generated, instead I got

Template is missing

Missing template ./script/…/config/…/app/views/test/wsdl.rhtml

Does anyone know what was wrong?

Thanks,

This confused me at first because you are using a test_controller.rb,
but this is not actually a unit or functional test. But, setting that
aside.

You created a new controller method named test2. If you don’t specify
a specific view for this controller method, Rails will assume that the
view is located in test2.rhtml.

Do you have a test2.rhtml file under your views --> test folder? If
not then this is why you are getting the “no template” error.

On another note. Think about whether your really must use SOAP web
services. If you are building this service for your own use then you
may be much happier using a REST web service instead. I have pretty
extensive experience with both, and I now choose REST over SOAP unless
the project specs mandate a SOAP web service. And that only when I’m
providing the service to a client requiring SOAP.

On Apr 16, 2:11 am, anakintang [email protected]

Robert W. wrote:

This confused me at first because you are using a test_controller.rb,
but this is not actually a unit or functional test. But, setting that
aside.

You created a new controller method named test2. If you don’t specify
a specific view for this controller method, Rails will assume that the
view is located in test2.rhtml.

Do you have a test2.rhtml file under your views --> test folder? If
not then this is why you are getting the “no template” error.

On another note. Think about whether your really must use SOAP web
services. If you are building this service for your own use then you
may be much happier using a REST web service instead. I have pretty
extensive experience with both, and I now choose REST over SOAP unless
the project specs mandate a SOAP web service. And that only when I’m
providing the service to a client requiring SOAP.

On Apr 16, 2:11 am, anakintang [email protected]

But look at the error message which says “Missing template
./script/…/config/…/app/views/test/wsdl.rhtml” it’s not looking for
test2.rhtml. And also it’s just unreasonable to need extra template to
make rails generate wsdl.

Right?

I reply this myself. In my case it was a bad RoR installation.
I uninstalled rails and ruby entirely and reinstalled it and
then it worked fine.

Just in case you encounter the same problem any time.

Peter

Peter B. wrote:

I just started with ruby on rails because ActionWebService had been
recommended to publish SOAP Services that can be connected by third
party products like .NET.

I got almost the exact same problem.In my case I implemented a very
simple
controller:

class LittlemathController < ApplicationController
wsdl_service_name ‘Littlemath’
web_service_scaffold :invoke

def useful_sum(parameter1, parameter2)
return parameter1 + parameter2
end
end

and a simple api:

class LittlemathApi < ActionWebService::API::Base
api_method :useful_sum, :expects => [:int, :int], :returns => [:int]
end

The service is working as expected on
http://localhost:3000/littlemath/invoke

but http://localhost:3000/littlemath/service.wsdl returns:

Template is missing

Missing template script/…/config/…/app/views/littlemath/wsdl.rhtml

Did you find out the reason for that?

Thank you for any help or advice.

Greetings

Peter

Peter B. wrote:

I reply this myself. In my case it was a bad RoR installation.
I uninstalled rails and ruby entirely and reinstalled it and
then it worked fine.

Just in case you encounter the same problem any time.

Peter

I’ve got the same problem right now…

This is quite worrying, I created lot of webservices for my app, and it
always worked.
But suddenly, after updating my gems… would not display wsdl file
anymore…

geez

Fred P. wrote:

Peter B. wrote:

I reply this myself. In my case it was a bad RoR installation.
I uninstalled rails and ruby entirely and reinstalled it and
then it worked fine.

Just in case you encounter the same problem any time.

Peter

I’ve got the same problem right now…

This is quite worrying, I created lot of webservices for my app, and it
always worked.
But suddenly, after updating my gems… would not display wsdl file
anymore…

geez

Hmmm this is actually disturbing. To be honest I did the same thing in
the first place. I installed gems after I installed Ruby and Rails.
Later I noticed, that gems are included in the distribution of ruby and
rails.
I use gentoo linux and because everything failed I reenstalled Ruby and
Rails. Very simply emerge ruby; emerge rails and blub it worked. No gems
nothing.
Probably there is some kind of incompatibility to the gems availabe
independent to the package. Might be a bad guess.

Peter

I figured out this problem occures when loading soap4r after rubygems
in boot.rb:
require ‘rubygems’
gem ‘soap4r’

If you comment out the gem ‘soap4r’, you’ll be able to get your wsdl
file.
I can’t remember why we need to load soap4r after actionwebservice
exactly, but I know there are some compatibility problems between the
two.
I am not sure if that still occures in latest versions. That would
need to be checked.

Fred

On 9 oct, 09:26, Peter B. [email protected]

I just started with ruby on rails because ActionWebService had been
recommended to publish SOAP Services that can be connected by third
party products like .NET.

I got almost the exact same problem.In my case I implemented a very
simple
controller:

class LittlemathController < ApplicationController
wsdl_service_name ‘Littlemath’
web_service_scaffold :invoke

def useful_sum(parameter1, parameter2)
return parameter1 + parameter2
end
end

and a simple api:

class LittlemathApi < ActionWebService::API::Base
api_method :useful_sum, :expects => [:int, :int], :returns => [:int]
end

The service is working as expected on
http://localhost:3000/littlemath/invoke

but http://localhost:3000/littlemath/service.wsdl returns:

Template is missing

Missing template script/…/config/…/app/views/littlemath/wsdl.rhtml

Did you find out the reason for that?

Thank you for any help or advice.

Greetings

Peter

anakintang wrote:

Robert W. wrote:

This confused me at first because you are using a test_controller.rb,
but this is not actually a unit or functional test. But, setting that
aside.

You created a new controller method named test2. If you don’t specify
a specific view for this controller method, Rails will assume that the
view is located in test2.rhtml.

Do you have a test2.rhtml file under your views --> test folder? If
not then this is why you are getting the “no template” error.

On another note. Think about whether your really must use SOAP web
services. If you are building this service for your own use then you
may be much happier using a REST web service instead. I have pretty
extensive experience with both, and I now choose REST over SOAP unless
the project specs mandate a SOAP web service. And that only when I’m
providing the service to a client requiring SOAP.

On Apr 16, 2:11 am, anakintang [email protected]

But look at the error message which says “Missing template
./script/…/config/…/app/views/test/wsdl.rhtml” it’s not looking for
test2.rhtml. And also it’s just unreasonable to need extra template to
make rails generate wsdl.

Right?

In case anyone else comes across this again, I had a similar problem
when trying to create a wsdl and my browser telling me a template was
missing.

If you add the following to config/environments.rb

module SOAP

SOAPNamespaceTag = ‘env’
XSDNamespaceTag = ‘xsd’
XSINamespaceTag = ‘xsi’

end

Reboot server and see if it works. Did for me :wink:

I’m running on:
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.2
Active Record version 2.3.2
Action Pack version 2.3.2
Active Resource version 2.3.2
Action Mailer version 2.3.2
Active Support version 2.3.2

datanoise-actionwebservice (2.3.2)

It also happens with rails-2.1.0 + soap4r-1.5.8 +
datanoise-actionwebservice-2.1.0

Fred P. wrote:

I figured out this problem occures when loading soap4r after rubygems
in boot.rb:
require ‘rubygems’
gem ‘soap4r’

If you comment out the gem ‘soap4r’, you’ll be able to get your wsdl
file.
I can’t remember why we need to load soap4r after actionwebservice
exactly, but I know there are some compatibility problems between the
two.
I am not sure if that still occures in latest versions. That would
need to be checked.

Fred

On 9 oct, 09:26, Peter B. [email protected]