ComplexType is empty WSDL

Hello,
I have been building out some webservices on top of our MS SQL database.
Things have been great so far, but I have run into one problem. The
complex type in the WSDL for the User model is showing up empty. Here is
the wsdl.

  • <xsd:complexType name=“User”>
    <xsd:all />
    </xsd:complexType>

Here is the API def:
api_method :get_user, :expects => [{:user_id => :int}], :returns =>
[User]

Nothing really stands out as to why this is occuring. The other tables
are working fine. I know I could create a struct to return, but that is
extra work and not a real answer to the problem.

In ruby script\console, this works and returns a user object without any
problems:
u = User.find(:first)

Bump

I have found the problem. SQL Server has a reserved keyword for “user”.
In my model, I have set_table_name “[User]”. I am guessing the web api
is having problems with this because of the brackets? Not sure where to
go from here. Kent?

On 12/8/06, Jason B. [email protected] wrote:

I have found the problem. SQL Server has a reserved keyword for “user”.
In my model, I have set_table_name “[User]”. I am guessing the web api
is having problems with this because of the brackets? Not sure where to
go from here. Kent?

I don’t think it has anything to do with AWS, since AWS never access
your database directly, only via ActiveRecord. When the schema type is
generated for your model class, ActiveRecord::Base.columns method is
used to obtain names and types of elements that comprise your model.
So you should look for the solution to your problem in ActiveRecord
internals.


Kent

On 12/9/06, Jason B. [email protected] wrote:

I renamed the database table name and it works fine. This won’t work
though as the database schema is already tied to existing .NET
applications. Why if it were an ActiveRecord problem, would I still be
able to work with the model in console. AWS is the only thing not
working with this setup.

Fair enough. Can you run in the console the following

$ User.columns.each{|c| puts “#{c.name} #{c.type.inspect}”}; nil

and post here the results?

Thanks.


Kent

I renamed the database table name and it works fine. This won’t work
though as the database schema is already tied to existing .NET
applications. Why if it were an ActiveRecord problem, would I still be
able to work with the model in console. AWS is the only thing not
working with this setup.

Kent S. wrote:

On 12/8/06, Jason B. [email protected] wrote:

I have found the problem. SQL Server has a reserved keyword for “user”.
In my model, I have set_table_name “[User]”. I am guessing the web api
is having problems with this because of the brackets? Not sure where to
go from here. Kent?

I don’t think it has anything to do with AWS, since AWS never access
your database directly, only via ActiveRecord. When the schema type is
generated for your model class, ActiveRecord::Base.columns method is
used to obtain names and types of elements that comprise your model.
So you should look for the solution to your problem in ActiveRecord
internals.


Kent

http://www.datanoise.com

On Dec 9, 9:53 pm, Jason B. [email protected] wrote:

I renamed the database table name and it works fine. This won’t work
though as the database schema is already tied to existing .NET
applications. Why if it were an ActiveRecord problem, would I still be
able to work with the model in console. AWS is the only thing not
working with this setup.

Can you use a View in SQL Server with a different name that just maps
directly to the Users table?

That is what I did as a work around.

Larry W. wrote:

On Dec 9, 9:53 pm, Jason B. [email protected] wrote:

I renamed the database table name and it works fine. This won’t work
though as the database schema is already tied to existing .NET
applications. Why if it were an ActiveRecord problem, would I still be
able to work with the model in console. AWS is the only thing not
working with this setup.

Can you use a View in SQL Server with a different name that just maps
directly to the Users table?

$ User.columns.each{|c| puts “#{c.name} #{c.type.inspect}”}; nil
UserId :integer
UserName :string
Password :string
FirstName :string
LastName :string
Disabled :boolean
Email :string
JobTitle :string
CanSign :boolean
WorksFor :integer
Keyword :string
PrivateKey :string
PublicKey :string
CreatedOn :datetime
ModifiedOn :datetime
=> nil

Kent S. wrote:

On 12/9/06, Jason B. [email protected] wrote:

I renamed the database table name and it works fine. This won’t work
though as the database schema is already tied to existing .NET
applications. Why if it were an ActiveRecord problem, would I still be
able to work with the model in console. AWS is the only thing not
working with this setup.

Fair enough. Can you run in the console the following

$ User.columns.each{|c| puts “#{c.name} #{c.type.inspect}”}; nil

and post here the results?

Thanks.


Kent

http://www.datanoise.com

Scratch that one, I still had it mapped to the view :wink:

It’s not returning any of the column names, just

=> nil

Jason B. wrote:

$ User.columns.each{|c| puts “#{c.name} #{c.type.inspect}”}; nil
UserId :integer
UserName :string
Password :string
FirstName :string
LastName :string
Disabled :boolean
Email :string
JobTitle :string
CanSign :boolean
WorksFor :integer
Keyword :string
PrivateKey :string
PublicKey :string
CreatedOn :datetime
ModifiedOn :datetime
=> nil

Kent S. wrote:

On 12/9/06, Jason B. [email protected] wrote:

I renamed the database table name and it works fine. This won’t work
though as the database schema is already tied to existing .NET
applications. Why if it were an ActiveRecord problem, would I still be
able to work with the model in console. AWS is the only thing not
working with this setup.

Fair enough. Can you run in the console the following

$ User.columns.each{|c| puts “#{c.name} #{c.type.inspect}”}; nil

and post here the results?

Thanks.


Kent

http://www.datanoise.com

On 12/11/06, Jason B. [email protected] wrote:

Scratch that one, I still had it mapped to the view :wink:

It’s not returning any of the column names, just

=> nil

Ok, that’s the problem. ActiveRecord doesn’t discover table columns
correctly. You should open a ticket for ActiveRecord with this
particular example attached.


Kent

Done, Thanks a million Kent.

Kent S. wrote:

Ok, that’s the problem. ActiveRecord doesn’t discover table columns
correctly. You should open a ticket for ActiveRecord with this
particular example attached.


Kent

http://www.datanoise.com

http://dev.rubyonrails.org/ticket/6818