Copied to clipboard

Flag this post as spam?

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


  • Alex Woods 3 posts 23 karma points
    Apr 12, 2012 @ 19:28
    Alex Woods
    0

    Bolting a WebService into Umbraco 5.1

    Hi,

    I'm trying to build a standard System.Web.Service into Umbraco 5.1 in order to facilitate importing of Documents. I've got a handle on the Fluent API and creating plugins in general, but I'm having trouble figuring out how to best plug a webservice in, specifically:

    • Is there a specific plugin type that will work well for this case? I'm looking for something fairly light I guess. Something that gets passed enough context for me to get at the Hive (for document creation/updating) and Security (for user authentication and authorization), and doesn't require me to inherit from a class (because my class must inherit from System.Web.Service.WebService).
    • Where is the best place to sort out routing for a service like this? It doesn't need to get involved in Umbraco routing at all, I suppose, so is it best to sort it at the MVC level, or is there an Umbraco way to set it up?
    Thanks for any advice.

  • Alex Woods 3 posts 23 karma points
    Apr 19, 2012 @ 18:41
    Alex Woods
    0

    We eventually did the following to get the WebService in place:

    • Modify Umbraco.Cms.Web.UI.MvcApplication so that UmbracoWebApplication is public static rather than protected
    • Reference the WebService old-style in a .asmx file as these can be got to directly through the web without MVC getting involved
    • Inside the WebService code, MvcApplication.UmbraceWebApplication can be used to get the app context and therefore get hold of the Hive etc.
    It would be nice to have a solution that doesn't involve modifying the Umbraco source, but at least it's a small change. If anyone knows a better solution it would be great to hear it!
  • Usama Khalil 5 posts 25 karma points
    Apr 25, 2012 @ 05:56
    Usama Khalil
    0

    Could you have looked to get the Hive Manager from HiveManagerWrapper as described in this post:

    http://yaplex.com/blog/umbraco-5-get-content-from-hivemanager-using-separate-application-207/

     

    And then use that Hive Context to add content :)

  • Alex Woods 3 posts 23 karma points
    Apr 27, 2012 @ 14:36
    Alex Woods
    0

    We had a go at using the HiveManagerWrapper, but it didn't seem to have enough hooked up for us to create new revision objects using the Fluent API. If I remember correctly it was due to the Mappings for document types not being set up. If you look in GetTypeMappers() the binders have a ManualMapperv2 which is created with null args. When we tried to create a new revision of something we'd get a null object exception when one of these args was attempted to be used. Working out exactly what was required to initialise it properly wasn't easy and there was just this protected property hanging around on UmbracoWebApplication that gave us everything we needed and was guaranteed to be set up correctly :)

  • John Proctor 12 posts 32 karma points
    May 16, 2012 @ 17:20
    John Proctor
    0

    Hi,

     

    I'm also trying to a WCF service, but I am looking at getting and adding Members.  Is there any other route for this other than modifying UmbracoWebApplication  at present? I'm assuming that HiveManager wouldn't give me what I need to work with members?

Please Sign in or register to post replies

Write your reply to:

Draft