Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How do set up a module to consume a web service?How do set up a module to consume a web service?
Previous
 
Next
New Post
7/22/2008 4:30 PM
 

I'm creating a module that consumes a web service on a different server. This is a custom webservice not associated with the DNN code. When I add a web reference in Visual Studio it adds a number of files to the App_WebReferences folder as well as an entry in the web.config. The webservice works fine however I'm not sure if this setup is portable, that is, I will not be able to just add the module as a zip file as there will be additions to the web.config...and possibly to the App_WebReferences folder.

I must be doing something wrong, what is the appropriate way to use webservices in DNN?

Thanks

 

 
New Post
7/24/2008 5:07 PM
 

You can modify the generated proxy class to hard code the url, thus removing the need for the web.config setting.  Then once it is compiled you don't need the app_webreferences folder.

If you want an example, my WeatherConditionsService module that is available from http://www.iowacomputergurus.com uses a webservice reference.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
8/19/2008 7:25 PM
 

Hi Mitch,

I have a module that has a webservice in it and then another module that consumes it. I am getting the same problem as the 2nd module adds the web.config.

I downloaded your example but you still have the web.config in it - can you explain the relationship between the web.config and the Settings.settings class that is added under Properties? It looks like the web.config defines the application level WS URL and then this could be overwritten in the Settings.Settings file?  Ierased the web.config in my project and now it works, but I am not entirely sure how to package it for deployment:

The Webservice location will always be static within a DNN installation - it calls another module under DesktopModules so this should never have to change, but it has to be on the same serer (ie. when I ship the module the webservice URL is relative to that module's location but should always be the same).

Also, the Webservice in the other module may or may not exist - they might not be using integration. Would you suggest I write a UI to select the 1st module's WS URL in the 2nd Modules Settings it they wish to use it?

I looked at iWeb but from what I can see you have to download a separate project and it is not for deployment in a module form - it is for portal level web services, unless I misunderstood.

I also need to consider web service security - only the other module should be able to call the WS from code - it should not be invoked manually - any high-level ideas that I can investigate further?


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
8/20/2008 12:11 AM
 

IWeb is for calling "into" DotNetNuke not calling out of it.

If using Silverlight is a possibility having it call a web service is super easy (Silverlight 1.0 is released and Silverlight 2.0 is in Beta but it's being used at the Olympics and has a go live license)



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
8/20/2008 9:49 AM
 

I *may* be missing something here as to the final intention of the web services you all are using, but the Settings files, the web.config changes, etc, are only if you want to instantiate the webservice directly and use right away.  You can always set the URL manually through code but still use the proxy classes as generated. 

I have a web service that I use in a lot of my DNN modules as well as several Windows applications, etc, at my place of work.  I created a class library that references the development copy of the webservice by default, but then I have some logic calls that I can use to instantiate an instance of the web service and redirect to a live copy of the web service.  Example usage:

public static UserDirectory.DirectoryService GetServiceInstance(bool useLive)
{
    UserDirectory.DirectoryService svc = new UserDirectory.DirectoryService();
   svc.Url = "http://someurl/DesktopModules/MACU.UserDirectory/DirectoryService.asmx";
   // optionally use default credentials
   // svc.UseDefaultCredentials = true;
   // optionally set credentials
   // svc.Credentials = new System.Net.NetworkCredential("someuser", "somepassword", "somedomain");
   return svc;
}

When I use that other library I don't ever copy the Settings file or the app.config that it generated when I first referenced the web service in the first place and it all still works just dandy.

*EDIT* I should add that I use the WAP method for my modules instead of the WSP method so it maintains itself completely separate from the rest of the DNN code.  Not to say that the same approach couldn't be used in WSP, but if you wanted to not use a separate class library you'd just need to take care and make sure the code is separated and if you use the "precompiled" method with the WSP, that code can be copied and deployed with the module.


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How do set up a module to consume a web service?How do set up a module to consume a web service?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out