Having problem while entegrating my web service to IWEB module

Nov 7, 2009 at 9:48 AM

I downloaded and installed IWEB to my DNN with host account . Then under the App_Code  folder i right-clicked  on the IWebMethods folder and selected Add New Item.

And then i added a class and i manipulated it as such:



using
System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using DotNetNuke.Entities.Users; using DotNetNuke.Common.Utilities; using System.Collections; using System.ComponentModel; using System.Data; // here some dll i need. using asd; using ...; using ...; using ..; using ...; /// <summary> /// Summary description for FirmaBilgileri /// </summary> /// namespace DotNetNuke.Modules.IWebCSharp { public partial class FirmaBilgileri : System.Web.Services.WebService { [WebMethod] public FirmaEntity GetFirma(string firmaKey) { Guid fKey = new Guid(Key); FirmaEntity firma = new FirmaEntity(fKey); // HERE i have lines of codes DbAdapter.FetchEntity(firma, pPath); return firma; } private DataAccessAdapter _dbAdapter; public DataAccessAdapter DbAdapter { get { return _dbAdapter; } set { _dbAdapter = value; } } } }

Then in the web browser, i placed an instance of the IWEB module . Then i clicked on the link that appears after "This website implements this web service:". Then in the list of webservices methods  I couldn't see my webservice method called GetFirma()  - the method i posted above. Do i need to do some extra configuration?

How can i resolve this? Thanks in advance...

 

Coordinator
Nov 7, 2009 at 12:56 PM

You have to make sure that FirmaEntity  is a public class or type and that it is marked [Serializable()]

Nov 7, 2009 at 4:28 PM
adefwebserver wrote:

You have to make sure that FirmaEntity  is a public class or type and that it is marked [Serializable()]

Well actually i was using that webservice method that returns value - that is type of FirmaEntity- when i was not using IWEB. So i think it must be [Serializable()]. If it is not, how can i make it [Serializable()]. Is to insert a line of [Serializable()] just above the line public partial class FirmaBilgileri : System.Web.Services.WebService. enough?

Coordinator
Nov 7, 2009 at 4:34 PM

It should be. All IWeb does is provide some methods to authenticate users via DotNetNuke (for example IWebAuthendication(IWebCredentials)). In your sample code it appears you are not doing that so from your sample code you're not actually using IWeb.

See: http://iweb.adefwebserver.com/ExampleCode/HowtoextendIWebforyourownmodules/tabid/59/Default.aspx

for proper use of IWeb.

Nov 7, 2009 at 6:56 PM

I followed those instructions on the link you sent right upto step 8. the only difference is the code i wrote (and it is below). On the 8 step it says : 8) In the web browser, place an instance of the IWEB module on a page and configure it.
Then click on the link that appears after "This website implements this web service:"
I placed an intance of IWEB module on page as it says but configure what? The only thing i can do is to click the link "this website implement this web service"  and i did it. And couldn't find the method i coded. That is all i did. So isn'y what i am doing "using IWeb" ? What else am i supposed to do?

 

Here is my code:

 

 

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using DotNetNuke.Entities.Users;
using DotNetNuke.Common.Utilities;


using System.Collections;
using System.ComponentModel;
using System.Data;


using asd.asd.asd.asd;
using asd.asd.ad.ad.asd;
using asd.asd.asd.asd;
using System.Configuration;
using asd.asd.asd.asd.asd;

/// <summary> /// Summary description for FirmaBilgileri /// </summary> /// namespace DotNetNuke.Modules.IWebCSharp
{
[WebService(Namespace = "http://webservices.DotNetNuke.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public partial class FirmaBilgileri : DotNetNuke.Modules.IWebCSharp.WebService //System.Web.Services.WebService { [WebMethod] public FirmaEntity GetFirma(string firmaKey)
{
Guid fKey = new Guid(firmaKey);
FirmaEntity firma = new FirmaEntity(fKey);

// Here i have codes but basically here is short
//descreption of what i do here

DbAdapter.FetchEntity(firma, pPath);

return firma;
}

private DataAccessAdapter _dbAdapter;

public DataAccessAdapter DbAdapter
{
get { if (_dbAdapter == null)
{
_dbAdapter = new DataAccessAdapter();
_dbAdapter.ConnectionString = asdasd;
}
return _dbAdapter;
}
set { _dbAdapter = value; }
}
}
}

 

 

Coordinator
Nov 7, 2009 at 8:26 PM

Hopefully this page will explain IWeb:

http://iweb.adefwebserver.com/ExampleCode/SecureWebServices/tabid/64/Default.aspx

Nov 9, 2009 at 12:21 PM

It is done. Thanks...

I just refered to WebService there in my partial class as such:

 public partial class WebService {}