Monday, January 24, 2011

Accessing Ektron from a DLL or console app

As part of trying to use Webforms.MVP with Ektron, I have created a DLL that contains my business logic, which is referenced by the Ektron site. However, this DLL needs to access the Ektron webservice, in order to get/update content and members.

Note: wsdl and csc are part of the .Net SDK. You will need to have this installed. Once installed, you can access them via the SDK Cmd Shell, or, if your path is correctly configured, via cmd.exe.

 

  1. Create a proxy object for the web service
    1. Run .Net tool wsdl.exe against your webservice address, e.g. http://localhost:/Workarea/webservices/ContentWS.asmx
    2. Compile into DLL by running “csc /t:library ContentWS.cs”
  2. Add the DLL as a reference to your DLL or console app
    1. Copy the DLL to a Lib folder in your project
    2. Right click “Add reference” and browse to your created proxy DLL.
  3. Add System.Web.Services as a reference to your DLL or console app
  4. Call the proxy DLL from the code

      ContentWS cApi = new ContentWS();
      ShowContentResult response = cApi.GetContentBlock(contentId);
       

 

That’s enough if your DLL or console app needs access. However, if, like me, you wish to have your Ektron site reference your DLL (in my case, for testability via Webforms.MVP) then you get a DLL conflict. The next post will be on how to overcome this.

 

References-

Great little tutorial on access web services from a console

MSDN article on Wsdl.exe

No comments:

Post a Comment