LLblGen Entites Via WebService

Posts   
 
    
Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 13-Jun-2007 11:27:12   

Hi People,

Im just building a simple at as an experiment in web services and i got a tad stuck, this is going to sound really stupid but:

I have a method on my web service that just returns a simple LLBLGen Entity:

[WebMethod]
public NodeEntity FetchNodeItemById(int id)
{
    return NodeManager.FetchNodeItemById(id);
}

When I consume the web service it insists that the web method returns a Dataset not a NodeEntity?

No idea how to tell it that it is a Node Entity, anyone know?

Thanks! Alex

fpw2377
User
Posts: 35
Joined: 23-Feb-2007
# Posted on: 13-Jun-2007 15:05:50   

Hi Alex,

Webservices think everything is a dataset. You can manually alter the webservice proxy code to change the return types and it should work. In your project, show all files and look for the reference.cs or reference.vb file under your web references. In there you will see the code generated by visual studio for you, look for the dataset and change it to your correct type. There are also LLBL Templetes in the customer area to do this but I have never used them and are not familiar with how they work, maybe someone else could elaborate on those.

Thanks,

Frank

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 13-Jun-2007 15:19:22   

Please check the following section in the manual: "Using the generated code -> XML Webservices support"

Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 15-Jun-2007 08:40:39   

Hi Guys,

Well I dont feel so stupid now, that is a bit of a messy solution, is anyone aware of a simpler way of doing it? is it possible to do import the types without the schema importer? can you generate a proxy class and update the return types manually?

Thanks! A

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 15-Jun-2007 08:49:22   

can you generate a proxy class and update the return types manually?

Yes you can. I used to update it manually, when I had a project in VS2003 /.NET 1.1 But this was a headache as you have to maintain it, when the web service changes the file is re-generated again keep a copy of the modified file and maintain the changes manually.

Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 15-Jun-2007 08:51:35   

WOW quick reply there!

Umm yeah that does sound like a pain in the butt, has anyone written a custom WSDL tool? Or are there any attribute tags you can use on the webservice to define the return type?

Thanks! A

mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 16-Jun-2007 06:42:06   

Maxus wrote:

Hi Guys,

Well I dont feel so stupid now, that is a bit of a messy solution, is anyone aware of a simpler way of doing it? is it possible to do import the types without the schema importer? can you generate a proxy class and update the return types manually?

Best is not to return LLBLGen entities via web services but rather send DTOs.

Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 17-Jun-2007 07:47:24   

Hi Guys,

Yeah after seeing how big the serialised LLBLGEn entities are, I have decided to go the DTO path. which has the added advantage of making my PL layer know nothing about LLBLgen and treat the whole thing as just a secure service.

But I must say I'm amazed by how difficult MS has made it. rage

Anyhow thanks for everyones help and the outstanding reponse time for the LLBLGEN Staff! -Alex

Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 18-Jun-2007 12:05:08   

Hi Guys!

I found this article about schema importing, might be really useful to add this info to the LLBLGEN doco, They explain how to use the scheme importer without editing the machine config and just making couple changes to the VS config files:

http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wsproxy.mspx

As well as a couple other tips and tricks!

Enjoy! Alex