Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Ads  
Active Modules -- Active Forums for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  How do set up a module to consume a web service?
Previous Previous
 
Next Next
New Post 7/22/2008 2:30 PM
Unresolved
User is offline bitpail
31 posts
10th Ranked


How do set up a module to consume a web service? 

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 3:07 PM
User is offline Mitch Sellers
5694 posts
www.mitchelsellers.com
3rd Ranked




Re: How do set up a module to consume a web service? 

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
MCITP, MCPD, MCTS
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 Consulting Quotes, and DNN Technical Support Services

I reccomend 3Essentials for shared hosting and BaseCamp for project management
 
New Post 8/19/2008 5:25 PM
User is offline Rodney Joyce
1583 posts
www.smart-thinker.com
5th Ranked




Re: How do set up a module to consume a web service? 

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?


Thanks,
Rodney
Smart-Thinker - Social Networking modules for DotNetNuke
The DotNetNuke Directory - Are you listed?
PokerDIY - Example Implementation of DNN Social Network
Do use DNN a lot? Try the DotNetNuke Toolbar to save you time!
 
New Post 8/19/2008 10:11 PM
User is offline Michael Washington
2837 posts
ADefWebserver.com
5th Ranked










Re: How do set up a module to consume a web service? 

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
* ADefWebserver.com
* DNN Module Developer's Guide
* IWEB - DNN Web Services
* Silverlight and DotNetNuke
 
New Post 8/20/2008 7:49 AM
User is offline Fooberichu
467 posts
www.seeleyware.com
8th Ranked


Re: How do set up a module to consume a web service? 
Modified By Fooberichu  on 8/20/2008 9:51:08 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.


-- Fooberichu
http://www.seeleyware.com
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  How do set up a module to consume a web service?
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


"SalarO" Skinning Graphic Design Branding Services
SalarO develops packaged & custom skins for your DNN at prices you can afford. SalarO is also developing Module development, Hosting, Branding/Logo design as well as Content Transfer Services to complement the core skinning solutions.
www.salaro.com
Data Springs Inc. - Module Development
Data Springs is a leader in the DNN community offering high quality modules, custom module development, enhancements to the DNN core product and overall DNN support.
www.datasprings.com
XCESS expertise center b.v.
Custom made modules and complete solutions for the DNN framework. Maatwerk modules en complete webtoepassingen gebaseerd op het DNN framework.
www.xcess.nl

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP