Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • theevilgeek 15 posts 90 karma points
    Aug 13, 2009 @ 17:19
    theevilgeek
    0

    Trouble getting started with API (basic question)

    Hi all,

    Due to certain limitations in the built-in Umbraco web service (namely, the inability to set the document's template or to associate a node with a subdomain), I've started building a seperate helper web service to allow my Umbraco install [running on a seperate machine] to be interacted with programmatically.

    However, in attempting to build this very lightweight service, I've run into some trouble "getting off the ground". I've started by creating a new solution and adding references to the Umbraco DLL files (businesslogic, cms, and umbraco). However, I'm not sure how to "connect" this solution to the particular Umbraco install I'm running with. It seems as though I need to somehow work from within that particular installation or at least provide a few config settings.

    I realize this is a fairly n00bish question, but I'm hoping someone can help set me straight with regarding to building an independent web service (from the ground up) that interacts with the Umbraco API. I.e., where do I put my service? What needs to be in-place? Do I need to work from within my umbraco install somehow?

     

    Thanks tremendously!

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 13, 2009 @ 17:34
    Thomas Höhler
    100

    Take a look into my Codegarden session: http://our.umbraco.org/wiki/codegarden-2009/codegarden09-sessions/the-box/using-webservices-in-umbraco

    If you have any questions just contact me (mail and blog is in the pdf of powerpoint slides)

    Thomas

  • theevilgeek 15 posts 90 karma points
    Aug 13, 2009 @ 18:46
    theevilgeek
    0

    Thomas' excellent demos and presentation helped me better understand the way in which the API was intended to be used.

    In particular, the web service must run within the context of a particular Umbraco install. What this means is that both the .asmx service file as well as the corresponding code (residing in a .dll file) must be copied to the present Umbraco install directory before the umbraco API calls will take effect.

    Thus, by modifying my build process to copy both the resulting .dll file to my umbraco installation's bin folder (C:\inetpub\umbraco\bin) as well as the .asmx web service specification to a new folder named "webservices" within the root of my umbraco installation (C:\inetpub\umbraco\webservices), I was able to access the service via IIS (rather than the VS testing web server) and issue API calls successfully by visiting "http://localhost/umbraco/webservices/MyService.asmx".

    Still more concretely, I set the "Post-build event command line" within my project's properties dialog (in my empty solution with umbraco.dll, cms.dll, business.dll referenced) to the following script:

    xcopy "$(ProjectDir)bin\UmbracoHelper*.dll" "C:\inetpub\umbraco\bin" /Y
    xcopy "$(ProjectDir)*.asmx" "C:\inetpub\umbraco\webservices" /Y

    The "UmbracoHelper*.dll" pattern was used to support copying additional assemblies in the future -- I will ensure all of the resulting DLLs start with "UmbracoHelper" and thus fit this pattern.

    Finally, though I vaguely understand why this works, I was hoping someone a bit more skilled in .NET/Umbraco can explain more concretely why placing the DLL and web service in Umbraco's installation directory did the trick. Does this merely set things up so that the API methods in Umbraco's DLLs will be able to find the resources that are needed?

    Thanks Thomas for your help!

Please Sign in or register to post replies

Write your reply to:

Draft