views:

1065

answers:

1

I need to deploy a webservice as part of a DotNetNuke 4.x module that I'm creating - but am not sure how I can do that and know that it'll always stay in the same place. How can I add an asmx file to my module project, and when I create my .DNN file specify where the webservice will end up? I want to reference the webservice from inside the ascx file in the module using the "~/webservices/webservice.asmx" format.

Does DotNetNuke have a way to specify in the .DNN file where the webservices will end up on the site? And if so, will I still be able to reference them with root anchored tags like ~/myservice.asmx?

+3  A: 

Hey Scott,

You can include the ASMX file by including a element in the <files> section:

<files>
 <file>
  <name>YourWebService.asmx</name>
  <path></path>
 </file>
</files>

Generally, you don't need to specify a path.

Alternatively, you can include a Resources.zip file with your package which will include any files other than those that DNN needs to process during installation (e.g. Assemblies and SqlDataProvider files).

The benefit of this is maintainability. Using Resources.zip will keep you from having to edit the manifest file over and over...

The contents of the zip file will simply be unpacked into the root module directory (e.g. /DesktopModules/YourModule/*). If there is a file structure within your zip file it will be maintained.

You'll want to add TheNameOfYourFile.zip To your manifest file under the element.

[snip]

<folder>
  <name>Your Module</name>
  <friendlyname>Your Module</friendlyname>
  <foldername>YourModule</foldername>
  <modulename>YourModule</modulename>
  <description>A module for DotNetNuke websites.</description>
  <version>01.00.00</version>
  <resourcefile>Resources.zip</resourcefile>
  <businesscontrollerclass></businesscontrollerclass>
  <modules>
    <module>

[/snip]

As for referencing it in your module - I suggest using:

<%=ResolveUrl("~/DesktopModules/YourModule/Services.asmx")%>
Ian Robinson
so if I don't specify a path, will the webservice live at ~/DesktopModules/MyModule/MyService.asmx? or would that put it at the root of the nuke site at ~/MyService.asmx?
Scott Ivey
It would live at "~/DesktopModules/MyModule/MyService.asmx" which can be thought of as the "top level" for the module's files. (aside from the assembly)
Ian Robinson
Also, see my edit regarding how to get the file's URL from markup
Ian Robinson