Download DOWNLOAD
Forums FORUMS
Blogs BLOGS
Forge FORGE
Help HELP
Marketplace MARKETPLACE
DotNetNuke Home
You are here >   Community > Forums
Register  |  Login

DotNetNuke Forums

DotNetNuke ForumDotNetNuke ForumDevelopment and...Development and...DotNetNuke Open...DotNetNuke Open...Webservice HelpWebservice Help
Previous
 
Next
New Post
9/4/2009 1:59 PM
 

I am trying to build a module that accesses a webservice to do some work.. when I add the web reference to my project all seems fine... I build it and copy the dll to the bin folder on the test server and at runtime I get an error that the type defined in teh webservice is not defined??? What is needed to consume a webservice in DNN 5 using VS2008?

 

Thank you

New Post
9/5/2009 12:31 PM
 

Note, This only applies to making a module call OUT to a external web service:

With DotNetNuke your webservice needs a "proxy" and that proxy needs to be an assembly (a .dll) that is placed in the "/bin" directory of your DotNetNuke website.

To create this proxy, you open your DotNetNuke website in Visual Studio and you select Add then New Project. You then create a "ASP.NET Web Application".

In the is "ASP.NET Web Application", you create a normal "proxy" to your web service (using "Add Web Reference...").

You then compile the project and it will create an assembly in the "/bin" directory of your DotNetNuke website.

Note that you have not written any code, you just created a .dll that is nothing but a "shell".

You can now use that "web proxy shell" to connect to an external webservice using code such as:

// Reference to the web service           
VacationRequestWorkflow_WebService wsVacationRequest = new VacationRequestWorkflow_WebService();
// Enable cookies           
wsVacationRequest.CookieContainer = new System.Net.CookieContainer();
// Set the address to the web service          
wsVacationRequest.Url = GetWebServiceURL();
// Call the method to start the workflow           
Guid WorkflowInstanceID = wsVacationRequest.StartWorkflow(VacationRequest.RequestID,
    VacationRequest.CheckDigit, GetLocalWebserviceURL(), PortalSettings.Email, UserInfo.Email);

in the code above, I created a "ASP.NET Web Application" called "VacationRequestWorkflow_WebService". I instantiate the class in my DotNetNuke module code and then I set the address of the web service with this line:

wsVacationRequest.Url = GetWebServiceURL();

I call the method on the web service with this line:

wsVacationRequest.StartWorkflow(VacationRequest.RequestID,
    VacationRequest.CheckDigit, GetLocalWebserviceURL(), PortalSettings.Email, UserInfo.Email);

See this for a working example:

http://www.adefwebserver.com/DotNetNukeHELP/Workflow/VacationRequest2.htm



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
New Post
9/8/2009 2:33 PM
 

Thank you very much for the reply!

Not sure I understand why you need to do this though... I am developing a control in its own project.. I just reference the dnn dlls in the project. I dont open up the entire DNN project to build my apps... are you saying it is not possible/advisable to do it this way when I need to add a web reference?


Thank you in advance..


Also - I NEVER get email posts - even when I ask for them from the forum.. any ideas why this is? I am on gmail.com.

Thanks

New Post
9/8/2009 6:32 PM
 

tknman0700 wrote
 

Not sure I understand why you need to do this though... I am developing a control in its own project.. I just reference the dnn dlls in the project. I dont open up the entire DNN project to build my apps... are you saying it is not possible/advisable to do it this way when I need to add a web reference?

It should also work the way you create your projects.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
Previous
 
Next
DotNetNuke ForumDotNetNuke ForumDevelopment and...Development and...DotNetNuke Open...DotNetNuke Open...Webservice HelpWebservice Help

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.

Networks

Follow DNNCorp on Twitter

LinkedIn

Follow us on Twitter @DNNCorp or join the DotNetNuke Community on LinkedIn

Sponsors

DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation

Hosted by MaximumASP