WWDataServices Web Service Authentication

5 views
Skip to first unread message

BillC

unread,
Oct 21, 2008, 5:54:12 PM10/21/08
to WebWidgetry Users
Wanted to know if the generated web service has any way to
authenticate client calls ... In other words is there a way to login
and have authenticated sessions built-in to the generated service. If
so can you give us an idea of how this is achieved. If not whats the
best way to achieve this with the generated services?

Ryan Gahl

unread,
Oct 21, 2008, 6:10:32 PM10/21/08
to webwidge...@googlegroups.com
Yes it's possible, and is a topic we will go into detail on in an upcoming blog/tutorial video. We wish we could move faster for you guys on all this stuff :) Now that a beta version of both tools are out, we'll be moving to bug fixing + documentation/training material...

On a high level, what authentication we've found easiest to use is .NET Membership API, but whatever scheme you want to use should be ok. Then, on the back end, you create/edit the global.asax file to hook into the BeginRequest event (sorry if that's not exactly correct, going from memory right now) to check the passed cookies (if you make you're own client you'll have to pass cookie information, but if you use WW.Interface we do that for you automatically)... and make sure the user is logged in.

There is a little more to it than that (that was definitely high level)... but yes, it's possible, yes we'll explain how via code examples fairly soon, and yes we intend to release a new version of our tools that make that whole process push-button...
--
Ryan Gahl
Manager, Senior Software Engineer
Nth Penguin, LLC
http://www.nthpenguin.com
--
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-920-574-2218
Blog: http://www.someElement.com
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

Bill Chikirivao

unread,
Oct 21, 2008, 6:38:10 PM10/21/08
to webwidge...@googlegroups.com
Ryan,
 
Thanks for the response. Just Installed the new download of your wwdataservices and ran the installation ... And now the WWDataServices no longer appears in my Visual Studio 2008 Tools Menu.  I can create the project as before but I can no longer access the WWdataservice in Tools menu.  Not sure if I was suppose to uninstall the previous version before installing the new one but then again I did not see anything in my add/remove programs menu to uninstall wwdataservice.  I just installed the version that I downloaded from your site today ... I also tried to revert back to the previous version ...but now that no longer lists the wwdataservice in the Tools menu either ....
 
Please help as i was in the middle of doing a demo project ...
 
Thanks.
 
BillC

Ryan Gahl <ryan...@nthpenguin.com> wrote:

Ryan Gahl

unread,
Oct 21, 2008, 6:40:42 PM10/21/08
to webwidge...@googlegroups.com
eek (another bug).

Try this:
  • Right click on your Visual Studio shortcut (and if you don't launch it from a shortcut, let's create one)... and click "Properties".
  • At the end of the "Target" value, enter "/resetaddin WWPlugin.Connect"
  • Click "OK" - and now run Visual Studio... see if WW.DataServices behaves better now

BillC

unread,
Oct 21, 2008, 8:26:38 PM10/21/08
to WebWidgetry Users
After installation and now trying to generate the code, I get these
two errors on each model:

(my namespace is Land.Data)

'Land.Data.DataService' does not contain a definition for
'GetInstance'
'Land.Data.DataService' does not contain a definition for 'Providers'


Thanks.

BillC

On Oct 21, 5:40 pm, "Ryan Gahl" <ryan.g...@nthpenguin.com> wrote:
> eek (another bug).
>
> Try this:
>
>    - Right click on your Visual Studio shortcut (and if you don't launch it
>    from a shortcut, let's create one)... and click "Properties".
>    - At the end of the "Target" value, enter "/resetaddin WWPlugin.Connect"
>    - Click "OK" - and now run Visual Studio... see if WW.DataServices
>    behaves better now
>
>
>
>
>
> On Tue, Oct 21, 2008 at 5:38 PM, Bill Chikirivao <bi...@2nexo.com> wrote:
> > Ryan,
>
> > Thanks for the response. Just Installed the new download of your
> > wwdataservices and ran the installation ... And now the WWDataServices no
> > longer appears in my Visual Studio 2008 Tools Menu.  I can create the
> > project as before but I can no longer access the WWdataservice in Tools
> > menu.  Not sure if I was suppose to uninstall the previous version before
> > installing the new one but then again I did not see anything in my
> > add/remove programs menu to uninstall wwdataservice.  I just installed the
> > version that I downloaded from your site today ... I also tried to revert
> > back to the previous version ...but now that no longer lists the
> > wwdataservice in the Tools menu either ....
>
> > Please help as i was in the middle of doing a demo project ...
>
> > Thanks.
>
> > BillC
>
> > *Ryan Gahl <ryan.g...@nthpenguin.com>* wrote:
>
> > Yes it's possible, and is a topic we will go into detail on in an upcoming
> > blog/tutorial video. We wish we could move faster for you guys on all this
> > stuff :) Now that a beta version of both tools are out, we'll be moving to
> > bug fixing + documentation/training material...
>
> > On a high level, what authentication we've found easiest to use is .NET
> > Membership API, but whatever scheme you want to use should be ok. Then, on
> > the back end, you create/edit the global.asax file to hook into the
> > BeginRequest event (sorry if that's not exactly correct, going from memory
> > right now) to check the passed cookies (if you make you're own client you'll
> > have to pass cookie information, but if you use WW.Interface we do that for
> > you automatically)... and make sure the user is logged in.
>
> > There is a little more to it than that (that was definitely high level)...
> > but yes, it's possible, yes we'll explain how via code examples fairly soon,
> > and yes we intend to release a new version of our tools that make that whole
> > process push-button...
>
> > On Tue, Oct 21, 2008 at 4:54 PM, BillC <bchikiri...@gmail.com> wrote:
>
> >> Wanted to know if the generated web service has any way to
> >> authenticate client calls ... In other words is there a way to login
> >> and have authenticated sessions built-in to the generated service.  If
> >> so can you give us an idea of how this is achieved.  If not whats the
> >> best way to achieve this with the generated services?
>
> > --
> > Ryan Gahl
> > Manager, Senior Software Engineer
> > Nth Penguin, LLC
> >http://www.nthpenguin.com
> > --
> > WebWidgetry.com / MashupStudio.com
> > Future Home of the World's First Complete Web Platform
> > --
> > Inquire: 1-920-574-2218
> > Blog:http://www.someElement.com<http://www.someelement.com/>
> > LinkedIn Profile:http://www.linkedin.com/in/ryangahl
>
> --
> Ryan Gahl
> Manager, Senior Software Engineer
> Nth Penguin, LLChttp://www.nthpenguin.com
> --
> WebWidgetry.com / MashupStudio.com
> Future Home of the World's First Complete Web Platform
> --
> Inquire: 1-920-574-2218
> Blog:http://www.someElement.com
> LinkedIn Profile:http://www.linkedin.com/in/ryangahl- Hide quoted text -
>
> - Show quoted text -

Ryan Gahl

unread,
Oct 21, 2008, 8:44:34 PM10/21/08
to webwidge...@googlegroups.com
Did you create a new project for this? Or did you re-generate over the top of an existing one?
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

BillC

unread,
Oct 21, 2008, 8:58:29 PM10/21/08
to WebWidgetry Users
I created a new project. Does the name you give to the provider or
the db connection have to be the same name as the dabase? In the
example they use Northwind ...
> > > LinkedIn Profile:http://www.linkedin.com/in/ryangahl-Hide quoted text -

Ryan Gahl

unread,
Oct 21, 2008, 9:01:21 PM10/21/08
to webwidge...@googlegroups.com
No... that shouldn't matter. Hmm... Can you please send a screenshot of your Visual Studio, with WW.DataServices visible, and the active provider selected in the tree so that we can see the properties for that?
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

BillC

unread,
Oct 21, 2008, 9:12:04 PM10/21/08
to WebWidgetry Users
Here are the lines with the problems:

TableSchema.Table schema = new TableSchema.Table("Area",
TableType.Table, DataService.GetInstance("Land"));
DataService.Providers["Land"].AddSchema("Area",schema);

In both cases the DataService does not contain DataService.Providers
and DataService.GetInstance ...

I suspect I am missing a reference to a dll or an import statement ...

Thanks.

BillC
> > > LinkedIn Profile:http://www.linkedin.com/in/ryangahl-Hide quoted text -

Ryan Gahl

unread,
Oct 21, 2008, 9:13:26 PM10/21/08
to webwidge...@googlegroups.com
And how about that screenshot?

:)
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

Bill Chikirivao

unread,
Oct 21, 2008, 9:45:08 PM10/21/08
to webwidge...@googlegroups.com
here is the screenshot
 
Thanks
vsscreenshot.jpg

Ryan Gahl

unread,
Oct 22, 2008, 12:26:04 AM10/22/08
to webwidge...@googlegroups.com
Sorry I didn't get right back to you (very busy)... but I just had an epiphany! I tested this locally too, so I'm pretty sure this is your issue.

Try to create a new project for the same database... but make your generated namespace not end in ".Data"

What's happening is the resulting generated object names are conflicting with internal stuff if you end your namespace with certain words. We'll have to hunt them down on our end and figure out a nice way to get around this issue...

For now, use something like "Land.DAL" or ".DB" maybe?

That _should_ get you up and running (finally).

BillC

unread,
Oct 22, 2008, 2:16:19 AM10/22/08
to WebWidgetry Users
Yes, that was the issue.

Thanks for your help.

Regards,

BillC

On Oct 21, 11:26 pm, "Ryan Gahl" <ryan.g...@nthpenguin.com> wrote:
> Sorry I didn't get right back to you (very busy)... but I just had an
> epiphany! I tested this locally too, so I'm pretty sure this is your issue.
>
> Try to create a new project for the same database... but make your generated
> namespace not end in ".Data"
>
> What's happening is the resulting generated object names are conflicting
> with internal stuff if you end your namespace with certain words. We'll have
> to hunt them down on our end and figure out a nice way to get around this
> issue...
>
> For now, use something like "Land.DAL" or ".DB" maybe?
>
> That _should_ get you up and running (finally).
>
>
>
>
>
> On Tue, Oct 21, 2008 at 8:45 PM, Bill Chikirivao <bi...@2nexo.com> wrote:
> > here is the screenshot
>
> > Thanks
>
> > *Ryan Gahl <ryan.g...@nthpenguin.com>* wrote:
>
> > And how about that screenshot?
>
> > :)
>
> >> > > > LinkedIn Profile:http://www.linkedin.com/in/ryangahl-Hidequoted
> >> text -
>
> >> > > > - Show quoted text -
>
> >> > --
> >> > Ryan Gahl
> >> > Manager, Senior Software Engineer
> >> > Nth Penguin, LLChttp://www.nthpenguin.com
> >> > --
> >> > WebWidgetry.com / MashupStudio.com
> >> > Future Home of the World's First Complete Web Platform
> >> > --
> >> > Inquire: 1-920-574-2218

Ryan Gahl

unread,
Oct 22, 2008, 2:22:01 AM10/22/08
to webwidge...@googlegroups.com
Not a problem, Bill... I'm just glad we could get you going here :)

Let us know if you run into any other snags (this one was a nasty little bugger, we'll be sure to squash it for our next release).
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

Bill Chikirivao

unread,
Oct 22, 2008, 5:41:28 AM10/22/08
to webwidge...@googlegroups.com
Using the generated data services from  a custom client (e.g silverlight) ...  does the generated service proxy have object definitions to allow us to create objects to pass as arguments to the generated service.  I can see the expected xml soap msg that is expected to be passed as parameters ...  I am supposing we use some objects defined in the proxy to build those argument parameters ... correct?  ... I saw how that can be done with your javascript sample in your blog ... but using C# in a custom client how is that functionality expossed??  And I know in vanilla basic subsonic projects I can easily create queries using the generated objects ... just wondering how this is exposed in your generated web service?


Thanks.

BillC



Ryan Gahl <ryan...@nthpenguin.com> wrote:

Mark Nickel

unread,
Oct 22, 2008, 5:08:11 PM10/22/08
to webwidge...@googlegroups.com
BillC,

Just want to make sure that I understand your wording...

Are you desiring to use C# to access the web services that have been generated by WW.Dataservices from your database?  Or are you looking to use, as you've said, the vanilla Subsonic objects.

Are you specifically looking to access the WW.Dataservices web services from silverlight?

In general, the webservices that get created in the *.asmx files are "normal" Services...  But in addition to those SOAP-based methods, there is a set of additional methods that end in JSON.  These methods will accept a JSON object that is of the same schema as the structure of object you wish to create...

For instance lets say you have a User table with two columns: firstName, lastName, this will generate a User object having firstName and lastName as properties.  This will also create several web service methods called:  CreateUser and CreateUserJSON.

with CreateUserJSON, you can use a JSON object instead of the XML'ized version that would normally be necessary.

So, in JSON the User might look something like this:


{
   "firstName": "Hello",
   "lastName": "World"
}


Now, admittedly, I'm a newbie in silverlight so I can't say with 100% certainty how it handles accessing web services from within silverlight, but I'm assuming that it has some capability to invoke a webservice.  If you serialize your silverlight objects to JSON and pass that as a parameter to the Create*JSON methods, all should be well.

Beyond that stuff you can bind to the webservice via normal .NET proxy binding. The return type for all of our methods is "ServiceCallResult" which has some metadata about the call, and a "Result" property which is the actual data payload.  You can see the XML'ized version of this by clicking on any Get<ObjectName>List web method that you'll see after clicking on a *.asmx file.

Now.... is you want to not have to worry about binding proxies all the time, you can use WW.Interface's "ServiceAdapter" widget. There will be documentation and videos soon (we promise) explaining this stuff, but the gist is the a) you can use the javascript API to mash things up on the front end, but b) there is also an invocation ability in C#. The difference between the two models, however is that as of right now if you use the auto-binding of the ServiceAdapter in C#, you won't have strongly named types -- you'll be dealing with XML, converting it to maybe anonymous C# objects on your end, or perhaps just serializing the XML to some application classes that you'll have to create. For now, we'd recommend that if you want to access these webmethods via C# that you do the "old fashioned" way and just use Visual Studio to bind a proxy class via the WSDL.

Hopefully that gives you at least _some_ direction or idea about how to consume this stuff in your custom client. And as we keep mentioning... stay tuned for those vids and docs (HOPEFULLY next week!)... we ARE a small team and are working as hard as possible to get all these ducks in a row :)

Thanks!!
Reply all
Reply to author
Forward
0 new messages