Print Page | Close Window

Extend Webservice class???

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1272
Printed Date: 23-Apr-2025 at 9:08pm


Topic: Extend Webservice class???
Posted By: orcities
Subject: Extend Webservice class???
Date Posted: 21-May-2009 at 7:29am
Is there a way to add to the Webservice class? I tried creating another partial class but the methods I added do not show up in the webservice.
 
I am trying to add custom methods. These methods do not return Model entities they return DynamicEntities.
 
As of right now I have to add my methods back in everytime I save the Object Mapper.



Replies:
Posted By: orcities
Date Posted: 11-Jun-2009 at 8:25am

Got to love the quick reply. IdeaBlade come on.



Posted By: kimj
Date Posted: 11-Jun-2009 at 2:36pm
We apologize.  Sometimes posts slip through unnoticed.  When you need immediate help with a problem email mailto:support@ideablade.com - support@ideablade.com directly.
 
You can extend the WebService partial class, and be sure to decorate the methods with the [WebMethod] attribute so that the methods are visible.  The Web Service Publishing sample application in the 300 Advanced Series of the Instructional Units contains a sample web service with additional web methods in a partial class.


Posted By: orcities
Date Posted: 15-Jun-2009 at 8:21am
I have tried that but the class methods are not visible in the partial class.
 
ExecuteQuery is not accessable. In the example it uses ExecuteIEntityQuery which is also not accessable.
 
My Extended Webservice:

using System;

using System.Web.Services;

using System.Web.Services.Protocols;

using IdeaBlade.Persistence;

using IdeaBlade.Persistence.WS;

using IdeaBlade.Util;

 

namespace LOC.CEMS.Model

{

    public partial class Webservice

    {

 

        [WebMethod]

        [SoapHeader("SecurityHeader", Direction = SoapHeaderDirection.InOut)]

        public System.Data.DataSet GetQueryResults(IdeaBlade.Persistence.WS.Query pQueryForQueryId, params object[] args)

        {

            Query[] mResults = ExecuteQuery<Query>(pQueryForQueryId, string.Empty);

            …..

        }

    }

}



Posted By: kimj
Date Posted: 15-Jun-2009 at 10:10am
Is "Webservice" the name of the auto-generated class also?  (Note that the s is lowercase in your class.)  Is the auto-generated class also in the LOC.CEMS.Model namespace?  In order to "extend" the auto-generated class, the fully-qualified type name must be the same, otherwise the compiler generates a new class altogether, which sounds like what you're seeing.


Posted By: orcities
Date Posted: 15-Jun-2009 at 10:15am
I looked over that 50 times atleast and still didn't catch it until I went to copy and paste to show you that I had it the same. Need to get my brain - eye communication checked.
 
 



Print Page | Close Window